diff --git a/.github/workflows/ls1_staticCodeAnalysis.yml b/.github/workflows/ls1_staticCodeAnalysis.yml new file mode 100644 index 0000000000..1153d6c0a8 --- /dev/null +++ b/.github/workflows/ls1_staticCodeAnalysis.yml @@ -0,0 +1,21 @@ +name: Static-Code-Analysis + +on: + push: + # pushes to master + branches: [ master ] + pull_request: + # PRs to master + branches: [ master ] + +jobs: + static_analysis: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Setup + run: | + sudo apt-get update + sudo apt-get install -y cpplint + - name: Run static code analysis script + run: ./checks/run-staticAnalysis.sh $PWD diff --git a/checks/check-buildOptions.sh b/checks/check-buildOptions.sh new file mode 100755 index 0000000000..cb78ef66f5 --- /dev/null +++ b/checks/check-buildOptions.sh @@ -0,0 +1,52 @@ +#!/bin/bash +# Script to test the building process by altering through different build options +# It uses the default settings and sets the specified options one by one + +numJobs=20 + +checkFolder=$PWD +buildFolder=$PWD/../build_test_$(date '+%Y-%m-%d') + +declare -A optionsList + +optionsList[ENABLE_MPI]=ON +optionsList[VECTOR_INSTRUCTIONS]=SSE +optionsList[VECTOR_INSTRUCTIONS]=AVX2 +optionsList[CMAKE_BUILD_TYPE]=Debug +optionsList[OPENMP]=ON +optionsList[ENABLE_AUTOPAS]=ON +optionsList[ENABLE_UNIT_TESTS]=ON +optionsList[QUICKSCHED]=ON +optionsList[FMM_FFT]=ON +optionsList[WITH_PAPI]=ON +optionsList[ENABLE_ALLLBL]=ON +optionsList[ENABLE_VTK]=ON +optionsList[REDUCED_MEMORY_MODE]=ON + + +# CMAKE +mkdir -p $buildFolder +cd $buildFolder + +echo "Running CMAKE in folder: $buildFolder" + +for option in "${!optionsList[@]}" +do + echo " Running option: ${option}=${optionsList[${option}]}" + rm $buildFolder/* -rf + ( CC=mpicc CXX=mpicxx cmake -D${option}=${optionsList[${option}]} .. && make -j${numJobs} ; echo "$?" ) &> $checkFolder/build_test_cmake_${option}.log +done + + +# MAKE +cd $checkFolder/../src + +echo "Running make in src" + +for option in "${!optionsList[@]}" +do + echo " Running option: ${option}=${optionsList[${option}]}" + make clean &> /dev/null + ( make -j${numJobs} -f Makefile ${option}=${optionsList[${option}]} ; echo "$?" ) &> $checkFolder/build_test_make_${option}.log +done + diff --git a/checks/run-staticAnalysis.sh b/checks/run-staticAnalysis.sh new file mode 100755 index 0000000000..ae1c268ef7 --- /dev/null +++ b/checks/run-staticAnalysis.sh @@ -0,0 +1,82 @@ +#!/bin/bash +# Script to run static code analysis + +#set strict pipefail option +#set -eo pipefail + +# A path to the root folder of ls1 mardyn can be set via an argument; if not, the parent folder of "checks" is used +if [ $# -eq 1 ] +then + rootFolder=$1 +else + rootFolder=$PWD/.. +fi + +echo "Running in $rootFolder" + +warnings="" + +codeFiles=$( find $rootFolder/src -name "*.h" -or -name "*.cpp" -printf "%p " ) + +# Similar to check_format of MegaMol repo +for file in $codeFiles; do + + # Check if using namespace std is used + if grep -q "using namespace std;" "$file"; then + echo "\"using namespace std;\" was used in $file" + warnings+="Do not use \"using namespace std;\"\n" + fi + + # Check if using Log::global_log is used + if grep -q "using Log::global_log;" "$file"; then + echo "\"using Log::global_log;\" was used in $file" + warnings+="Do not use \"using Log::global_log;\"\n" + fi + + # Check if file is UTF-8 (or ASCII) + encoding=$(file -b --mime-encoding "$file") + if [[ $encoding != "us-ascii" && $encoding != "utf-8" ]]; then + echo "The following file is not ASCII/UTF-8 encoded: $file ($encoding)" + echo " Fix with:" + echo " tmp_file=\$(mktemp)" + echo " iconv -f \"\$(file -b --mime-encoding \"$file\")\" -t utf-8 -o \"\$tmp_file\" \"\$file\"" + echo " mv -f \"\$tmp_file\" \"\$file\"" + warnings+="At least one file is not ASCII/UTF-8 encoded\n" + fi + + # Check if file contains CRLF line endings + fileinfo=$(file -k "$file") + if [[ $fileinfo == *"CRLF"* ]]; then + echo "The following file contains CRLF line endings: $file" + echo " Fix with:" + echo " sed -i 's/\r$//' \"$file\"" + sed -i 's/\r$//' "$file" + warnings+="At least one file contains CRLF line endings\n" + fi + + # Check if file starts with BOM + if [[ $fileinfo == *"BOM"* ]]; then + echo "The following file starts with BOM: $file" + echo " Fix with:" + echo " sed -i '1s/^\xEF\xBB\xBF//' \"$file\"" + warnings+="At least one file starts with BOM\n" + fi + + # Check if file ends with newline + if [[ -n "$(tail -c 1 "$file")" ]]; then + echo "The following file does not end with newline: $file" + echo " Fix with:" + echo " sed -i -e '\$a\' \"$file\"" + warnings+="At least one file does not end with newline\n" + fi + +done + +printf "\n\n\n" # Some space to make output clearer + +# Only print warnings once to job summary +warnings=$(printf "$warnings" | sort | uniq) +warnings="# Warnings\n"$warnings"\n\n" + +printf "\n$warnings\n" # Print to job output +printf "\n$warnings\n" >> $GITHUB_STEP_SUMMARY # Print to job summary diff --git a/checks/run-validation.sh b/checks/run-validation.sh new file mode 100755 index 0000000000..02ec94be55 --- /dev/null +++ b/checks/run-validation.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# Testscript running validation tests according to GitHub Actions but without comparison to master +# +# Copyright (c) 2023 Simon Homes +# + +repoPath="$PWD/.." # Path to root directory + +export OMP_NUM_THREADS=2 + +logfileName="${repoPath}/examples/run-validation.log" +rm -f ${logfileName} + +IFS=$'\n' +for i in $(cat "${repoPath}/examples/example-list.txt" ) +do + # skip if comment or empty line + if [[ $i == \#* || -z "$i" ]] + then + continue + fi + cd ${repoPath}/examples/$(dirname $i) + + # run the examples + printf "Running example: ${i} ... " | tee -a ${logfileName} + EXE=${repoPath}/build/src/MarDyn + + mpirun --oversubscribe -np 4 ${EXE} $(basename $i) --steps=20 | tee -a ${logfileName} + printf "done\n" +done + diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/BaseTestCase.cpp b/dependencies-external/cppunit-1.12.1/examples/cppunittest/BaseTestCase.cpp index 05bb78a532..f8c934a0a4 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/BaseTestCase.cpp +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/BaseTestCase.cpp @@ -12,26 +12,26 @@ BaseTestCase::~BaseTestCase() } -void +void BaseTestCase::setUp() { } -void +void BaseTestCase::tearDown() { } -void +void BaseTestCase::testUsingCheckIt() { checkIt(); } -void +void BaseTestCase::checkIt() { } diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/ExceptionTest.cpp b/dependencies-external/cppunit-1.12.1/examples/cppunittest/ExceptionTest.cpp index 31dce6477a..439262b793 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/ExceptionTest.cpp +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/ExceptionTest.cpp @@ -18,24 +18,24 @@ ExceptionTest::~ExceptionTest() } -void +void ExceptionTest::setUp() { } -void +void ExceptionTest::tearDown() { } -void +void ExceptionTest::testConstructor() { const CPPUNIT_NS::Message message( "a message" ); const CPPUNIT_NS::SourceLine sourceLine( "dir/afile.cpp", 17 ); - + CPPUNIT_NS::Exception e( message, sourceLine ); CPPUNIT_ASSERT_EQUAL( message.shortDescription(), e.message().shortDescription() ); @@ -43,7 +43,7 @@ ExceptionTest::testConstructor() } -void +void ExceptionTest::testDefaultConstructor() { CPPUNIT_NS::Exception e; @@ -53,7 +53,7 @@ ExceptionTest::testDefaultConstructor() } -void +void ExceptionTest::testCopyConstructor() { CPPUNIT_NS::SourceLine sourceLine( "fileName.cpp", 123 ); @@ -63,7 +63,7 @@ ExceptionTest::testCopyConstructor() } -void +void ExceptionTest::testAssignment() { CPPUNIT_NS::SourceLine sourceLine( "fileName.cpp", 123 ); @@ -74,7 +74,7 @@ ExceptionTest::testAssignment() } -void +void ExceptionTest::testClone() { CPPUNIT_NS::SourceLine sourceLine( "fileName.cpp", 123 ); @@ -84,8 +84,8 @@ ExceptionTest::testClone() } -void -ExceptionTest::checkIsSame( CPPUNIT_NS::Exception &e, +void +ExceptionTest::checkIsSame( CPPUNIT_NS::Exception &e, CPPUNIT_NS::Exception &other ) { std::string eWhat( e.what() ); diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/ExceptionTest.h b/dependencies-external/cppunit-1.12.1/examples/cppunittest/ExceptionTest.h index a3b4c91125..7c0817e876 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/ExceptionTest.h +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/ExceptionTest.h @@ -30,7 +30,7 @@ class ExceptionTest : public CPPUNIT_NS::TestFixture private: ExceptionTest( const ExceptionTest © ); void operator =( const ExceptionTest © ); - void checkIsSame( CPPUNIT_NS::Exception &e, + void checkIsSame( CPPUNIT_NS::Exception &e, CPPUNIT_NS::Exception &other ); private: diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/ExceptionTestCaseDecoratorTest.cpp b/dependencies-external/cppunit-1.12.1/examples/cppunittest/ExceptionTestCaseDecoratorTest.cpp index 177303809a..19ba96709a 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/ExceptionTestCaseDecoratorTest.cpp +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/ExceptionTestCaseDecoratorTest.cpp @@ -21,7 +21,7 @@ ExceptionTestCaseDecoratorTest::~ExceptionTestCaseDecoratorTest() } -void +void ExceptionTestCaseDecoratorTest::setUp() { m_testListener = new MockTestListener( "mock-testlistener" ); @@ -33,7 +33,7 @@ ExceptionTestCaseDecoratorTest::setUp() } -void +void ExceptionTestCaseDecoratorTest::tearDown() { delete m_decorator; @@ -42,7 +42,7 @@ ExceptionTestCaseDecoratorTest::tearDown() } -void +void ExceptionTestCaseDecoratorTest::testNoExceptionThrownFailed() { m_testListener->setExpectedAddFailureCall(1); @@ -56,7 +56,7 @@ ExceptionTestCaseDecoratorTest::testNoExceptionThrownFailed() } -void +void ExceptionTestCaseDecoratorTest::testExceptionThrownPass() { m_testListener->setExpectNoFailure(); diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/HelperMacrosTest.cpp b/dependencies-external/cppunit-1.12.1/examples/cppunittest/HelperMacrosTest.cpp index b88dec6ba6..da4cb89d94 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/HelperMacrosTest.cpp +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/HelperMacrosTest.cpp @@ -98,7 +98,7 @@ class AddTestTestFixture : public CPPUNIT_NS::TestFixture -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( HelperMacrosTest, +CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( HelperMacrosTest, helperSuiteName() ); @@ -112,7 +112,7 @@ HelperMacrosTest::~HelperMacrosTest() } -void +void HelperMacrosTest::setUp() { m_testListener = new MockTestListener( "mock-testlistener" ); @@ -121,7 +121,7 @@ HelperMacrosTest::setUp() } -void +void HelperMacrosTest::tearDown() { delete m_result; @@ -129,7 +129,7 @@ HelperMacrosTest::tearDown() } -void +void HelperMacrosTest::testNoSubclassing() { std::auto_ptr suite( BaseTestCase::suite() ); @@ -142,7 +142,7 @@ HelperMacrosTest::testNoSubclassing() } -void +void HelperMacrosTest::testSubclassing() { std::auto_ptr suite( SubclassedTestCase::suite() ); @@ -155,7 +155,7 @@ HelperMacrosTest::testSubclassing() } -void +void HelperMacrosTest::testFail() { std::auto_ptr suite( FailTestFixture::suite() ); @@ -167,7 +167,7 @@ HelperMacrosTest::testFail() } -void +void HelperMacrosTest::testFailToFail() { std::auto_ptr suite( FailToFailTestFixture::suite() ); @@ -179,19 +179,19 @@ HelperMacrosTest::testFailToFail() } -void +void HelperMacrosTest::testException() { std::auto_ptr suite( ExceptionTestFixture::suite() ); m_testListener->setExpectedStartTestCall( 1 ); m_testListener->setExpectNoFailure(); - + suite->run( m_result ); m_testListener->verify(); } -void +void HelperMacrosTest::testExceptionNotCaught() { std::auto_ptr suite( ExceptionNotCaughtTestFixture::suite() ); @@ -203,7 +203,7 @@ HelperMacrosTest::testExceptionNotCaught() } -void +void HelperMacrosTest::testCustomTests() { std::auto_ptr suite( CustomsTestTestFixture::suite() ); @@ -215,7 +215,7 @@ HelperMacrosTest::testCustomTests() } -void +void HelperMacrosTest::testAddTest() { std::auto_ptr suite( AddTestTestFixture::suite() ); diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/MessageTest.cpp b/dependencies-external/cppunit-1.12.1/examples/cppunittest/MessageTest.cpp index c59544da89..f085e0169a 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/MessageTest.cpp +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/MessageTest.cpp @@ -15,21 +15,21 @@ MessageTest::~MessageTest() } -void +void MessageTest::setUp() { m_message = new CPPUNIT_NS::Message(); } -void +void MessageTest::tearDown() { delete m_message; } -void +void MessageTest::testDefaultConstructor() { std::string empty; @@ -38,7 +38,7 @@ MessageTest::testDefaultConstructor() } -void +void MessageTest::testDetailAtThrowIfBadIndex() { m_message->detailAt( -1 ); @@ -46,14 +46,14 @@ MessageTest::testDetailAtThrowIfBadIndex() -void +void MessageTest::testDetailAtThrowIfBadIndex2() { m_message->detailAt( 0 ); } -void +void MessageTest::testAddDetail() { std::string expected( "first" ); @@ -63,7 +63,7 @@ MessageTest::testAddDetail() } -void +void MessageTest::testAddDetail2() { std::string expected1( "first" ); @@ -75,7 +75,7 @@ MessageTest::testAddDetail2() } -void +void MessageTest::testAddDetail3() { std::string expected1( "first" ); @@ -89,7 +89,7 @@ MessageTest::testAddDetail3() } -void +void MessageTest::testAddDetailEmptyMessage() { m_message->addDetail( CPPUNIT_NS::Message() ); @@ -97,7 +97,7 @@ MessageTest::testAddDetailEmptyMessage() } -void +void MessageTest::testAddDetailMessage() { std::string expected1( "first" ); @@ -109,7 +109,7 @@ MessageTest::testAddDetailMessage() } -void +void MessageTest::testSetShortDescription() { std::string expected( "shortDesc" ); @@ -118,7 +118,7 @@ MessageTest::testSetShortDescription() } -void +void MessageTest::testClearDetails() { m_message->addDetail( "detail1" ); @@ -127,38 +127,38 @@ MessageTest::testClearDetails() } -void +void MessageTest::testConstructor() { std::string expected( "short" ); CPPUNIT_NS::Message message( expected ); - + CPPUNIT_ASSERT_EQUAL( expected, message.shortDescription() ); CPPUNIT_ASSERT_EQUAL( 0, message.detailCount() ); } -void +void MessageTest::testConstructorDetail1() { std::string expected( "short" ); std::string expected1( "detail-1" ); CPPUNIT_NS::Message message( expected, expected1 ); - + CPPUNIT_ASSERT_EQUAL( expected, message.shortDescription() ); CPPUNIT_ASSERT_EQUAL( 1, message.detailCount() ); CPPUNIT_ASSERT_EQUAL( expected1, message.detailAt(0) ); } -void +void MessageTest::testConstructorDetail2() { std::string expected( "short" ); std::string expected1( "detail-1" ); std::string expected2( "detail-2" ); CPPUNIT_NS::Message message( expected, expected1, expected2 ); - + CPPUNIT_ASSERT_EQUAL( expected, message.shortDescription() ); CPPUNIT_ASSERT_EQUAL( 2, message.detailCount() ); CPPUNIT_ASSERT_EQUAL( expected1, message.detailAt(0) ); @@ -166,7 +166,7 @@ MessageTest::testConstructorDetail2() } -void +void MessageTest::testConstructorDetail3() { std::string expected( "short" ); @@ -174,7 +174,7 @@ MessageTest::testConstructorDetail3() std::string expected2( "detail-2" ); std::string expected3( "detail-3" ); CPPUNIT_NS::Message message( expected, expected1, expected2, expected3 ); - + CPPUNIT_ASSERT_EQUAL( expected, message.shortDescription() ); CPPUNIT_ASSERT_EQUAL( 3, message.detailCount() ); CPPUNIT_ASSERT_EQUAL( expected1, message.detailAt(0) ); @@ -183,7 +183,7 @@ MessageTest::testConstructorDetail3() } -void +void MessageTest::testDetailsNone() { CPPUNIT_ASSERT_MESSAGE("012345678901234",true); @@ -192,7 +192,7 @@ MessageTest::testDetailsNone() } -void +void MessageTest::testDetailsSome() { m_message->addDetail( "Expected: 1", "Actual: 7", "Info: number" ); @@ -202,11 +202,11 @@ MessageTest::testDetailsSome() } -void +void MessageTest::testEqual() { CPPUNIT_ASSERT( *m_message == CPPUNIT_NS::Message() ); - + CPPUNIT_NS::Message message1( "short", "det1", "det2", "det3" ); CPPUNIT_NS::Message message2( message1 ); CPPUNIT_ASSERT( message1 == message2 ); @@ -224,7 +224,7 @@ MessageTest::testEqual() } -void +void MessageTest::testNotEqual() { CPPUNIT_NS::Message message1( "short", "det1", "det2", "det3" ); diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/MockProtector.h b/dependencies-external/cppunit-1.12.1/examples/cppunittest/MockProtector.h index ace538d320..a368fc6969 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/MockProtector.h +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/MockProtector.h @@ -8,7 +8,7 @@ class MockProtectorException : public std::runtime_error { public: - MockProtectorException() + MockProtectorException() : std::runtime_error( "MockProtectorException" ) { } diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/MockTestCase.cpp b/dependencies-external/cppunit-1.12.1/examples/cppunittest/MockTestCase.cpp index 9f7c2f68c5..2b1d81550f 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/MockTestCase.cpp +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/MockTestCase.cpp @@ -30,7 +30,7 @@ MockTestCase::~MockTestCase() } -int +int MockTestCase::countTestCases() const { MockTestCase *mutableThis = CPPUNIT_CONST_CAST(MockTestCase *, this ); @@ -45,7 +45,7 @@ MockTestCase::countTestCases() const } -void +void MockTestCase::setUp() { if ( m_hasSetUpExpectation ) @@ -59,7 +59,7 @@ MockTestCase::setUp() throw FailureException(); } -void +void MockTestCase::tearDown() { if ( m_hasTearDownExpectation ) @@ -74,7 +74,7 @@ MockTestCase::tearDown() } -void +void MockTestCase::runTest() { ++m_actualRunTestCallCount; @@ -89,7 +89,7 @@ MockTestCase::runTest() } /* -bool +bool MockTestCase::findTestPath( const CPPUNIT_NS::Test *test, CPPUNIT_NS::TestPath &testPath ) { @@ -103,7 +103,7 @@ MockTestCase::findTestPath( const CPPUNIT_NS::Test *test, } */ -void +void MockTestCase::setExpectedSetUpCall( int callCount ) { m_hasSetUpExpectation = true; @@ -111,13 +111,13 @@ MockTestCase::setExpectedSetUpCall( int callCount ) } -void +void MockTestCase::setExpectedTearDownCall( int callCount ) { } -void +void MockTestCase::setExpectedRunTestCall( int callCount ) { m_expectRunTestCall = true; @@ -125,7 +125,7 @@ MockTestCase::setExpectedRunTestCall( int callCount ) } -void +void MockTestCase::setExpectedCountTestCasesCall( int callCount ) { m_expectCountTestCasesCall = true; @@ -133,28 +133,28 @@ MockTestCase::setExpectedCountTestCasesCall( int callCount ) } -void +void MockTestCase::makeSetUpThrow() { m_setUpThrow = true; } -void +void MockTestCase::makeTearDownThrow() { m_tearDownThrow = true; } -void +void MockTestCase::makeRunTestThrow() { m_runTestThrow = true; } -void +void MockTestCase::verify() { if ( m_hasSetUpExpectation ) diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/MockTestCase.h b/dependencies-external/cppunit-1.12.1/examples/cppunittest/MockTestCase.h index 8ff80e4bcd..9c53bdd115 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/MockTestCase.h +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/MockTestCase.h @@ -23,12 +23,12 @@ class MockTestCase : public CPPUNIT_NS::TestCase void setExpectedTearDownCall( int callCount = 1 ); void setExpectedRunTestCall( int callCount = 1 ); void setExpectedCountTestCasesCall( int callCount = 1 ); - + void makeSetUpThrow(); void makeTearDownThrow(); void makeRunTestThrow(); void makeFindTestPathPassFor( const CPPUNIT_NS::Test *testFound ); - + void verify(); protected: diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/MockTestListener.cpp b/dependencies-external/cppunit-1.12.1/examples/cppunittest/MockTestListener.cpp index 0cacfd36d0..8988d89c65 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/MockTestListener.cpp +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/MockTestListener.cpp @@ -41,7 +41,7 @@ MockTestListener::MockTestListener( std::string name ) } -void +void MockTestListener::setExpectFailure( CPPUNIT_NS::Test *failedTest, CPPUNIT_NS::Exception *thrownException, bool isError ) @@ -55,7 +55,7 @@ MockTestListener::setExpectFailure( CPPUNIT_NS::Test *failedTest, } -void +void MockTestListener::setExpectNoFailure() { m_hasExpectationForAddFailure = true; @@ -63,14 +63,14 @@ MockTestListener::setExpectNoFailure() } -void +void MockTestListener::setExpectFailure() { m_hasExpectationForSomeFailure = true; } -void +void MockTestListener::setExpectedAddFailureCall( int callCount ) { m_hasExpectationForAddFailure = true; @@ -78,7 +78,7 @@ MockTestListener::setExpectedAddFailureCall( int callCount ) } -void +void MockTestListener::setExpectStartTest( CPPUNIT_NS::Test *test ) { m_hasExpectationForStartTest = true; @@ -88,7 +88,7 @@ MockTestListener::setExpectStartTest( CPPUNIT_NS::Test *test ) } -void +void MockTestListener::setExpectedStartTestCall( int callCount ) { m_hasExpectationForStartTest = true; @@ -96,7 +96,7 @@ MockTestListener::setExpectedStartTestCall( int callCount ) } -void +void MockTestListener::setExpectEndTest( CPPUNIT_NS::Test *test ) { m_hasExpectationForEndTest = true; @@ -106,7 +106,7 @@ MockTestListener::setExpectEndTest( CPPUNIT_NS::Test *test ) } -void +void MockTestListener::setExpectedEndTestCall( int callCount ) { m_hasExpectationForEndTest = true; @@ -114,7 +114,7 @@ MockTestListener::setExpectedEndTestCall( int callCount ) } -void +void MockTestListener::setExpectStartSuite( CPPUNIT_NS::Test *test ) { m_hasExpectationForStartSuite = true; @@ -124,7 +124,7 @@ MockTestListener::setExpectStartSuite( CPPUNIT_NS::Test *test ) } -void +void MockTestListener::setExpectedStartSuiteCall( int callCount ) { m_hasExpectationForStartSuite = true; @@ -132,7 +132,7 @@ MockTestListener::setExpectedStartSuiteCall( int callCount ) } -void +void MockTestListener::setExpectEndSuite( CPPUNIT_NS::Test *test ) { m_hasExpectationForEndSuite = true; @@ -142,7 +142,7 @@ MockTestListener::setExpectEndSuite( CPPUNIT_NS::Test *test ) } -void +void MockTestListener::setExpectedEndSuiteCall( int callCount ) { m_hasExpectationForEndSuite = true; @@ -150,7 +150,7 @@ MockTestListener::setExpectedEndSuiteCall( int callCount ) } -void +void MockTestListener::setExpectStartTestRun( CPPUNIT_NS::Test *test, CPPUNIT_NS::TestResult *eventManager ) { @@ -162,7 +162,7 @@ MockTestListener::setExpectStartTestRun( CPPUNIT_NS::Test *test, } -void +void MockTestListener::setExpectedStartTestRunCall( int callCount ) { m_hasExpectationForStartTestRun = true; @@ -170,7 +170,7 @@ MockTestListener::setExpectedStartTestRunCall( int callCount ) } -void +void MockTestListener::setExpectEndTestRun( CPPUNIT_NS::Test *test, CPPUNIT_NS::TestResult *eventManager ) { @@ -182,7 +182,7 @@ MockTestListener::setExpectEndTestRun( CPPUNIT_NS::Test *test, } -void +void MockTestListener::setExpectedEndTestRunCall( int callCount ) { m_hasExpectationForEndTestRun = true; @@ -190,7 +190,7 @@ MockTestListener::setExpectedEndTestRunCall( int callCount ) } -void +void MockTestListener::addFailure( const CPPUNIT_NS::TestFailure &failure ) { if ( m_hasExpectationForAddFailure || m_hasExpectationForSomeFailure ) @@ -214,7 +214,7 @@ MockTestListener::addFailure( const CPPUNIT_NS::TestFailure &failure ) } -void +void MockTestListener::startTest( CPPUNIT_NS::Test *test ) { if ( m_hasExpectationForStartTest ) @@ -222,7 +222,7 @@ MockTestListener::startTest( CPPUNIT_NS::Test *test ) ++m_startTestCall; CPPUNIT_ASSERT_MESSAGE( m_name + ": unexpected call", m_startTestCall <= m_expectedStartTestCallCount ); - + } if ( m_hasParametersExpectationForStartTest ) @@ -233,7 +233,7 @@ MockTestListener::startTest( CPPUNIT_NS::Test *test ) } -void +void MockTestListener::endTest( CPPUNIT_NS::Test *test ) { if ( m_hasExpectationForEndTest ) @@ -251,7 +251,7 @@ MockTestListener::endTest( CPPUNIT_NS::Test *test ) } -void +void MockTestListener::startSuite( CPPUNIT_NS::Test *test ) { if ( m_hasExpectationForStartSuite ) @@ -269,7 +269,7 @@ MockTestListener::startSuite( CPPUNIT_NS::Test *test ) } -void +void MockTestListener::endSuite( CPPUNIT_NS::Test *test ) { if ( m_hasExpectationForEndSuite ) @@ -287,8 +287,8 @@ MockTestListener::endSuite( CPPUNIT_NS::Test *test ) } -void -MockTestListener::startTestRun( CPPUNIT_NS::Test *test, +void +MockTestListener::startTestRun( CPPUNIT_NS::Test *test, CPPUNIT_NS::TestResult *eventManager ) { if ( m_hasExpectationForStartTestRun ) @@ -308,8 +308,8 @@ MockTestListener::startTestRun( CPPUNIT_NS::Test *test, } -void -MockTestListener::endTestRun( CPPUNIT_NS::Test *test, +void +MockTestListener::endTestRun( CPPUNIT_NS::Test *test, CPPUNIT_NS::TestResult *eventManager ) { if ( m_hasExpectationForEndTestRun ) @@ -329,55 +329,55 @@ MockTestListener::endTestRun( CPPUNIT_NS::Test *test, } -void +void MockTestListener::verify() { if ( m_hasExpectationForStartTest ) { CPPUNIT_ASSERT_EQUAL_MESSAGE( m_name + ": missing startTest calls", - m_expectedStartTestCallCount, + m_expectedStartTestCallCount, m_startTestCall ); } if ( m_hasExpectationForEndTest ) { CPPUNIT_ASSERT_EQUAL_MESSAGE( m_name + ": missing endTest calls", - m_expectedEndTestCallCount, + m_expectedEndTestCallCount, m_endTestCall ); } if ( m_hasExpectationForStartSuite ) { CPPUNIT_ASSERT_EQUAL_MESSAGE( m_name + ": missing startSuite calls", - m_expectedStartSuiteCallCount, + m_expectedStartSuiteCallCount, m_startSuiteCall ); } if ( m_hasExpectationForEndSuite ) { CPPUNIT_ASSERT_EQUAL_MESSAGE( m_name + ": missing endSuite calls", - m_expectedEndSuiteCallCount, + m_expectedEndSuiteCallCount, m_endSuiteCall ); } if ( m_hasExpectationForStartTestRun ) { CPPUNIT_ASSERT_EQUAL_MESSAGE( m_name + ": missing startTestRun calls", - m_expectedStartTestRunCallCount, + m_expectedStartTestRunCallCount, m_startTestRunCall ); } if ( m_hasExpectationForEndTestRun ) { CPPUNIT_ASSERT_EQUAL_MESSAGE( m_name + ": missing endTestRun calls", - m_expectedEndTestRunCallCount, + m_expectedEndTestRunCallCount, m_endTestRunCall ); } if ( m_hasExpectationForAddFailure ) { CPPUNIT_ASSERT_EQUAL_MESSAGE( m_name + ": missing addFailure calls", - m_expectedAddFailureCallCount, + m_expectedAddFailureCallCount, m_addFailureCall ); } diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/MockTestListener.h b/dependencies-external/cppunit-1.12.1/examples/cppunittest/MockTestListener.h index 17f2dfaed9..ba63f418fd 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/MockTestListener.h +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/MockTestListener.h @@ -37,9 +37,9 @@ class MockTestListener : public CPPUNIT_NS::TestListener void endTest( CPPUNIT_NS::Test *test ); void startSuite( CPPUNIT_NS::Test *suite ); void endSuite( CPPUNIT_NS::Test *suite ); - void startTestRun( CPPUNIT_NS::Test *test, + void startTestRun( CPPUNIT_NS::Test *test, CPPUNIT_NS::TestResult *eventManager ); - void endTestRun( CPPUNIT_NS::Test *test, + void endTestRun( CPPUNIT_NS::Test *test, CPPUNIT_NS::TestResult *eventManager ); void verify(); diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/OrthodoxTest.cpp b/dependencies-external/cppunit-1.12.1/examples/cppunittest/OrthodoxTest.cpp index ae1edb36ad..8c87074600 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/OrthodoxTest.cpp +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/OrthodoxTest.cpp @@ -16,7 +16,7 @@ OrthodoxTest::~OrthodoxTest() } -void +void OrthodoxTest::setUp() { m_testListener = new MockTestListener( "mock-listener" ); @@ -25,7 +25,7 @@ OrthodoxTest::setUp() } -void +void OrthodoxTest::tearDown() { delete m_result; @@ -33,7 +33,7 @@ OrthodoxTest::tearDown() } -void +void OrthodoxTest::testValue() { CPPUNIT_NS::Orthodox test; @@ -43,7 +43,7 @@ OrthodoxTest::testValue() } -void +void OrthodoxTest::testValueBadConstructor() { CPPUNIT_NS::Orthodox test; @@ -53,7 +53,7 @@ OrthodoxTest::testValueBadConstructor() } -void +void OrthodoxTest::testValueBadInvert() { CPPUNIT_NS::Orthodox test; @@ -63,7 +63,7 @@ OrthodoxTest::testValueBadInvert() } -void +void OrthodoxTest::testValueBadEqual() { CPPUNIT_NS::Orthodox test; @@ -73,7 +73,7 @@ OrthodoxTest::testValueBadEqual() } -void +void OrthodoxTest::testValueBadNotEqual() { CPPUNIT_NS::Orthodox test; @@ -83,7 +83,7 @@ OrthodoxTest::testValueBadNotEqual() } -void +void OrthodoxTest::testValueBadCall() { CPPUNIT_NS::Orthodox test; @@ -93,7 +93,7 @@ OrthodoxTest::testValueBadCall() } -void +void OrthodoxTest::testValueBadAssignment() { CPPUNIT_NS::Orthodox test; diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/OrthodoxTest.h b/dependencies-external/cppunit-1.12.1/examples/cppunittest/OrthodoxTest.h index 422c074633..5aaa9684d4 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/OrthodoxTest.h +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/OrthodoxTest.h @@ -81,7 +81,7 @@ class OrthodoxTest : public CPPUNIT_NS::TestFixture } }; - + class ValueBadInvert : public Value { public: @@ -93,7 +93,7 @@ class OrthodoxTest : public CPPUNIT_NS::TestFixture } }; - + class ValueBadEqual : public Value { public: @@ -110,7 +110,7 @@ class OrthodoxTest : public CPPUNIT_NS::TestFixture } }; - + class ValueBadNotEqual : public Value { public: @@ -133,7 +133,7 @@ class OrthodoxTest : public CPPUNIT_NS::TestFixture public: ValueBadCall( int value =0 ) : Value( value ) {} - ValueBadCall( const ValueBadCall &other ) + ValueBadCall( const ValueBadCall &other ) { static int serialNumber = 0; m_value = ++serialNumber; diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/RepeatedTestTest.cpp b/dependencies-external/cppunit-1.12.1/examples/cppunittest/RepeatedTestTest.cpp index 70d55c70e4..fbe2443a0c 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/RepeatedTestTest.cpp +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/RepeatedTestTest.cpp @@ -18,7 +18,7 @@ RepeatedTestTest::~RepeatedTestTest() } -void +void RepeatedTestTest::setUp() { m_test = new RunCountTest(); @@ -26,14 +26,14 @@ RepeatedTestTest::setUp() } -void +void RepeatedTestTest::tearDown() { delete m_repeatedTest; } -void +void RepeatedTestTest::testRun() { CPPUNIT_NS::TestResult result; diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/StringToolsTest.cpp b/dependencies-external/cppunit-1.12.1/examples/cppunittest/StringToolsTest.cpp index 5682767c37..cbca93d7b0 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/StringToolsTest.cpp +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/StringToolsTest.cpp @@ -14,19 +14,19 @@ StringToolsTest::~StringToolsTest() } -void +void StringToolsTest::setUp() { } -void +void StringToolsTest::tearDown() { } -void +void StringToolsTest::testToStringInt() { std::string expected = "123456789"; @@ -35,7 +35,7 @@ StringToolsTest::testToStringInt() } -void +void StringToolsTest::testToStringDouble() { std::string expected = "1234.56"; @@ -44,7 +44,7 @@ StringToolsTest::testToStringDouble() } -void +void StringToolsTest::testSplitEmptyString() { std::string text; @@ -56,7 +56,7 @@ StringToolsTest::testSplitEmptyString() } -void +void StringToolsTest::testSplitOneItem() { std::string text = "1"; @@ -69,7 +69,7 @@ StringToolsTest::testSplitOneItem() } -void +void StringToolsTest::testSplitItemEmpty() { std::string text = "1;"; @@ -83,7 +83,7 @@ StringToolsTest::testSplitItemEmpty() } -void +void StringToolsTest::testSplitTwoItem() { std::string text = "2;1"; @@ -97,7 +97,7 @@ StringToolsTest::testSplitTwoItem() } -void +void StringToolsTest::testSplitEmptyTwoItem() { std::string text = ";1;2"; @@ -112,7 +112,7 @@ StringToolsTest::testSplitEmptyTwoItem() } -void +void StringToolsTest::testSplitEmptyItemEmpty() { std::string text = ";1;"; @@ -127,7 +127,7 @@ StringToolsTest::testSplitEmptyItemEmpty() } -void +void StringToolsTest::testSplitEmptyItemEmptyEmptyItem() { std::string text = ";1;;;2"; @@ -144,7 +144,7 @@ StringToolsTest::testSplitEmptyItemEmptyEmptyItem() } -void +void StringToolsTest::testWrapEmpty() { std::string text = ""; @@ -155,7 +155,7 @@ StringToolsTest::testWrapEmpty() } -void +void StringToolsTest::testWrapNotNeeded() { std::string text = "abcd"; @@ -166,7 +166,7 @@ StringToolsTest::testWrapNotNeeded() } -void +void StringToolsTest::testWrapLimitNotNeeded() { std::string text = "abcdef"; @@ -177,7 +177,7 @@ StringToolsTest::testWrapLimitNotNeeded() } -void +void StringToolsTest::testWrapOneNeeded() { std::string text = "abcdefghi"; @@ -188,7 +188,7 @@ StringToolsTest::testWrapOneNeeded() } -void +void StringToolsTest::testWrapTwoNeeded() { std::string text = "abcdefghijklmnop"; @@ -199,7 +199,7 @@ StringToolsTest::testWrapTwoNeeded() } -void +void StringToolsTest::testWrapLimitTwoNeeded() { std::string text = "abcdefghijklmnopqr"; @@ -210,7 +210,7 @@ StringToolsTest::testWrapLimitTwoNeeded() } -void +void StringToolsTest::testWrapOneNeededTwoNeeded() { std::string text = "123456789\nabcdefghijklmno"; @@ -221,7 +221,7 @@ StringToolsTest::testWrapOneNeededTwoNeeded() } -void +void StringToolsTest::testWrapNotNeededEmptyLinesOneNeeded() { std::string text = "12345\n\n\n\nabcdefghi"; diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/SubclassedTestCase.cpp b/dependencies-external/cppunit-1.12.1/examples/cppunittest/SubclassedTestCase.cpp index a648f8b563..79fdd8edd5 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/SubclassedTestCase.cpp +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/SubclassedTestCase.cpp @@ -12,26 +12,26 @@ SubclassedTestCase::~SubclassedTestCase() } -void +void SubclassedTestCase::setUp() { } -void +void SubclassedTestCase::tearDown() { } -void +void SubclassedTestCase::checkIt() { CPPUNIT_ASSERT( false ); } -void +void SubclassedTestCase::testSubclassing() { } diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/SynchronizedTestResult.h b/dependencies-external/cppunit-1.12.1/examples/cppunittest/SynchronizedTestResult.h index 284a6396b4..907d5f48c2 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/SynchronizedTestResult.h +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/SynchronizedTestResult.h @@ -24,16 +24,16 @@ class SynchronizedTestResult : public CPPUNIT_NS::TestResultCollector { } - virtual ~ObservedSynchronizationObject() + virtual ~ObservedSynchronizationObject() { } - virtual void lock() + virtual void lock() { m_listener->locked(); } - virtual void unlock() + virtual void unlock() { m_listener->unlocked(); } diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestAssertTest.cpp b/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestAssertTest.cpp index 3960b8edfc..1574971be5 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestAssertTest.cpp +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestAssertTest.cpp @@ -28,19 +28,19 @@ TestAssertTest::~TestAssertTest() } -void +void TestAssertTest::setUp() { } -void +void TestAssertTest::tearDown() { } -void +void TestAssertTest::testAssertThrow() { CPPUNIT_ASSERT_THROW( throw std::string(), std::string ); @@ -59,7 +59,7 @@ TestAssertTest::testAssertThrow() } -void +void TestAssertTest::testAssertNoThrow() { int x; @@ -77,7 +77,7 @@ TestAssertTest::testAssertNoThrow() } -void +void TestAssertTest::testAssertAssertionFail() { CPPUNIT_ASSERT_ASSERTION_FAIL( throw CPPUNIT_NS::Exception() ); @@ -96,7 +96,7 @@ TestAssertTest::testAssertAssertionFail() } -void +void TestAssertTest::testAssertAssertionPass() { int x; @@ -115,11 +115,11 @@ TestAssertTest::testAssertAssertionPass() } -void +void TestAssertTest::testAssert() { CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT( true ) ); - + CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT( false ) ); } @@ -127,7 +127,7 @@ TestAssertTest::testAssert() static int foo() { return 1; } -void +void TestAssertTest::testAssertEqual() { CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT_EQUAL( 1, 1 ) ); @@ -137,15 +137,15 @@ TestAssertTest::testAssertEqual() CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_EQUAL( 1, 2 ) ); } -void +void TestAssertTest::testAssertMessageTrue() { - CPPUNIT_ASSERT_ASSERTION_PASS( + CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT_MESSAGE( "This test should not failed", true ) ); } -void +void TestAssertTest::testAssertMessageFalse() { bool exceptionCaught = false; @@ -164,7 +164,7 @@ TestAssertTest::testAssertMessageFalse() } -void +void TestAssertTest::testAssertDoubleEquals() { CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.1, 1.2, 0.101 ) ); @@ -175,10 +175,10 @@ TestAssertTest::testAssertDoubleEquals() } /* - * Test that the error message from CPPUNIT_ASSERT_DOUBLES_EQUAL() + * Test that the error message from CPPUNIT_ASSERT_DOUBLES_EQUAL() * has more than the default 6 digits of precision. */ -void +void TestAssertTest::testAssertDoubleEqualsPrecision() { std::string failure( "2.000000001" ); @@ -195,7 +195,7 @@ TestAssertTest::testAssertDoubleEqualsPrecision() } -void +void TestAssertTest::testAssertDoubleNonFinite() { double inf = std::numeric_limits::infinity(); @@ -231,7 +231,7 @@ TestAssertTest::testAssertDoubleNonFinite() CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( inf, 0.0, 1.0 ) ); CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, inf, 1.0 ) ); CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT_DOUBLES_EQUAL( inf, inf, 1.0 ) ); - // NaN tests + // NaN tests CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( nan, 0.0, 1.0 ) ); CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( nan, nan, 1.0 ) ); CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( nan, inf, 1.0 ) ); @@ -239,7 +239,7 @@ TestAssertTest::testAssertDoubleNonFinite() } -void +void TestAssertTest::testFail() { bool exceptionCaught = false; @@ -257,13 +257,13 @@ TestAssertTest::testFail() } -void +void TestAssertTest::checkMessageContains( CPPUNIT_NS::Exception *e, std::string expected ) { std::string actual = e->what(); CPPUNIT_ASSERT_MESSAGE( "Expected message not found: " + expected + ", was: " + actual, - std::search( actual.begin(), actual.end(), + std::search( actual.begin(), actual.end(), expected.begin(), expected.end() ) != actual.end() ); } diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestAssertTest.h b/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestAssertTest.h index a672d38f86..1a2bbc131e 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestAssertTest.h +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestAssertTest.h @@ -37,7 +37,7 @@ class TestAssertTest : public CPPUNIT_NS::TestFixture void testBasicAssertions(); void testAssert(); - + void testAssertEqual(); void testAssertMessageTrue(); @@ -56,8 +56,8 @@ class TestAssertTest : public CPPUNIT_NS::TestFixture TestAssertTest( const TestAssertTest © ); void operator =( const TestAssertTest © ); - void checkDoubleNotEquals( double expected, - double actual, + void checkDoubleNotEquals( double expected, + double actual, double delta ); void checkMessageContains( CPPUNIT_NS::Exception *e, diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestCallerTest.cpp b/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestCallerTest.cpp index f5f4d7d38d..5a7979b1c6 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestCallerTest.cpp +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestCallerTest.cpp @@ -4,32 +4,32 @@ #include -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( TestCallerTest, +CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( TestCallerTest, helperSuiteName() ); -void +void TestCallerTest::ExceptionThrower::testThrowFailureException() { throw FailureException(); } -void +void TestCallerTest::ExceptionThrower::testThrowException() { throw CPPUNIT_NS::Exception( CPPUNIT_NS::Message( "expected Exception" ) ); } -void +void TestCallerTest::ExceptionThrower::testThrowNothing() { } -TestCallerTest::TestCallerTest() : +TestCallerTest::TestCallerTest() : m_testName( "TrackedTestCaseCaller" ) { } @@ -40,7 +40,7 @@ TestCallerTest::~TestCallerTest() } -void +void TestCallerTest::setUp() { m_constructorCount = 0; @@ -55,7 +55,7 @@ TestCallerTest::setUp() } -void +void TestCallerTest::tearDown() { TrackedTestCase::removeTracker(); @@ -64,46 +64,46 @@ TestCallerTest::tearDown() } -void +void TestCallerTest::onConstructor() { m_constructorCount++; } -void +void TestCallerTest::onDestructor() { m_destructorCount++; } -void +void TestCallerTest::onSetUp() { m_setUpCount++; } -void +void TestCallerTest::onTearDown() { m_tearDownCount++; } -void +void TestCallerTest::onTest() { m_testCount++; } -void +void TestCallerTest::testBasicConstructor() { { - CPPUNIT_NS::TestCaller caller( m_testName, + CPPUNIT_NS::TestCaller caller( m_testName, &TrackedTestCase::test ); checkTestName( caller.getName() ); checkNothingButConstructorCalled(); @@ -116,13 +116,13 @@ TestCallerTest::testBasicConstructor() } -void +void TestCallerTest::testReferenceConstructor() { TrackedTestCase testCase; { - CPPUNIT_NS::TestCaller caller( "TrackedTestCaseCaller", - &TrackedTestCase::test, + CPPUNIT_NS::TestCaller caller( "TrackedTestCaseCaller", + &TrackedTestCase::test, testCase ); checkTestName( caller.getName() ); checkNothingButConstructorCalled(); @@ -135,13 +135,13 @@ TestCallerTest::testReferenceConstructor() } -void +void TestCallerTest::testPointerConstructor() { TrackedTestCase *testCase = new TrackedTestCase(); { - CPPUNIT_NS::TestCaller caller( m_testName, - &TrackedTestCase::test, + CPPUNIT_NS::TestCaller caller( m_testName, + &TrackedTestCase::test, testCase ); checkTestName( caller.getName() ); checkNothingButConstructorCalled(); @@ -156,10 +156,10 @@ TestCallerTest::testPointerConstructor() /* // Now done by ExceptionTestCaseDecorator -void +void TestCallerTest::testExpectFailureException() { - CPPUNIT_NS::TestCaller caller( + CPPUNIT_NS::TestCaller caller( m_testName, &ExceptionThrower::testThrowFailureException ); m_testListener->setExpectNoFailure(); @@ -168,10 +168,10 @@ TestCallerTest::testExpectFailureException() } -void +void TestCallerTest::testExpectException() { - CPPUNIT_NS::TestCaller caller( + CPPUNIT_NS::TestCaller caller( m_testName, &ExceptionThrower::testThrowException ); m_testListener->setExpectNoFailure(); @@ -180,10 +180,10 @@ TestCallerTest::testExpectException() } -void +void TestCallerTest::testExpectedExceptionNotCaught() { - CPPUNIT_NS::TestCaller caller( + CPPUNIT_NS::TestCaller caller( m_testName, &ExceptionThrower::testThrowNothing ); m_testListener->setExpectedAddFailureCall( 1 ); @@ -192,7 +192,7 @@ TestCallerTest::testExpectedExceptionNotCaught() } */ -void +void TestCallerTest::checkNothingButConstructorCalled() { CPPUNIT_ASSERT_EQUAL( 1, m_constructorCount ); @@ -203,7 +203,7 @@ TestCallerTest::checkNothingButConstructorCalled() } -void +void TestCallerTest::checkRunningSequenceCalled() { CPPUNIT_ASSERT_EQUAL( 1, m_setUpCount ); @@ -212,7 +212,7 @@ TestCallerTest::checkRunningSequenceCalled() } -void +void TestCallerTest::checkTestName( std::string testName ) { CPPUNIT_ASSERT( testName == m_testName ); diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestCallerTest.h b/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestCallerTest.h index b8c5a14cec..5eb6b5dafc 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestCallerTest.h +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestCallerTest.h @@ -8,7 +8,7 @@ #include "MockTestListener.h" #include "TrackedTestCase.h" -class TestCallerTest : public CPPUNIT_NS::TestFixture, +class TestCallerTest : public CPPUNIT_NS::TestFixture, Tracker { CPPUNIT_TEST_SUITE( TestCallerTest ); diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestCaseTest.cpp b/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestCaseTest.cpp index 8ed31bbb6d..e82b006c64 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestCaseTest.cpp +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestCaseTest.cpp @@ -5,7 +5,7 @@ #include /* - - test have been done to check exception management in run(). other + - test have been done to check exception management in run(). other tests need to be added to check the other aspect of TestCase. */ @@ -23,7 +23,7 @@ TestCaseTest::~TestCaseTest() } -void +void TestCaseTest::setUp() { m_testListener = new MockTestListener( "mock-testlistener" ); @@ -32,7 +32,7 @@ TestCaseTest::setUp() } -void +void TestCaseTest::tearDown() { delete m_result; @@ -40,43 +40,43 @@ TestCaseTest::tearDown() } -void +void TestCaseTest::testSetUpFailure() { checkFailure( true, false, false ); } -void +void TestCaseTest::testRunTestFailure() { checkFailure( false, true, false ); } -void +void TestCaseTest::testTearDownFailure() { checkFailure( false, false, true ); } -void +void TestCaseTest::testFailAll() { checkFailure( true, true, true ); } -void +void TestCaseTest::testNoFailure() { checkFailure( false, false, false ); } -void -TestCaseTest::checkFailure( bool failSetUp, +void +TestCaseTest::checkFailure( bool failSetUp, bool failRunTest, bool failTearDown ) { @@ -92,7 +92,7 @@ TestCaseTest::checkFailure( bool failSetUp, testCase.setExpectedSetUpCall( 1 ); testCase.setExpectedRunTestCall( failSetUp ? 0 : 1 ); testCase.setExpectedTearDownCall( failSetUp ? 0 : 1 ); - + testCase.run( m_result ); testCase.verify(); @@ -104,7 +104,7 @@ TestCaseTest::checkFailure( bool failSetUp, } -void +void TestCaseTest::testCountTestCases() { CPPUNIT_NS::TestCase test; @@ -112,7 +112,7 @@ TestCaseTest::testCountTestCases() } -void +void TestCaseTest::testDefaultConstructor() { CPPUNIT_NS::TestCase test; @@ -120,7 +120,7 @@ TestCaseTest::testDefaultConstructor() } -void +void TestCaseTest::testConstructorWithName() { std::string testName( "TestName" ); @@ -129,7 +129,7 @@ TestCaseTest::testConstructorWithName() } -void +void TestCaseTest::testTwoRun() { MockTestCase test1( "mocktest1" ); @@ -145,7 +145,7 @@ TestCaseTest::testTwoRun() } -void +void TestCaseTest::testGetChildTestCount() { CPPUNIT_NS::TestCase test( "test" ); @@ -153,7 +153,7 @@ TestCaseTest::testGetChildTestCount() } -void +void TestCaseTest::testGetChildTestAtThrow() { CPPUNIT_NS::TestCase test( "test" ); diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestCaseTest.h b/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestCaseTest.h index 48c73aef56..072a2a2cf2 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestCaseTest.h +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestCaseTest.h @@ -55,7 +55,7 @@ class TestCaseTest : public CPPUNIT_NS::TestFixture TestCaseTest( const TestCaseTest © ); void operator =( const TestCaseTest © ); - void checkFailure( bool failSetUp, + void checkFailure( bool failSetUp, bool failRunTest, bool failTearDown ); /* diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestDecoratorTest.cpp b/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestDecoratorTest.cpp index f90874b8b6..195922e038 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestDecoratorTest.cpp +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestDecoratorTest.cpp @@ -17,7 +17,7 @@ TestDecoratorTest::~TestDecoratorTest() } -void +void TestDecoratorTest::setUp() { m_test = new MockTestCase( "mocktest" ); @@ -25,14 +25,14 @@ TestDecoratorTest::setUp() } -void +void TestDecoratorTest::tearDown() { delete m_decorator; } -void +void TestDecoratorTest::testCountTestCases() { m_test->setExpectedCountTestCasesCall( 1 ); @@ -41,7 +41,7 @@ TestDecoratorTest::testCountTestCases() } -void +void TestDecoratorTest::testRun() { m_test->setExpectedSetUpCall( 1 ); @@ -54,7 +54,7 @@ TestDecoratorTest::testRun() } -void +void TestDecoratorTest::testGetName() { CPPUNIT_ASSERT_EQUAL( m_test->getName(), m_decorator->getName() ); diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestFailureTest.cpp b/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestFailureTest.cpp index 413460d512..e4762820ec 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestFailureTest.cpp +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestFailureTest.cpp @@ -18,20 +18,20 @@ TestFailureTest::~TestFailureTest() } -void +void TestFailureTest::setUp() { m_exceptionDestroyed = false; } -void +void TestFailureTest::tearDown() { } -void +void TestFailureTest::testConstructorAndGetters() { CPPUNIT_NS::TestCase test; @@ -41,7 +41,7 @@ TestFailureTest::testConstructorAndGetters() } -void +void TestFailureTest::testConstructorAndGettersForError() { CPPUNIT_NS::TestCase test; @@ -51,15 +51,15 @@ TestFailureTest::testConstructorAndGettersForError() } -void +void TestFailureTest::exceptionDestroyed() { m_exceptionDestroyed = true; } -void -TestFailureTest::checkTestFailure( CPPUNIT_NS::Test *test, +void +TestFailureTest::checkTestFailure( CPPUNIT_NS::Test *test, CPPUNIT_NS::Exception *error, bool isError ) { diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestFailureTest.h b/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestFailureTest.h index 84f41e900e..cf43755a96 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestFailureTest.h +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestFailureTest.h @@ -27,7 +27,7 @@ class TestFailureTest : public CPPUNIT_NS::TestFixture class ObservedException : public CPPUNIT_NS::Exception { public: - ObservedException( TestFailureTest *listener ) : + ObservedException( TestFailureTest *listener ) : CPPUNIT_NS::Exception( CPPUNIT_NS::Message("ObservedException" ) ), m_listener( listener ) { @@ -44,7 +44,7 @@ class TestFailureTest : public CPPUNIT_NS::TestFixture TestFailureTest( const TestFailureTest © ); void operator =( const TestFailureTest © ); - void checkTestFailure( CPPUNIT_NS::Test *test, + void checkTestFailure( CPPUNIT_NS::Test *test, CPPUNIT_NS::Exception *error, bool isError ); diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestPathTest.cpp b/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestPathTest.cpp index 0f3d348994..172b8d8aac 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestPathTest.cpp +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestPathTest.cpp @@ -16,7 +16,7 @@ TestPathTest::~TestPathTest() } -void +void TestPathTest::setUp() { m_path = new CPPUNIT_NS::TestPath(); @@ -35,7 +35,7 @@ TestPathTest::setUp() } -void +void TestPathTest::tearDown() { delete m_suite1; @@ -47,7 +47,7 @@ TestPathTest::tearDown() } -void +void TestPathTest::testDefaultConstructor() { CPPUNIT_ASSERT_EQUAL( 0, m_path->getTestCount() ); @@ -55,7 +55,7 @@ TestPathTest::testDefaultConstructor() } -void +void TestPathTest::testAddTest() { m_path->add( m_test1 ); @@ -65,14 +65,14 @@ TestPathTest::testAddTest() } -void +void TestPathTest::testGetTestAtThrow1() { m_path->getTestAt( 0 ); } -void +void TestPathTest::testGetTestAtThrow2() { m_path->add( m_test1 ); @@ -80,7 +80,7 @@ TestPathTest::testGetTestAtThrow2() } -void +void TestPathTest::testGetChildTest() { m_path->add( m_test1 ); @@ -88,7 +88,7 @@ TestPathTest::testGetChildTest() } -void +void TestPathTest::testGetChildTestManyTests() { m_path->add( m_test1 ); @@ -98,14 +98,14 @@ TestPathTest::testGetChildTestManyTests() } -void +void TestPathTest::testGetChildTestThrowIfNotValid() { m_path->getChildTest(); } -void +void TestPathTest::testAddPath() { CPPUNIT_NS::TestPath path; @@ -122,7 +122,7 @@ TestPathTest::testAddPath() } -void +void TestPathTest::testAddInvalidPath() { CPPUNIT_NS::TestPath path; @@ -132,7 +132,7 @@ TestPathTest::testAddInvalidPath() } -void +void TestPathTest::testRemoveTests() { m_path->add( m_test1 ); @@ -144,7 +144,7 @@ TestPathTest::testRemoveTests() } -void +void TestPathTest::testRemoveTest() { m_path->add( m_test1 ); @@ -157,14 +157,14 @@ TestPathTest::testRemoveTest() } -void +void TestPathTest::testRemoveTestThrow1() { m_path->removeTest( -1 ); } -void +void TestPathTest::testRemoveTestThrow2() { m_path->add( m_test1 ); @@ -173,7 +173,7 @@ TestPathTest::testRemoveTestThrow2() } -void +void TestPathTest::testUp() { m_path->add( m_test1 ); @@ -184,14 +184,14 @@ TestPathTest::testUp() } -void +void TestPathTest::testUpThrow() { m_path->up(); } -void +void TestPathTest::testInsert() { m_path->add( m_test1 ); @@ -204,7 +204,7 @@ TestPathTest::testInsert() } -void +void TestPathTest::testInsertAtEnd() { m_path->add( m_test1 ); @@ -217,14 +217,14 @@ TestPathTest::testInsertAtEnd() } -void +void TestPathTest::testInsertThrow1() { m_path->insert( m_test1, -1 ); } -void +void TestPathTest::testInsertThrow2() { m_path->add( m_test1 ); @@ -233,7 +233,7 @@ TestPathTest::testInsertThrow2() } -void +void TestPathTest::testInsertPath() { CPPUNIT_NS::TestPath path; @@ -252,7 +252,7 @@ TestPathTest::testInsertPath() } -void +void TestPathTest::testInsertPathThrow() { CPPUNIT_NS::TestPath path; @@ -262,7 +262,7 @@ TestPathTest::testInsertPathThrow() } -void +void TestPathTest::testInsertPathDontThrowIfInvalid() { CPPUNIT_NS::TestPath path; @@ -270,7 +270,7 @@ TestPathTest::testInsertPathDontThrowIfInvalid() } -void +void TestPathTest::testRootConstructor() { CPPUNIT_NS::TestPath path( m_test1 ); @@ -280,13 +280,13 @@ TestPathTest::testRootConstructor() } -void +void TestPathTest::testPathSliceConstructorCopyUntilEnd() { m_path->add( m_test1 ); m_path->add( m_test2 ); m_path->add( m_test3 ); - + CPPUNIT_NS::TestPath path( *m_path, 1 ); CPPUNIT_ASSERT_EQUAL( 2, path.getTestCount() ); @@ -295,13 +295,13 @@ TestPathTest::testPathSliceConstructorCopyUntilEnd() } -void +void TestPathTest::testPathSliceConstructorCopySpecifiedCount() { m_path->add( m_test1 ); m_path->add( m_test2 ); m_path->add( m_test3 ); - + CPPUNIT_NS::TestPath path( *m_path, 0, 1 ); CPPUNIT_ASSERT_EQUAL( 1, path.getTestCount() ); @@ -309,17 +309,17 @@ TestPathTest::testPathSliceConstructorCopySpecifiedCount() } -void +void TestPathTest::testPathSliceConstructorCopyNone() { m_path->add( m_test1 ); - + CPPUNIT_NS::TestPath path( *m_path, 0, 0 ); CPPUNIT_ASSERT_EQUAL( 0, path.getTestCount() ); } -void +void TestPathTest::testPathSliceConstructorNegativeIndex() { m_path->add( m_test1 ); @@ -332,7 +332,7 @@ TestPathTest::testPathSliceConstructorNegativeIndex() } -void +void TestPathTest::testPathSliceConstructorAfterEndIndex() { m_path->add( m_test1 ); @@ -344,7 +344,7 @@ TestPathTest::testPathSliceConstructorAfterEndIndex() } -void +void TestPathTest::testPathSliceConstructorNegativeIndexUntilEnd() { m_path->add( m_test1 ); @@ -358,7 +358,7 @@ TestPathTest::testPathSliceConstructorNegativeIndexUntilEnd() } -void +void TestPathTest::testPathSliceConstructorNegativeIndexNone() { m_path->add( m_test1 ); @@ -370,7 +370,7 @@ TestPathTest::testPathSliceConstructorNegativeIndexNone() } -void +void TestPathTest::testToStringNoTest() { std::string expected = "/"; @@ -380,7 +380,7 @@ TestPathTest::testToStringNoTest() } -void +void TestPathTest::testToStringOneTest() { m_path->add( m_test1 ); @@ -392,7 +392,7 @@ TestPathTest::testToStringOneTest() } -void +void TestPathTest::testToStringHierarchy() { m_path->add( m_suite1 ); @@ -406,7 +406,7 @@ TestPathTest::testToStringHierarchy() } -void +void TestPathTest::testPathStringConstructorRoot() { CPPUNIT_NS::TestPath path( m_suite1, "/All Tests" ); @@ -416,7 +416,7 @@ TestPathTest::testPathStringConstructorRoot() } -void +void TestPathTest::testPathStringConstructorEmptyIsRoot() { CPPUNIT_NS::TestPath path( m_suite1, "" ); @@ -426,7 +426,7 @@ TestPathTest::testPathStringConstructorEmptyIsRoot() } -void +void TestPathTest::testPathStringConstructorHierarchy() { CPPUNIT_NS::TestPath path( m_suite1, "/All Tests/Custom/MyTest::testDefaultConstructor" ); @@ -438,14 +438,14 @@ TestPathTest::testPathStringConstructorHierarchy() } -void +void TestPathTest::testPathStringConstructorBadRootThrow() { CPPUNIT_NS::TestPath path( m_suite1, "/Custom" ); } -void +void TestPathTest::testPathStringConstructorRelativeRoot() { CPPUNIT_NS::TestPath path( m_suite1, "All Tests" ); @@ -455,7 +455,7 @@ TestPathTest::testPathStringConstructorRelativeRoot() } -void +void TestPathTest::testPathStringConstructorRelativeRoot2() { CPPUNIT_NS::TestPath path( m_suite1, "Custom" ); @@ -465,14 +465,14 @@ TestPathTest::testPathStringConstructorRelativeRoot2() } -void +void TestPathTest::testPathStringConstructorThrow1() { CPPUNIT_NS::TestPath path( m_suite1, "/" ); } -void +void TestPathTest::testPathStringConstructorRelativeHierarchy() { CPPUNIT_NS::TestPath path( m_suite1, "Custom/MyTest::testConstructor" ); @@ -483,7 +483,7 @@ TestPathTest::testPathStringConstructorRelativeHierarchy() } -void +void TestPathTest::testPathStringConstructorBadRelativeHierarchyThrow() { CPPUNIT_NS::TestPath path( m_suite1, "Custom/MyBadTest::testConstructor" ); diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestResultCollectorTest.cpp b/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestResultCollectorTest.cpp index 175250b958..f15b8d5e43 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestResultCollectorTest.cpp +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestResultCollectorTest.cpp @@ -17,19 +17,19 @@ TestResultCollectorTest::~TestResultCollectorTest() } -void +void TestResultCollectorTest::setUp() { m_lockCount = 0; m_unlockCount = 0; m_result = new CPPUNIT_NS::TestResultCollector(); - m_synchronizedResult = new SynchronizedTestResult( this ); + m_synchronizedResult = new SynchronizedTestResult( this ); m_test = new CPPUNIT_NS::TestCase(); m_test2 = new CPPUNIT_NS::TestCase(); } -void +void TestResultCollectorTest::tearDown() { delete m_test2; @@ -39,25 +39,25 @@ TestResultCollectorTest::tearDown() } -void +void TestResultCollectorTest::testConstructor() { checkResult( 0, 0, 0 ); } -void +void TestResultCollectorTest::testAddTwoErrors() { CPPUNIT_NS::Message errorMessage1( "First Error" ); CPPUNIT_NS::Message errorMessage2( "Second Error" ); { - CPPUNIT_NS::TestFailure failure1( m_test, + CPPUNIT_NS::TestFailure failure1( m_test, new CPPUNIT_NS::Exception( errorMessage1 ), true ); m_result->addFailure( failure1 ); - CPPUNIT_NS::TestFailure failure2( m_test2, + CPPUNIT_NS::TestFailure failure2( m_test2, new CPPUNIT_NS::Exception( errorMessage2 ), true ); m_result->addFailure( failure2 ); @@ -75,18 +75,18 @@ TestResultCollectorTest::testAddTwoErrors() } -void +void TestResultCollectorTest::testAddTwoFailures() { CPPUNIT_NS::Message errorMessage1( "First Failure" ); CPPUNIT_NS::Message errorMessage2( "Second Failure" ); { - CPPUNIT_NS::TestFailure failure1( m_test, + CPPUNIT_NS::TestFailure failure1( m_test, new CPPUNIT_NS::Exception( errorMessage1 ), false ); m_result->addFailure( failure1 ); - CPPUNIT_NS::TestFailure failure2( m_test2, + CPPUNIT_NS::TestFailure failure2( m_test2, new CPPUNIT_NS::Exception( errorMessage2 ), false ); m_result->addFailure( failure2 ); @@ -103,7 +103,7 @@ TestResultCollectorTest::testAddTwoFailures() } -void +void TestResultCollectorTest::testStartTest() { m_result->startTest( m_test ); @@ -112,14 +112,14 @@ TestResultCollectorTest::testStartTest() } -void +void TestResultCollectorTest::testWasSuccessfulWithNoTest() { checkWasSuccessful( true ); } -void +void TestResultCollectorTest::testWasSuccessfulWithErrors() { addError( "Error1" ); @@ -128,7 +128,7 @@ TestResultCollectorTest::testWasSuccessfulWithErrors() } -void +void TestResultCollectorTest::testWasSuccessfulWithFailures() { addFailure( "Failure1" ); @@ -137,7 +137,7 @@ TestResultCollectorTest::testWasSuccessfulWithFailures() } -void +void TestResultCollectorTest::testWasSuccessfulWithErrorsAndFailures() { addError( "Error1" ); @@ -146,7 +146,7 @@ TestResultCollectorTest::testWasSuccessfulWithErrorsAndFailures() } -void +void TestResultCollectorTest::testWasSuccessfulWithSuccessfulTest() { m_result->startTest( m_test ); @@ -157,7 +157,7 @@ TestResultCollectorTest::testWasSuccessfulWithSuccessfulTest() } -void +void TestResultCollectorTest::testSynchronizationAddFailure() { addFailure( "Failure1", m_test, false, m_synchronizedResult ); @@ -165,7 +165,7 @@ TestResultCollectorTest::testSynchronizationAddFailure() } -void +void TestResultCollectorTest::testSynchronizationStartTest() { m_synchronizedResult->startTest( m_test ); @@ -173,7 +173,7 @@ TestResultCollectorTest::testSynchronizationStartTest() } -void +void TestResultCollectorTest::testSynchronizationRunTests() { m_synchronizedResult->runTests(); @@ -181,7 +181,7 @@ TestResultCollectorTest::testSynchronizationRunTests() } -void +void TestResultCollectorTest::testSynchronizationTestErrors() { m_synchronizedResult->testErrors(); @@ -189,7 +189,7 @@ TestResultCollectorTest::testSynchronizationTestErrors() } -void +void TestResultCollectorTest::testSynchronizationTestFailures() { m_synchronizedResult->testFailures(); @@ -197,7 +197,7 @@ TestResultCollectorTest::testSynchronizationTestFailures() } -void +void TestResultCollectorTest::testSynchronizationFailures() { m_synchronizedResult->failures(); @@ -205,7 +205,7 @@ TestResultCollectorTest::testSynchronizationFailures() } -void +void TestResultCollectorTest::testSynchronizationWasSuccessful() { m_synchronizedResult->wasSuccessful(); @@ -213,7 +213,7 @@ TestResultCollectorTest::testSynchronizationWasSuccessful() } -void +void TestResultCollectorTest::checkResult( int failures, int errors, int testsRun ) @@ -221,7 +221,7 @@ TestResultCollectorTest::checkResult( int failures, CPPUNIT_ASSERT_EQUAL( testsRun, m_result->runTests() ); CPPUNIT_ASSERT_EQUAL( errors, m_result->testErrors() ); CPPUNIT_ASSERT_EQUAL( failures, m_result->testFailures() ); - CPPUNIT_ASSERT_EQUAL( errors + failures, + CPPUNIT_ASSERT_EQUAL( errors + failures, m_result->testFailuresTotal() ); } @@ -239,14 +239,14 @@ TestResultCollectorTest::checkFailure( CPPUNIT_NS::TestFailure *failure, } -void +void TestResultCollectorTest::checkWasSuccessful( bool shouldBeSuccessful ) { CPPUNIT_ASSERT_EQUAL( shouldBeSuccessful, m_result->wasSuccessful() ); } -void +void TestResultCollectorTest::locked() { CPPUNIT_ASSERT_EQUAL( m_lockCount, m_unlockCount ); @@ -254,7 +254,7 @@ TestResultCollectorTest::locked() } -void +void TestResultCollectorTest::unlocked() { ++m_unlockCount; @@ -262,7 +262,7 @@ TestResultCollectorTest::unlocked() } -void +void TestResultCollectorTest::checkSynchronization() { CPPUNIT_ASSERT_EQUAL( m_lockCount, m_unlockCount ); @@ -270,28 +270,28 @@ TestResultCollectorTest::checkSynchronization() } -void +void TestResultCollectorTest::addFailure( std::string message ) { addFailure( message, m_test, false, m_result ); } -void +void TestResultCollectorTest::addError( std::string message ) { addFailure( message, m_test, true, m_result ); } -void -TestResultCollectorTest::addFailure( std::string message, - CPPUNIT_NS::Test *failedTest, +void +TestResultCollectorTest::addFailure( std::string message, + CPPUNIT_NS::Test *failedTest, bool isError, CPPUNIT_NS::TestResultCollector *result ) { - CPPUNIT_NS::TestFailure failure( failedTest, - new CPPUNIT_NS::Exception( CPPUNIT_NS::Message( message ) ), + CPPUNIT_NS::TestFailure failure( failedTest, + new CPPUNIT_NS::Exception( CPPUNIT_NS::Message( message ) ), isError ); result->addFailure( failure ); } diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestResultCollectorTest.h b/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestResultCollectorTest.h index bf7e5ae985..729569c47b 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestResultCollectorTest.h +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestResultCollectorTest.h @@ -77,14 +77,14 @@ class TestResultCollectorTest : public CPPUNIT_NS::TestFixture, void addFailure( std::string message ); void addError( std::string message ); - void addFailure( std::string message, - CPPUNIT_NS::Test *failedTest, + void addFailure( std::string message, + CPPUNIT_NS::Test *failedTest, bool isError, CPPUNIT_NS::TestResultCollector *result ); private: CPPUNIT_NS::TestResultCollector *m_result; - SynchronizedTestResult *m_synchronizedResult; + SynchronizedTestResult *m_synchronizedResult; CPPUNIT_NS::Test *m_test; CPPUNIT_NS::Test *m_test2; int m_lockCount; diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestResultTest.cpp b/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestResultTest.cpp index 048aacd064..5411cc18b1 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestResultTest.cpp +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestResultTest.cpp @@ -19,7 +19,7 @@ TestResultTest::~TestResultTest() } -void +void TestResultTest::setUp() { m_result = new CPPUNIT_NS::TestResult(); @@ -29,7 +29,7 @@ TestResultTest::setUp() } -void +void TestResultTest::tearDown() { delete m_dummyTest; @@ -39,14 +39,14 @@ TestResultTest::tearDown() } -void +void TestResultTest::testConstructor() { CPPUNIT_ASSERT( !m_result->shouldStop() ); } -void +void TestResultTest::testStop() { m_result->stop(); @@ -54,10 +54,10 @@ TestResultTest::testStop() } -void +void TestResultTest::testAddError() { - CPPUNIT_NS::Exception *dummyException = new CPPUNIT_NS::Exception( + CPPUNIT_NS::Exception *dummyException = new CPPUNIT_NS::Exception( CPPUNIT_NS::Message( "some_error" ) ); m_listener1->setExpectFailure( m_dummyTest, dummyException, true ); m_result->addListener( m_listener1 ); @@ -68,10 +68,10 @@ TestResultTest::testAddError() } -void +void TestResultTest::testAddFailure() { - CPPUNIT_NS::Exception *dummyException = new CPPUNIT_NS::Exception( + CPPUNIT_NS::Exception *dummyException = new CPPUNIT_NS::Exception( CPPUNIT_NS::Message("some_error" ) ); m_listener1->setExpectFailure( m_dummyTest, dummyException, false ); m_result->addListener( m_listener1 ); @@ -82,73 +82,73 @@ TestResultTest::testAddFailure() } -void +void TestResultTest::testStartTest() { m_listener1->setExpectStartTest( m_dummyTest ); m_result->addListener( m_listener1 ); - + m_result->startTest( m_dummyTest ); m_listener1->verify(); } -void +void TestResultTest::testEndTest() { m_listener1->setExpectEndTest( m_dummyTest ); m_result->addListener( m_listener1 ); - + m_result->endTest( m_dummyTest ); m_listener1->verify(); } -void +void TestResultTest::testStartSuite() { m_listener1->setExpectStartSuite( m_dummyTest ); m_result->addListener( m_listener1 ); - + m_result->startSuite( m_dummyTest ); m_listener1->verify(); } -void +void TestResultTest::testEndSuite() { m_listener1->setExpectEndSuite( m_dummyTest ); m_result->addListener( m_listener1 ); - + m_result->endSuite( m_dummyTest ); m_listener1->verify(); } -void +void TestResultTest::testRunTest() { m_listener1->setExpectStartTestRun( m_dummyTest, m_result ); m_listener1->setExpectEndTestRun( m_dummyTest, m_result ); m_result->addListener( m_listener1 ); - + m_result->runTest( m_dummyTest ); m_listener1->verify(); } -void +void TestResultTest::testTwoListener() { m_listener1->setExpectStartTest( m_dummyTest ); m_listener2->setExpectStartTest( m_dummyTest ); - CPPUNIT_NS::Exception *dummyException1 = new CPPUNIT_NS::Exception( + CPPUNIT_NS::Exception *dummyException1 = new CPPUNIT_NS::Exception( CPPUNIT_NS::Message( "some_error" ) ); m_listener1->setExpectFailure( m_dummyTest, dummyException1, true ); m_listener2->setExpectFailure( m_dummyTest, dummyException1, true ); @@ -166,7 +166,7 @@ TestResultTest::testTwoListener() } -void +void TestResultTest::testDefaultProtectSucceed() { MockFunctor functor; @@ -180,7 +180,7 @@ TestResultTest::testDefaultProtectSucceed() } -void +void TestResultTest::testDefaultProtectFail() { MockFunctor functor; @@ -194,7 +194,7 @@ TestResultTest::testDefaultProtectFail() } -void +void TestResultTest::testDefaultProtectFailIfThrow() { MockFunctor functor; @@ -208,7 +208,7 @@ TestResultTest::testDefaultProtectFailIfThrow() } -void +void TestResultTest::testProtectChainPushOneTrap() { MockFunctor functor; @@ -226,7 +226,7 @@ TestResultTest::testProtectChainPushOneTrap() } -void +void TestResultTest::testProtectChainPushOnePassThrough() { MockFunctor functor; @@ -244,7 +244,7 @@ TestResultTest::testProtectChainPushOnePassThrough() } -void +void TestResultTest::testProtectChainPushTwoTrap() { MockFunctor functor; diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestSetUpTest.cpp b/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestSetUpTest.cpp index 20c4f24eed..20acd75ef7 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestSetUpTest.cpp +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestSetUpTest.cpp @@ -18,19 +18,19 @@ TestSetUpTest::~TestSetUpTest() } -void +void TestSetUpTest::setUp() { } -void +void TestSetUpTest::tearDown() { } -void +void TestSetUpTest::testRun() { CPPUNIT_NS::TestResult result; @@ -39,7 +39,7 @@ TestSetUpTest::testRun() test->setExpectedRunTestCall(); test->setExpectedTearDownCall(); MockSetUp setUpTest( test ); - + setUpTest.run( &result ); setUpTest.verify(); diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestSetUpTest.h b/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestSetUpTest.h index 117473bd59..dd303863e6 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestSetUpTest.h +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestSetUpTest.h @@ -31,7 +31,7 @@ class TestSetUpTest : public CPPUNIT_NS::TestFixture { } - void setUp() + void setUp() { m_setUpCalled = true; } diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestSuiteTest.cpp b/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestSuiteTest.cpp index ec4f4adc8f..a9cf6b6c17 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestSuiteTest.cpp +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestSuiteTest.cpp @@ -18,21 +18,21 @@ TestSuiteTest::~TestSuiteTest() } -void +void TestSuiteTest::setUp() { m_suite = new CPPUNIT_NS::TestSuite(); } -void +void TestSuiteTest::tearDown() { delete m_suite; } -void +void TestSuiteTest::testConstructor() { std::string name( "MySuite" ); @@ -41,14 +41,14 @@ TestSuiteTest::testConstructor() } -void +void TestSuiteTest::testCountTestCasesWithNoTest() { CPPUNIT_ASSERT_EQUAL( 0, m_suite->countTestCases() ); } -void +void TestSuiteTest::testCountTestCasesWithTwoTests() { MockTestCase *case1 = new MockTestCase( "test1" ); @@ -64,7 +64,7 @@ TestSuiteTest::testCountTestCasesWithTwoTests() } -void +void TestSuiteTest::testCountTestCasesWithSubSuite() { MockTestCase *case1 = new MockTestCase( "test1" ); @@ -86,7 +86,7 @@ TestSuiteTest::testCountTestCasesWithSubSuite() } -void +void TestSuiteTest::testRunWithOneTest() { MockTestCase *case1 = new MockTestCase( "test1" ); @@ -100,7 +100,7 @@ TestSuiteTest::testRunWithOneTest() } -void +void TestSuiteTest::testRunWithOneTestAndSubSuite() { MockTestCase *case1 = new MockTestCase( "test1" ); @@ -124,7 +124,7 @@ TestSuiteTest::testRunWithOneTestAndSubSuite() } -void +void TestSuiteTest::testGetTests() { m_suite->addTest( new CPPUNIT_NS::TestCase( "test1" ) ); @@ -133,7 +133,7 @@ TestSuiteTest::testGetTests() } -void +void TestSuiteTest::testDeleteContents() { m_suite->addTest( new CPPUNIT_NS::TestCase( "test2" ) ); @@ -142,7 +142,7 @@ TestSuiteTest::testDeleteContents() } -void +void TestSuiteTest::testGetChildTestCount() { m_suite->addTest( new CPPUNIT_NS::TestCase( "test1" ) ); @@ -152,7 +152,7 @@ TestSuiteTest::testGetChildTestCount() } -void +void TestSuiteTest::testGetChildTestAt() { CPPUNIT_NS::TestCase *test1 = new CPPUNIT_NS::TestCase( "test1" ); @@ -165,14 +165,14 @@ TestSuiteTest::testGetChildTestAt() } -void +void TestSuiteTest::testGetChildTestAtThrow1() { m_suite->getChildTestAt(-1); } -void +void TestSuiteTest::testGetChildTestAtThrow2() { m_suite->getChildTestAt(0); diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestTest.cpp b/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestTest.cpp index 4edc31c58c..2d4216d7c8 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestTest.cpp +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/TestTest.cpp @@ -6,7 +6,7 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( TestTest, coreSuiteName() ); -TestTest::TestTest() : +TestTest::TestTest() : CPPUNIT_NS::TestFixture() { } @@ -17,7 +17,7 @@ TestTest::~TestTest() } -void +void TestTest::setUp() { m_suite = new CPPUNIT_NS::TestSuite( "suite" ); @@ -25,12 +25,12 @@ TestTest::setUp() m_test2 = new MockTestCase( "test2" ); m_suite->addTest( m_test1 ); m_suite->addTest( m_test2 ); - + m_path = new CPPUNIT_NS::TestPath(); } -void +void TestTest::tearDown() { delete m_suite; @@ -38,7 +38,7 @@ TestTest::tearDown() } -void +void TestTest::testFindTestPathPointerThis() { CPPUNIT_ASSERT( m_test1->findTestPath( m_test1, *m_path ) ); @@ -53,7 +53,7 @@ TestTest::testFindTestPathPointerThis() } -void +void TestTest::testFindTestPathPointer() { CPPUNIT_ASSERT( m_suite->findTestPath( m_test1, *m_path ) ); @@ -63,7 +63,7 @@ TestTest::testFindTestPathPointer() } -void +void TestTest::testFindTestPathPointerFail() { MockTestCase test( "test" ); @@ -72,7 +72,7 @@ TestTest::testFindTestPathPointerFail() } -void +void TestTest::testFindTestPathNameThis() { CPPUNIT_ASSERT( m_test1->findTestPath( "test1", *m_path ) ); @@ -87,7 +87,7 @@ TestTest::testFindTestPathNameThis() } -void +void TestTest::testFindTestPathName() { CPPUNIT_ASSERT( m_suite->findTestPath( "test2", *m_path ) ); @@ -97,7 +97,7 @@ TestTest::testFindTestPathName() } -void +void TestTest::testFindTestPathNameFail() { CPPUNIT_ASSERT( !m_suite->findTestPath( "bad-test", *m_path ) ); @@ -105,21 +105,21 @@ TestTest::testFindTestPathNameFail() } -void +void TestTest::testFindTest() { CPPUNIT_ASSERT( m_test1 == m_suite->findTest( "test1" ) ); } -void +void TestTest::testFindTestThrow() { m_suite->findTest( "no-name" ); } -void +void TestTest::testResolveTestPath() { CPPUNIT_NS::TestPath path1 = m_suite->resolveTestPath( "suite"); diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/TrackedTestCase.cpp b/dependencies-external/cppunit-1.12.1/examples/cppunittest/TrackedTestCase.cpp index aaea99adfa..56ebe7d902 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/TrackedTestCase.cpp +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/TrackedTestCase.cpp @@ -17,7 +17,7 @@ TrackedTestCase::~TrackedTestCase() } -void +void TrackedTestCase::setUp() { if ( ms_tracker != NULL ) @@ -25,7 +25,7 @@ TrackedTestCase::setUp() } -void +void TrackedTestCase::tearDown() { if ( ms_tracker != NULL ) @@ -33,7 +33,7 @@ TrackedTestCase::tearDown() } -void +void TrackedTestCase::test() { if ( ms_tracker != NULL ) @@ -41,14 +41,14 @@ TrackedTestCase::test() } -void +void TrackedTestCase::setTracker( Tracker *tracker ) { ms_tracker = tracker; } -void +void TrackedTestCase::removeTracker() { ms_tracker = NULL; diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/XmlElementTest.cpp b/dependencies-external/cppunit-1.12.1/examples/cppunittest/XmlElementTest.cpp index 56c6ef8d55..2ff359df0b 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/XmlElementTest.cpp +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/XmlElementTest.cpp @@ -5,7 +5,7 @@ #include "XmlUniformiser.h" -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( XmlElementTest, +CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( XmlElementTest, toolsSuiteName() ); @@ -19,19 +19,19 @@ XmlElementTest::~XmlElementTest() } -void +void XmlElementTest::setUp() { } -void +void XmlElementTest::tearDown() { } -void +void XmlElementTest::testStringContentConstructor() { CPPUNIT_NS::XmlElement element( "aName", "someContent" ); @@ -40,7 +40,7 @@ XmlElementTest::testStringContentConstructor() } -void +void XmlElementTest::testNumericContentConstructor() { CPPUNIT_NS::XmlElement element( "numericName", 123456789 ); @@ -49,7 +49,7 @@ XmlElementTest::testNumericContentConstructor() } -void +void XmlElementTest::testSetName() { CPPUNIT_NS::XmlElement element( "aName" ); @@ -58,7 +58,7 @@ XmlElementTest::testSetName() } -void +void XmlElementTest::testSetStringContent() { CPPUNIT_NS::XmlElement element( "aName", "someContent" ); @@ -67,7 +67,7 @@ XmlElementTest::testSetStringContent() } -void +void XmlElementTest::testSetNumericContent() { CPPUNIT_NS::XmlElement element( "aName", "someContent" ); @@ -76,7 +76,7 @@ XmlElementTest::testSetNumericContent() } -void +void XmlElementTest::testElementCount() { CPPUNIT_NS::XmlElement node( "element", "content" ); @@ -88,7 +88,7 @@ XmlElementTest::testElementCount() } -void +void XmlElementTest::testElementAtNegativeIndexThrow() { CPPUNIT_NS::XmlElement node( "element" ); @@ -96,7 +96,7 @@ XmlElementTest::testElementAtNegativeIndexThrow() } -void +void XmlElementTest::testElementAtTooLargeIndexThrow() { CPPUNIT_NS::XmlElement node( "element" ); @@ -104,7 +104,7 @@ XmlElementTest::testElementAtTooLargeIndexThrow() } -void +void XmlElementTest::testElementAt() { CPPUNIT_NS::XmlElement node( "element" ); @@ -118,7 +118,7 @@ XmlElementTest::testElementAt() } -void +void XmlElementTest::testElementForThrow() { CPPUNIT_NS::XmlElement node( "element" ); @@ -127,7 +127,7 @@ XmlElementTest::testElementForThrow() } -void +void XmlElementTest::testElementFor() { CPPUNIT_NS::XmlElement node( "element" ); @@ -141,7 +141,7 @@ XmlElementTest::testElementFor() } -void +void XmlElementTest::testEmptyNodeToString() { CPPUNIT_NS::XmlElement node( "element" ); @@ -150,7 +150,7 @@ XmlElementTest::testEmptyNodeToString() } -void +void XmlElementTest::testElementWithAttributesToString() { CPPUNIT_NS::XmlElement node( "element" ); @@ -163,7 +163,7 @@ XmlElementTest::testElementWithAttributesToString() } -void +void XmlElementTest::testEscapedAttributeValueToString() { CPPUNIT_NS::XmlElement node( "element" ); @@ -175,7 +175,7 @@ XmlElementTest::testEscapedAttributeValueToString() } -void +void XmlElementTest::testElementToStringEscapeContent() { CPPUNIT_NS::XmlElement node( "element", "ChessTest" ); @@ -186,7 +186,7 @@ XmlElementTest::testElementToStringEscapeContent() } -void +void XmlElementTest::testElementWithChildrenToString() { CPPUNIT_NS::XmlElement node( "element" ); @@ -198,7 +198,7 @@ XmlElementTest::testElementWithChildrenToString() } -void +void XmlElementTest::testElementWithContentToString() { CPPUNIT_NS::XmlElement node( "element", "content\nline2" ); @@ -207,7 +207,7 @@ XmlElementTest::testElementWithContentToString() } -void +void XmlElementTest::testElementWithNumericContentToString() { CPPUNIT_NS::XmlElement node( "element", 123456789 ); @@ -216,7 +216,7 @@ XmlElementTest::testElementWithNumericContentToString() } -void +void XmlElementTest::testElementWithContentAndChildToString() { CPPUNIT_NS::XmlElement node( "element", "content" ); diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/XmlOutputterTest.cpp b/dependencies-external/cppunit-1.12.1/examples/cppunittest/XmlOutputterTest.cpp index dad689c51b..e70900dff7 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/XmlOutputterTest.cpp +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/XmlOutputterTest.cpp @@ -8,7 +8,7 @@ #include "XmlUniformiser.h" -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( XmlOutputterTest, +CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( XmlOutputterTest, outputSuiteName() ); @@ -22,7 +22,7 @@ XmlOutputterTest::~XmlOutputterTest() } -void +void XmlOutputterTest::setUp() { m_dummyTests.clear(); @@ -30,7 +30,7 @@ XmlOutputterTest::setUp() } -void +void XmlOutputterTest::tearDown() { delete m_result; @@ -40,7 +40,7 @@ XmlOutputterTest::tearDown() } -void +void XmlOutputterTest::testWriteXmlResultWithNoTest() { CPPUNIT_NS::OStringStream stream; @@ -48,7 +48,7 @@ XmlOutputterTest::testWriteXmlResultWithNoTest() outputter.write(); std::string actualXml = stream.str(); - std::string expectedXml = + std::string expectedXml = "" "" "" @@ -63,7 +63,7 @@ XmlOutputterTest::testWriteXmlResultWithNoTest() } -void +void XmlOutputterTest::testWriteXmlResultWithOneFailure() { addTestFailure( "test1", "message failure1", CPPUNIT_NS::SourceLine( "test.cpp", 3 ) ); @@ -73,7 +73,7 @@ XmlOutputterTest::testWriteXmlResultWithOneFailure() outputter.write(); std::string actualXml = stream.str(); - std::string expectedXml = + std::string expectedXml = "" "" "" @@ -98,7 +98,7 @@ XmlOutputterTest::testWriteXmlResultWithOneFailure() } -void +void XmlOutputterTest::testWriteXmlResultWithOneError() { addTestError( "test1", "message error1" ); @@ -108,7 +108,7 @@ XmlOutputterTest::testWriteXmlResultWithOneError() outputter.write(); std::string actualXml = stream.str(); - std::string expectedXml = + std::string expectedXml = "" "" "" @@ -129,7 +129,7 @@ XmlOutputterTest::testWriteXmlResultWithOneError() } -void +void XmlOutputterTest::testWriteXmlResultWithOneSuccess() { addTest( "test1" ); @@ -139,7 +139,7 @@ XmlOutputterTest::testWriteXmlResultWithOneSuccess() outputter.write(); std::string actualXml = stream.str(); - std::string expectedXml = + std::string expectedXml = "" "" "" @@ -158,7 +158,7 @@ XmlOutputterTest::testWriteXmlResultWithOneSuccess() } -void +void XmlOutputterTest::testWriteXmlResultWithThreeFailureTwoErrorsAndTwoSuccess() { addTestFailure( "test1", "failure1" ); @@ -174,7 +174,7 @@ XmlOutputterTest::testWriteXmlResultWithThreeFailureTwoErrorsAndTwoSuccess() outputter.write(); std::string actualXml = stream.str(); - std::string expectedXml = + std::string expectedXml = "" "" "" @@ -278,7 +278,7 @@ class XmlOutputterTest::MockHook : public CPPUNIT_NS::XmlOutputterHook }; -void +void XmlOutputterTest::testHook() { int begin =0, end =0, statistics =0, successful =0, failed =0; @@ -303,7 +303,7 @@ XmlOutputterTest::testHook() } -void +void XmlOutputterTest::addTest( std::string testName ) { CPPUNIT_NS::Test *test = makeDummyTest( testName ); @@ -312,7 +312,7 @@ XmlOutputterTest::addTest( std::string testName ) } -void +void XmlOutputterTest::addTestFailure( std::string testName, std::string message, CPPUNIT_NS::SourceLine sourceLine ) @@ -321,7 +321,7 @@ XmlOutputterTest::addTestFailure( std::string testName, } -void +void XmlOutputterTest::addTestError( std::string testName, std::string message, CPPUNIT_NS::SourceLine sourceLine ) @@ -330,7 +330,7 @@ XmlOutputterTest::addTestError( std::string testName, } -void +void XmlOutputterTest::addGenericTestFailure( std::string testName, CPPUNIT_NS::Message message, CPPUNIT_NS::SourceLine sourceLine, @@ -338,7 +338,7 @@ XmlOutputterTest::addGenericTestFailure( std::string testName, { CPPUNIT_NS::Test *test = makeDummyTest( testName ); m_result->startTest( test ); - CPPUNIT_NS::TestFailure failure( test, + CPPUNIT_NS::TestFailure failure( test, new CPPUNIT_NS::Exception( message, sourceLine ), isError ); m_result->addFailure( failure ); diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/XmlOutputterTest.h b/dependencies-external/cppunit-1.12.1/examples/cppunittest/XmlOutputterTest.h index 697a452cca..d6b080974b 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/XmlOutputterTest.h +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/XmlOutputterTest.h @@ -49,9 +49,9 @@ class XmlOutputterTest : public CPPUNIT_NS::TestFixture /// Prevents the use of the copy operator. void operator =( const XmlOutputterTest © ); - std::string statistics( int tests, - int total, - int error, + std::string statistics( int tests, + int total, + int error, int failure ); void addTest( std::string testName ); diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/XmlUniformiser.cpp b/dependencies-external/cppunit-1.12.1/examples/cppunittest/XmlUniformiser.cpp index 48c02073b0..d052e4003f 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/XmlUniformiser.cpp +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/XmlUniformiser.cpp @@ -1,12 +1,12 @@ #include "XmlUniformiser.h" -int +int notEqualIndex( std::string expectedXml, std::string actualXml ) { unsigned int index = 0; - while ( index < actualXml.length() && + while ( index < actualXml.length() && index < expectedXml.length() && actualXml[index] == expectedXml[index] ) ++index; @@ -16,7 +16,7 @@ notEqualIndex( std::string expectedXml, /// Asserts that two XML string are equivalent. -void +void checkXmlEqual( std::string expectedXml, std::string actualXml, CPPUNIT_NS::SourceLine sourceLine ) @@ -47,7 +47,7 @@ XmlUniformiser::XmlUniformiser( const std::string &xml ) : } -std::string +std::string XmlUniformiser::stripped() { while ( isValidIndex() ) @@ -66,7 +66,7 @@ XmlUniformiser::stripped() } -void +void XmlUniformiser::skipSpaces() { while ( isSpace() ) @@ -74,28 +74,28 @@ XmlUniformiser::skipSpaces() } -bool +bool XmlUniformiser::isSpace( char c ) { return c < 33; } -bool +bool XmlUniformiser::isSpace() { return isValidIndex() && isSpace( m_xml[m_index] ); } -bool +bool XmlUniformiser::isValidIndex() { return m_index < m_xml.length(); } -void +void XmlUniformiser::skipNext( int count ) { while ( count-- > 0 ) @@ -103,7 +103,7 @@ XmlUniformiser::skipNext( int count ) } -void +void XmlUniformiser::copyNext( int count ) { while ( count-- > 0 && isValidIndex() ) @@ -111,7 +111,7 @@ XmlUniformiser::copyNext( int count ) } -bool +bool XmlUniformiser::startsWith( std::string expected ) { std::string actual = m_xml.substr( m_index, expected.length() ); @@ -119,7 +119,7 @@ XmlUniformiser::startsWith( std::string expected ) } -void +void XmlUniformiser::skipProcessed() { while ( isValidIndex() && !startsWith( "?>" ) ) @@ -129,7 +129,7 @@ XmlUniformiser::skipProcessed() } -void +void XmlUniformiser::skipComment() { while ( isValidIndex() && !startsWith( "-->" ) ) @@ -139,7 +139,7 @@ XmlUniformiser::skipComment() } -void +void XmlUniformiser::copyElement() { copyElementName(); @@ -147,7 +147,7 @@ XmlUniformiser::copyElement() } -void +void XmlUniformiser::copyElementName() { while ( isValidIndex() && @@ -156,7 +156,7 @@ XmlUniformiser::copyElementName() } -void +void XmlUniformiser::copyElementAttributes() { do @@ -184,7 +184,7 @@ XmlUniformiser::copyElementAttributes() } -void +void XmlUniformiser::copyAttributeName() { while ( isValidIndex() && !isEndOfAttributeName() ) @@ -192,14 +192,14 @@ XmlUniformiser::copyAttributeName() } -bool +bool XmlUniformiser::isEndOfAttributeName() { return isSpace() || startsWith( ">" ) || startsWith( "=" ); } -void +void XmlUniformiser::copyAttributeValue() { skipSpaces(); @@ -208,7 +208,7 @@ XmlUniformiser::copyAttributeValue() } -void +void XmlUniformiser::copyUntilDoubleQuote() { while ( isValidIndex() && !startsWith("\"") ) @@ -217,7 +217,7 @@ XmlUniformiser::copyUntilDoubleQuote() } -void +void XmlUniformiser::copyElementContent() { while ( isValidIndex() && !startsWith( "<" ) ) @@ -226,7 +226,7 @@ XmlUniformiser::copyElementContent() } -void +void XmlUniformiser::removeTrailingSpaces() { int index = m_stripped.length(); diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/XmlUniformiser.h b/dependencies-external/cppunit-1.12.1/examples/cppunittest/XmlUniformiser.h index 545ece3c1b..dd7364ad0a 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/XmlUniformiser.h +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/XmlUniformiser.h @@ -47,7 +47,7 @@ class XmlUniformiser -void +void checkXmlEqual( std::string expectedXml, std::string actualXml, CPPUNIT_NS::SourceLine sourceLine ); diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/XmlUniformiserTest.cpp b/dependencies-external/cppunit-1.12.1/examples/cppunittest/XmlUniformiserTest.cpp index a04a1dddef..0f112adfb2 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/XmlUniformiserTest.cpp +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/XmlUniformiserTest.cpp @@ -3,7 +3,7 @@ #include "XmlUniformiserTest.h" #include "XmlUniformiser.h" -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( XmlUniformiserTest, +CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( XmlUniformiserTest, unitTestToolSuiteName() ); @@ -17,26 +17,26 @@ XmlUniformiserTest::~XmlUniformiserTest() } -void +void XmlUniformiserTest::setUp() { } -void +void XmlUniformiserTest::tearDown() { } -void +void XmlUniformiserTest::testEmpty() { check( "", "" ); } -void +void XmlUniformiserTest::testSkipProcessed() { check( "", @@ -44,15 +44,15 @@ XmlUniformiserTest::testSkipProcessed() } -void +void XmlUniformiserTest::testOpenElementWithoutAttributeButSomeSpaces() { - check( " ", + check( " ", "" ); } -void +void XmlUniformiserTest::testOpenCloseElement() { check( " ", @@ -60,7 +60,7 @@ XmlUniformiserTest::testOpenCloseElement() } -void +void XmlUniformiserTest::testElementWithEmptyAttribute() { check( "", @@ -68,7 +68,7 @@ XmlUniformiserTest::testElementWithEmptyAttribute() } -void +void XmlUniformiserTest::testElementWithEmptyAttributeButSomeSpaces() { check( "", @@ -76,7 +76,7 @@ XmlUniformiserTest::testElementWithEmptyAttributeButSomeSpaces() } -void +void XmlUniformiserTest::testElementWithOneAttribute() { check( "", @@ -84,7 +84,7 @@ XmlUniformiserTest::testElementWithOneAttribute() } -void +void XmlUniformiserTest::testElementWithThreeAttributes() { check( "\nContent\n\n", @@ -101,7 +101,7 @@ XmlUniformiserTest::testElementWithContent() } -void +void XmlUniformiserTest::testElementsHierarchyWithContents() { check( "\n" @@ -117,7 +117,7 @@ XmlUniformiserTest::testElementsHierarchyWithContents() } -void +void XmlUniformiserTest::testSkipComment() { check( "", @@ -125,18 +125,18 @@ XmlUniformiserTest::testSkipComment() } -void +void XmlUniformiserTest::testAssertXmlEqual() { - CPPUNIT_ASSERT_ASSERTION_FAIL( + CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNITTEST_ASSERT_XML_EQUAL( "", "" ) ); - CPPUNIT_ASSERT_ASSERTION_PASS( + CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNITTEST_ASSERT_XML_EQUAL( "", "" ) ); } -void -XmlUniformiserTest::check( const std::string &xml, +void +XmlUniformiserTest::check( const std::string &xml, const std::string &expectedStrippedXml ) { std::string actual = XmlUniformiser( xml ).stripped(); diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/XmlUniformiserTest.h b/dependencies-external/cppunit-1.12.1/examples/cppunittest/XmlUniformiserTest.h index be2d6da435..c07f0730e8 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/XmlUniformiserTest.h +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/XmlUniformiserTest.h @@ -50,7 +50,7 @@ class XmlUniformiserTest : public CPPUNIT_NS::TestFixture void testAssertXmlEqual(); private: - void check( const std::string &xml, + void check( const std::string &xml, const std::string &expectedStrippedXml ); /// Prevents the use of the copy constructor. diff --git a/dependencies-external/cppunit-1.12.1/examples/cppunittest/assertion_traitsTest.cpp b/dependencies-external/cppunit-1.12.1/examples/cppunittest/assertion_traitsTest.cpp index b02c732d5c..1153a8b9b9 100644 --- a/dependencies-external/cppunit-1.12.1/examples/cppunittest/assertion_traitsTest.cpp +++ b/dependencies-external/cppunit-1.12.1/examples/cppunittest/assertion_traitsTest.cpp @@ -14,22 +14,22 @@ assertion_traitsTest::assertion_traitsTest() void assertion_traitsTest::test_toString() { - CPPUNIT_ASSERT_EQUAL( std::string( "abc" ), + CPPUNIT_ASSERT_EQUAL( std::string( "abc" ), CPPUNIT_NS::assertion_traits::toString( "abc" ) ); - CPPUNIT_ASSERT_EQUAL( std::string( "33" ), + CPPUNIT_ASSERT_EQUAL( std::string( "33" ), CPPUNIT_NS::assertion_traits::toString( 33 ) ); - // Test that assertion_traits::toString() produces + // Test that assertion_traits::toString() produces // more than the standard 6 digits of precision. - CPPUNIT_ASSERT_EQUAL( std::string( "33.1" ), + CPPUNIT_ASSERT_EQUAL( std::string( "33.1" ), CPPUNIT_NS::assertion_traits::toString( 33.1 ) ); - CPPUNIT_ASSERT_EQUAL( std::string( "33.001" ), + CPPUNIT_ASSERT_EQUAL( std::string( "33.001" ), CPPUNIT_NS::assertion_traits::toString( 33.001 ) ); - CPPUNIT_ASSERT_EQUAL( std::string( "33.00001" ), + CPPUNIT_ASSERT_EQUAL( std::string( "33.00001" ), CPPUNIT_NS::assertion_traits::toString( 33.00001 ) ); - CPPUNIT_ASSERT_EQUAL( std::string( "33.0000001" ), + CPPUNIT_ASSERT_EQUAL( std::string( "33.0000001" ), CPPUNIT_NS::assertion_traits::toString( 33.0000001 ) ); - CPPUNIT_ASSERT_EQUAL( std::string( "33.0000000001" ), + CPPUNIT_ASSERT_EQUAL( std::string( "33.0000000001" ), CPPUNIT_NS::assertion_traits::toString( 33.0000000001 ) ); } diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/AdditionalMessage.h b/dependencies-external/cppunit-1.12.1/include/cppunit/AdditionalMessage.h index 917d75414e..1b925fc1cc 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/AdditionalMessage.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/AdditionalMessage.h @@ -18,12 +18,12 @@ CPPUNIT_NS_BEGIN * * Here is an example of usage: * \code - * + * * void checkStringEquals( const std::string &expected, * const std::string &actual, * const CppUnit::SourceLine &sourceLine, * const CppUnit::AdditionalMessage &message ); - * + * * #define XTLUT_ASSERT_STRING_EQUAL_MESSAGE( expected, actual, message ) \ * ::XtlUt::Impl::checkStringEquals( ::Xtl::toString(expected), \ * ::Xtl::toString(actual), \ diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/Asserter.h b/dependencies-external/cppunit-1.12.1/include/cppunit/Asserter.h index 94dadaad71..684739f3c5 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/Asserter.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/Asserter.h @@ -19,23 +19,23 @@ class Message; * \code * #include * #include - * - * void + * + * void * checkXmlEqual( std::string expectedXml, * std::string actualXml, * CppUnit::SourceLine sourceLine ) * { * std::string expected = XmlUniformiser( expectedXml ).stripped(); * std::string actual = XmlUniformiser( actualXml ).stripped(); - * + * * if ( expected == actual ) * return; - * + * * ::CppUnit::Asserter::failNotEqual( expected, * actual, * sourceLine ); * } - * + * * /// Asserts that two XML strings are equivalent. * #define CPPUNITTEST_ASSERT_XML_EQUAL( expected, actual ) \ * checkXmlEqual( expected, actual, \ @@ -46,13 +46,13 @@ struct Asserter { /*! \brief Throws a Exception with the specified message and location. */ - static void CPPUNIT_API fail( const Message &message, + static void CPPUNIT_API fail( const Message &message, const SourceLine &sourceLine = SourceLine() ); /*! \brief Throws a Exception with the specified message and location. * \deprecated Use fail( Message, SourceLine ) instead. */ - static void CPPUNIT_API fail( std::string message, + static void CPPUNIT_API fail( std::string message, const SourceLine &sourceLine = SourceLine() ); /*! \brief Throws a Exception with the specified message and location. @@ -61,8 +61,8 @@ struct Asserter * \param message Message explaining the assertion failiure. * \param sourceLine Location of the assertion. */ - static void CPPUNIT_API failIf( bool shouldFail, - const Message &message, + static void CPPUNIT_API failIf( bool shouldFail, + const Message &message, const SourceLine &sourceLine = SourceLine() ); /*! \brief Throws a Exception with the specified message and location. @@ -72,13 +72,13 @@ struct Asserter * \param message Message explaining the assertion failiure. * \param sourceLine Location of the assertion. */ - static void CPPUNIT_API failIf( bool shouldFail, - std::string message, + static void CPPUNIT_API failIf( bool shouldFail, + std::string message, const SourceLine &sourceLine = SourceLine() ); /*! \brief Returns a expected value string for a message. * Typically used to create 'not equal' message, or to check that a message - * contains the expected content when writing unit tests for your custom + * contains the expected content when writing unit tests for your custom * assertions. * * \param expectedValue String that represents the expected value. @@ -89,7 +89,7 @@ struct Asserter /*! \brief Returns an actual value string for a message. * Typically used to create 'not equal' message, or to check that a message - * contains the expected content when writing unit tests for your custom + * contains the expected content when writing unit tests for your custom * assertions. * * \param actualValue String that represents the actual value. @@ -111,8 +111,8 @@ struct Asserter * what are the differences between the expected and actual value. * \param shortDescription Short description for the failure message. */ - static void CPPUNIT_API failNotEqual( std::string expected, - std::string actual, + static void CPPUNIT_API failNotEqual( std::string expected, + std::string actual, const SourceLine &sourceLine, const AdditionalMessage &additionalMessage = AdditionalMessage(), std::string shortDescription = "equality assertion failed" ); @@ -128,8 +128,8 @@ struct Asserter * \param shortDescription Short description for the failure message. */ static void CPPUNIT_API failNotEqualIf( bool shouldFail, - std::string expected, - std::string actual, + std::string expected, + std::string actual, const SourceLine &sourceLine, const AdditionalMessage &additionalMessage = AdditionalMessage(), std::string shortDescription = "equality assertion failed" ); diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/CompilerOutputter.h b/dependencies-external/cppunit-1.12.1/include/cppunit/CompilerOutputter.h index 885fe65265..599c030fd4 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/CompilerOutputter.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/CompilerOutputter.h @@ -14,7 +14,7 @@ class Test; class TestFailure; class TestResultCollector; -/*! +/*! * \brief Outputs a TestResultCollector in a compiler compatible format. * \ingroup WritingTestResult * @@ -31,22 +31,22 @@ class TestResultCollector; * int main( int argc, char* argv[] ) { * // if command line contains "-selftest" then this is the post build check * // => the output must be in the compiler error format. - * bool selfTest = (argc > 1) && + * bool selfTest = (argc > 1) && * (std::string("-selftest") == argv[1]); * * CppUnit::TextUi::TestRunner runner; * runner.addTest( CppUnitTest::suite() ); // Add the top suite to the test runner - * + * * if ( selfTest ) * { // Change the default outputter to a compiler error format outputter * // The test runner owns the new outputter. * runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(), * std::cerr ) ); * } - * + * * // Run the test and don't wait a key if post build check. * bool wasSuccessful = runner.run( "", !selfTest ); - * + * * // Return error code 1 if the one of test failed. * return wasSuccessful ? 0 : 1; * } @@ -71,7 +71,7 @@ class CPPUNIT_API CompilerOutputter : public Outputter virtual ~CompilerOutputter(); /*! \brief Sets the error location format. - * + * * Indicates the format used to report location of failed assertion. This format should * match the one used by your compiler. * @@ -86,7 +86,7 @@ class CPPUNIT_API CompilerOutputter : public Outputter * * - VC++ error location format: "%p(%l):" => produce "G:\prg\MyTest.cpp(43):" * - GCC error location format: "%f:%l:" => produce "MyTest.cpp:43:" - * + * * Thoses are the two compilers currently supported (gcc format is used if * VC++ is not detected). If you want your compiler to be automatically supported by * CppUnit, send a mail to the mailing list (preferred), or submit a feature request @@ -127,7 +127,7 @@ class CPPUNIT_API CompilerOutputter : public Outputter /// Prevents the use of the copy operator. void operator =( const CompilerOutputter © ); - virtual bool processLocationFormatCommand( char command, + virtual bool processLocationFormatCommand( char command, const SourceLine &sourceLine ); virtual std::string extractBaseName( const std::string &fileName ) const; diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/Exception.h b/dependencies-external/cppunit-1.12.1/include/cppunit/Exception.h index bf5fcacf66..9661eb7426 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/Exception.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/Exception.h @@ -23,15 +23,15 @@ class CPPUNIT_API Exception : public std::exception * \param message Message associated to the exception. * \param sourceLine Source location related to the exception. */ - Exception( const Message &message = Message(), + Exception( const Message &message = Message(), const SourceLine &sourceLine = SourceLine() ); #ifdef CPPUNIT_ENABLE_SOURCELINE_DEPRECATED /*! * \deprecated Use other constructor instead. */ - Exception( std::string message, - long lineNumber, + Exception( std::string message, + long lineNumber, std::string fileName ); #endif diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/Portability.h b/dependencies-external/cppunit-1.12.1/include/cppunit/Portability.h index ddf0316918..e0c2045c48 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/Portability.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/Portability.h @@ -19,10 +19,10 @@ #endif // Version number of package -#ifndef CPPUNIT_VERSION +#ifndef CPPUNIT_VERSION #define CPPUNIT_VERSION "1.12.0" #endif - + #include // define CPPUNIT_API & CPPUNIT_NEED_DLL_DECL #include @@ -44,7 +44,7 @@ # define CPPUNIT_ENABLE_CU_TEST_MACROS 0 #endif -/* Define to 1 if the preprocessor expands (#foo) to "foo" (quotes incl.) +/* Define to 1 if the preprocessor expands (#foo) to "foo" (quotes incl.) I don't think there is any C preprocess that does NOT support this! */ #if !defined(CPPUNIT_HAVE_CPP_SOURCE_ANNOTATION) # define CPPUNIT_HAVE_CPP_SOURCE_ANNOTATION 1 @@ -81,7 +81,7 @@ #if !defined(CPPUNIT_COMPILER_LOCATION_FORMAT) #if defined(__GNUC__) && ( defined(__APPLE_CPP__) || defined(__APPLE_CC__) ) // gcc/Xcode integration on Mac OS X -# define CPPUNIT_COMPILER_LOCATION_FORMAT "%p:%l: " +# define CPPUNIT_COMPILER_LOCATION_FORMAT "%p:%l: " #else # define CPPUNIT_COMPILER_LOCATION_FORMAT "%f:%l:" #endif @@ -122,7 +122,7 @@ #endif // defined(CPPUNIT_NO_NAMESPACE) /*! Stringize a symbol. - * + * * Use this macro to convert a preprocessor symbol to a string. * * Example of usage: @@ -148,7 +148,7 @@ * to obtain a 'unique' identifier. * * \internal From boost documentation: - * The following piece of macro magic joins the two + * The following piece of macro magic joins the two * arguments together, even when one of the arguments is * itself a macro (see 16.3.1 in C++ standard). The key * is that macro expansion of macro arguments does not diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/Protector.h b/dependencies-external/cppunit-1.12.1/include/cppunit/Protector.h index d14e75f641..5e549eaeb7 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/Protector.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/Protector.h @@ -28,7 +28,7 @@ class CPPUNIT_API Functor * message associated to the exception. In fact, CppUnit capture message from * Exception and std::exception using a Protector. * - * Protector are chained. When you add a Protector using + * Protector are chained. When you add a Protector using * TestResult::pushProtector(), your protector is in fact passed as a Functor * to the first protector of the chain. * @@ -48,7 +48,7 @@ class CPPUNIT_API Protector { public: virtual ~Protector(); - + virtual bool protect( const Functor &functor, const ProtectorContext &context ) =0; diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/SourceLine.h b/dependencies-external/cppunit-1.12.1/include/cppunit/SourceLine.h index f7a85df7f0..85efca5d31 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/SourceLine.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/SourceLine.h @@ -21,7 +21,7 @@ CPPUNIT_NS_BEGIN * \ingroup BrowsingCollectedTestResult * * Used to capture the failure location in assertion. - * + * * Use the CPPUNIT_SOURCELINE() macro to construct that object. Typically used when * writing an assertion macro in association with Asserter. * diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/SynchronizedObject.h b/dependencies-external/cppunit-1.12.1/include/cppunit/SynchronizedObject.h index 0f7d094aa5..d697d1d35c 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/SynchronizedObject.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/SynchronizedObject.h @@ -49,15 +49,15 @@ class CPPUNIT_API SynchronizedObject SynchronizationObject *m_syncObject; public: - ExclusiveZone( SynchronizationObject *syncObject ) - : m_syncObject( syncObject ) - { - m_syncObject->lock(); + ExclusiveZone( SynchronizationObject *syncObject ) + : m_syncObject( syncObject ) + { + m_syncObject->lock(); } - ~ExclusiveZone() - { - m_syncObject->unlock (); + ~ExclusiveZone() + { + m_syncObject->unlock (); } }; diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/Test.h b/dependencies-external/cppunit-1.12.1/include/cppunit/Test.h index a56be0fbea..78a67c395c 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/Test.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/Test.h @@ -15,7 +15,7 @@ class TestPath; * * All test objects should be a subclass of Test. Some test objects, * TestCase for example, represent one individual test. Other test - * objects, such as TestSuite, are comprised of several tests. + * objects, such as TestSuite, are comprised of several tests. * * When a Test is run, the result is collected by a TestResult object. * @@ -45,11 +45,11 @@ class CPPUNIT_API Test /*! \brief Returns the child test of the specified index. * - * This method test if the index is valid, then call doGetChildTestAt() if + * This method test if the index is valid, then call doGetChildTestAt() if * the index is valid. Otherwise std::out_of_range exception is thrown. * * You should override doGetChildTestAt() method. - * + * * \param index Zero based index of the child test to return. * \return Pointer on the test. Never \c NULL. * \exception std::out_of_range is \a index is < 0 or >= getChildTestCount(). @@ -57,7 +57,7 @@ class CPPUNIT_API Test virtual Test *getChildTestAt( int index ) const; /*! \brief Returns the test name. - * + * * Each test has a name. This name may be used to find the * test in a suite or registry of tests. */ @@ -90,7 +90,7 @@ class CPPUNIT_API Test /*! \brief Resolved the specified test path with this test acting as 'root'. * \param testPath Test path string to resolve. - * \return Resolved TestPath. + * \return Resolved TestPath. * \exception std::invalid_argument if \a testPath could not be resolved. * \see TestPath. */ diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/TestAssert.h b/dependencies-external/cppunit-1.12.1/include/cppunit/TestAssert.h index f74797b9da..a78924ab95 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/TestAssert.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/TestAssert.h @@ -14,7 +14,7 @@ CPPUNIT_NS_BEGIN /*! \brief Traits used by CPPUNIT_ASSERT_EQUAL(). * - * Here is an example of specialising these traits: + * Here is an example of specialising these traits: * * \code * template<> @@ -24,7 +24,7 @@ CPPUNIT_NS_BEGIN * { * return x == y; * } - * + * * static std::string toString( const std::string& x ) * { * std::string text = '"' + x + '"'; // adds quote around the string to see whitespace @@ -36,8 +36,8 @@ CPPUNIT_NS_BEGIN * \endcode */ template -struct assertion_traits -{ +struct assertion_traits +{ static bool equal( const T& x, const T& y ) { return x == y; @@ -52,17 +52,17 @@ struct assertion_traits }; -/*! \brief Traits used by CPPUNIT_ASSERT_DOUBLES_EQUAL(). - * - * This specialisation from @c struct @c assertion_traits<> ensures that - * doubles are converted in full, instead of being rounded to the default - * 6 digits of precision. Use the system defined ISO C99 macro DBL_DIG +/*! \brief Traits used by CPPUNIT_ASSERT_DOUBLES_EQUAL(). + * + * This specialisation from @c struct @c assertion_traits<> ensures that + * doubles are converted in full, instead of being rounded to the default + * 6 digits of precision. Use the system defined ISO C99 macro DBL_DIG * within float.h is available to define the maximum precision, otherwise * use the hard-coded maximum precision of 15. */ template <> struct assertion_traits -{ +{ static bool equal( double x, double y ) { return x == y; @@ -77,9 +77,9 @@ struct assertion_traits #endif // #ifdef DBL_DIG char buffer[128]; #ifdef __STDC_SECURE_LIB__ // Use secure version with visual studio 2005 to avoid warning. - sprintf_s(buffer, sizeof(buffer), "%.*g", precision, x); -#else - sprintf(buffer, "%.*g", precision, x); + sprintf_s(buffer, sizeof(buffer), "%.*g", precision, x); +#else + sprintf(buffer, "%.*g", precision, x); #endif return buffer; } @@ -114,7 +114,7 @@ void assertEquals( const T& expected, void CPPUNIT_API assertDoubleEquals( double expected, double actual, double delta, - SourceLine sourceLine, + SourceLine sourceLine, const std::string &message ); @@ -181,7 +181,7 @@ void CPPUNIT_API assertDoubleEquals( double expected, * Requirement for \a expected and \a actual parameters: * - They are exactly of the same type * - They are serializable into a std::strstream using operator <<. - * - They can be compared using operator ==. + * - They can be compared using operator ==. * * The last two requirements (serialization and comparison) can be * removed by specializing the CppUnit::assertion_traits. @@ -205,7 +205,7 @@ void CPPUNIT_API assertDoubleEquals( double expected, * Requirement for \a expected and \a actual parameters: * - They are exactly of the same type * - They are serializable into a std::strstream using operator <<. - * - They can be compared using operator ==. + * - They can be compared using operator ==. * * The last two requirements (serialization and comparison) can be * removed by specializing the CppUnit::assertion_traits. @@ -217,12 +217,12 @@ void CPPUNIT_API assertDoubleEquals( double expected, (message) ) ) #endif -/*! \brief Macro for primitive double value comparisons. +/*! \brief Macro for primitive double value comparisons. * \ingroup Assertions * * The assertion pass if both expected and actual are finite and * \c fabs( \c expected - \c actual ) <= \c delta. - * If either \c expected or actual are infinite (+/- inf), the + * If either \c expected or actual are infinite (+/- inf), the * assertion pass if \c expected == \c actual. * If either \c expected or \c actual is a NaN (not a number), then * the assertion fails. @@ -235,8 +235,8 @@ void CPPUNIT_API assertDoubleEquals( double expected, "" ) ) -/*! \brief Macro for primitive double value comparisons, setting a - * user-supplied message in case of failure. +/*! \brief Macro for primitive double value comparisons, setting a + * user-supplied message in case of failure. * \ingroup Assertions * \sa CPPUNIT_ASSERT_DOUBLES_EQUAL for detailed semantic of the assertion. */ @@ -248,7 +248,7 @@ void CPPUNIT_API assertDoubleEquals( double expected, (message) ) ) -/** Asserts that the given expression throws an exception of the specified type. +/** Asserts that the given expression throws an exception of the specified type. * \ingroup Assertions * Example of usage: * \code @@ -274,8 +274,8 @@ void CPPUNIT_API assertDoubleEquals( double expected, // implementation detail #define CPPUNIT_GET_PARAMETER_STRING( parameter ) #parameter -/** Asserts that the given expression throws an exception of the specified type, - * setting a user supplied message in case of failure. +/** Asserts that the given expression throws an exception of the specified type, + * setting a user supplied message in case of failure. * \ingroup Assertions * Example of usage: * \code @@ -326,8 +326,8 @@ void CPPUNIT_API assertDoubleEquals( double expected, expression ) -/** Asserts that the given expression does not throw any exceptions, - * setting a user supplied message in case of failure. +/** Asserts that the given expression does not throw any exceptions, + * setting a user supplied message in case of failure. * \ingroup Assertions * Example of usage: * \code @@ -370,7 +370,7 @@ void CPPUNIT_API assertDoubleEquals( double expected, CPPUNIT_ASSERT_THROW( assertion, CPPUNIT_NS::Exception ) -/** Asserts that an assertion fail, with a user-supplied message in +/** Asserts that an assertion fail, with a user-supplied message in * case of error. * \ingroup Assertions * Use to test assertions. @@ -395,8 +395,8 @@ void CPPUNIT_API assertDoubleEquals( double expected, CPPUNIT_ASSERT_NO_THROW( assertion ) -/** Asserts that an assertion pass, with a user-supplied message in - * case of failure. +/** Asserts that an assertion pass, with a user-supplied message in + * case of failure. * \ingroup Assertions * Use to test assertions. * Example of usage: diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/TestCaller.h b/dependencies-external/cppunit-1.12.1/include/cppunit/TestCaller.h index dc4d82ed9b..204f43ff79 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/TestCaller.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/TestCaller.h @@ -36,7 +36,7 @@ struct ExpectedExceptionTraits #if CPPUNIT_USE_TYPEINFO_NAME throw Exception( Message( "expected exception not thrown", - "Expected exception type: " + + "Expected exception type: " + TypeInfoHelper::getClassName( typeid( ExceptionType ) ) ) ); #else throw Exception( "expected exception not thrown" ); @@ -45,7 +45,7 @@ struct ExpectedExceptionTraits }; -/*! \brief (Implementation) Traits specialization used by TestCaller to +/*! \brief (Implementation) Traits specialization used by TestCaller to * expect no exception. * * This class is an implementation detail. You should never use this class directly. @@ -67,13 +67,13 @@ struct ExpectedExceptionTraits /*! \brief Generate a test case from a fixture method. * \ingroup WritingTestFixture * - * A test caller provides access to a test case method - * on a test fixture class. Test callers are useful when - * you want to run an individual test or add it to a + * A test caller provides access to a test case method + * on a test fixture class. Test callers are useful when + * you want to run an individual test or add it to a * suite. - * Test Callers invoke only one Test (i.e. test method) on one + * Test Callers invoke only one Test (i.e. test method) on one * Fixture of a TestFixture. - * + * * Here is an example: * \code * class MathTest : public CppUnit::TestFixture { @@ -96,15 +96,15 @@ struct ExpectedExceptionTraits * * You can use a TestCaller to bind any test method on a TestFixture * class, as long as it accepts void and returns void. - * + * * \see TestCase */ template class TestCaller : public TestCase -{ +{ typedef void (Fixture::*TestMethod)(); - + public: /*! * Constructor for TestCaller. This constructor builds a new Fixture @@ -113,7 +113,7 @@ class TestCaller : public TestCase * \param test the method this TestCaller calls in runTest() */ TestCaller( std::string name, TestMethod test ) : - TestCase( name ), + TestCase( name ), m_ownFixture( true ), m_fixture( new Fixture() ), m_test( test ) @@ -121,7 +121,7 @@ class TestCaller : public TestCase } /*! - * Constructor for TestCaller. + * Constructor for TestCaller. * This constructor does not create a new Fixture instance but accepts * an existing one as parameter. The TestCaller will not own the * Fixture object. @@ -130,15 +130,15 @@ class TestCaller : public TestCase * \param fixture the Fixture to invoke the test method on. */ TestCaller(std::string name, TestMethod test, Fixture& fixture) : - TestCase( name ), + TestCase( name ), m_ownFixture( false ), m_fixture( &fixture ), m_test( test ) { } - + /*! - * Constructor for TestCaller. + * Constructor for TestCaller. * This constructor does not create a new Fixture instance but accepts * an existing one as parameter. The TestCaller will own the * Fixture object and delete it in its destructor. @@ -147,21 +147,21 @@ class TestCaller : public TestCase * \param fixture the Fixture to invoke the test method on. */ TestCaller(std::string name, TestMethod test, Fixture* fixture) : - TestCase( name ), + TestCase( name ), m_ownFixture( true ), m_fixture( fixture ), m_test( test ) { } - - ~TestCaller() + + ~TestCaller() { if (m_ownFixture) delete m_fixture; } void runTest() - { + { // try { (m_fixture->*m_test)(); // } @@ -170,25 +170,25 @@ class TestCaller : public TestCase // } // ExpectedExceptionTraits::expectedException(); - } + } void setUp() - { - m_fixture->setUp (); + { + m_fixture->setUp (); } void tearDown() - { - m_fixture->tearDown (); + { + m_fixture->tearDown (); } std::string toString() const - { - return "TestCaller " + getName(); + { + return "TestCaller " + getName(); } -private: - TestCaller( const TestCaller &other ); +private: + TestCaller( const TestCaller &other ); TestCaller &operator =( const TestCaller &other ); private: diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/TestCase.h b/dependencies-external/cppunit-1.12.1/include/cppunit/TestCase.h index d4b7a46a8f..f1d806752b 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/TestCase.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/TestCase.h @@ -34,22 +34,22 @@ class CPPUNIT_API TestCase : public TestLeaf, TestCase(); ~TestCase(); - + virtual void run(TestResult *result); std::string getName() const; //! FIXME: this should probably be pure virtual. virtual void runTest(); - + private: - TestCase( const TestCase &other ); - TestCase &operator=( const TestCase &other ); - + TestCase( const TestCase &other ); + TestCase &operator=( const TestCase &other ); + private: const std::string m_name; }; CPPUNIT_NS_END -#endif // CPPUNIT_TESTCASE_H +#endif // CPPUNIT_TESTCASE_H diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/TestComposite.h b/dependencies-external/cppunit-1.12.1/include/cppunit/TestComposite.h index 0ded95fcdb..e9fbfabaef 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/TestComposite.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/TestComposite.h @@ -11,7 +11,7 @@ CPPUNIT_NS_BEGIN * * Base class for all test composites. Subclass this class if you need to implement * a custom TestSuite. - * + * * \see Test, TestSuite. */ class CPPUNIT_API TestComposite : public Test @@ -24,12 +24,12 @@ class CPPUNIT_API TestComposite : public Test void run( TestResult *result ); int countTestCases() const; - + std::string getName() const; private: TestComposite( const TestComposite &other ); - TestComposite &operator =( const TestComposite &other ); + TestComposite &operator =( const TestComposite &other ); virtual void doStartSuite( TestResult *controller ); virtual void doRunChildTests( TestResult *controller ); diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/TestFailure.h b/dependencies-external/cppunit-1.12.1/include/cppunit/TestFailure.h index 64199790df..1b8fc008bf 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/TestFailure.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/TestFailure.h @@ -21,7 +21,7 @@ class Test; * TestFailure assumes lifetime control for any exception * passed to it. */ -class CPPUNIT_API TestFailure +class CPPUNIT_API TestFailure { public: TestFailure( Test *failedTest, @@ -47,9 +47,9 @@ class CPPUNIT_API TestFailure Exception *m_thrownException; bool m_isError; -private: - TestFailure( const TestFailure &other ); - TestFailure &operator =( const TestFailure& other ); +private: + TestFailure( const TestFailure &other ); + TestFailure &operator =( const TestFailure& other ); }; diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/TestFixture.h b/dependencies-external/cppunit-1.12.1/include/cppunit/TestFixture.h index 1223adbc93..a99c1d7842 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/TestFixture.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/TestFixture.h @@ -13,8 +13,8 @@ CPPUNIT_NS_BEGIN * of test cases. * * To define a test fixture, do the following: - * - implement a subclass of TestCase - * - the fixture is defined by instance variables + * - implement a subclass of TestCase + * - the fixture is defined by instance variables * - initialize the fixture state by overriding setUp * (i.e. construct the instance variables of the fixture) * - clean-up after a test by overriding tearDown. @@ -22,7 +22,7 @@ CPPUNIT_NS_BEGIN * Each test runs in its own fixture so there * can be no side effects among test runs. * Here is an example: - * + * * \code * class MathTest : public CppUnit::TestFixture { * protected: @@ -41,29 +41,29 @@ CPPUNIT_NS_BEGIN * For each test implement a method which interacts * with the fixture. Verify the expected results with assertions specified * by calling CPPUNIT_ASSERT on the expression you want to test: - * + * * \code - * public: + * public: * void testAdd () { * int result = m_value1 + m_value2; * CPPUNIT_ASSERT( result == 5 ); * } * \endcode - * + * * Once the methods are defined you can run them. To do this, use * a TestCaller. * * \code - * CppUnit::Test *test = new CppUnit::TestCaller( "testAdd", + * CppUnit::Test *test = new CppUnit::TestCaller( "testAdd", * &MathTest::testAdd ); * test->run(); * \endcode * * - * The tests to be run can be collected into a TestSuite. - * + * The tests to be run can be collected into a TestSuite. + * * \code - * public: + * public: * static CppUnit::TestSuite *MathTest::suite () { * CppUnit::TestSuite *suiteOfTests = new CppUnit::TestSuite; * suiteOfTests->addTest(new CppUnit::TestCaller( @@ -73,11 +73,11 @@ CPPUNIT_NS_BEGIN * return suiteOfTests; * } * \endcode - * + * * A set of macros have been created for convenience. They are located in HelperMacros.h. * * \see TestResult, TestSuite, TestCaller, - * \see CPPUNIT_TEST_SUB_SUITE, CPPUNIT_TEST, CPPUNIT_TEST_SUITE_END, + * \see CPPUNIT_TEST_SUB_SUITE, CPPUNIT_TEST, CPPUNIT_TEST_SUITE_END, * \see CPPUNIT_TEST_SUITE_REGISTRATION, CPPUNIT_TEST_EXCEPTION, CPPUNIT_TEST_FAIL. */ class CPPUNIT_API TestFixture diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/TestLeaf.h b/dependencies-external/cppunit-1.12.1/include/cppunit/TestLeaf.h index c83b075975..fb0a503038 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/TestLeaf.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/TestLeaf.h @@ -16,10 +16,10 @@ class CPPUNIT_API TestLeaf: public Test { public: /*! Returns 1 as the default number of test cases invoked by run(). - * + * * You may override this method when many test cases are invoked (RepeatedTest * for example). - * + * * \return 1. * \see Test::countTestCases(). */ diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/TestListener.h b/dependencies-external/cppunit-1.12.1/include/cppunit/TestListener.h index 330262d331..a6554e5ffb 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/TestListener.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/TestListener.h @@ -42,7 +42,7 @@ class TestResult; * { * _chronometer.start(); * } - * + * * void endTest( CppUnit::Test *test ) * { * _chronometer.end(); @@ -55,7 +55,7 @@ class TestResult; * Clock _chronometer; * }; * \endcode - * + * * And another example that track failure/success at test suite level and captures * the TestPath of each suite: * \code @@ -66,12 +66,12 @@ class TestResult; * { * m_currentPath.add( suite ); * } - * + * * void addFailure( const TestFailure &failure ) * { * m_suiteFailure.top() = false; * } - * + * * void endSuite( CppUnit::Test *suite ) * { * m_suiteStatus.insert( std::make_pair( suite, m_suiteFailure.top() ) ); @@ -95,13 +95,13 @@ class CPPUNIT_API TestListener { public: virtual ~TestListener() {} - + /// Called when just before a TestCase is run. virtual void startTest( Test * /*test*/ ) {} /*! \brief Called when a failure occurs while running a test. * \see TestFailure. - * \warning \a failure is a temporary object that is destroyed after the + * \warning \a failure is a temporary object that is destroyed after the * method call. Use TestFailure::clone() to create a duplicate. */ virtual void addFailure( const TestFailure & /*failure*/ ) {} @@ -118,14 +118,14 @@ class CPPUNIT_API TestListener virtual void endSuite( Test * /*suite*/ ) {} /*! \brief Called by a TestRunner before running the test. - * + * * You can use this to do some global initialisation. A listener * could also use to output a 'prolog' to the test run. * * \param test Test that is going to be run. * \param eventManager Event manager used for the test run. */ - virtual void startTestRun( Test * /*test*/, + virtual void startTestRun( Test * /*test*/, TestResult * /*eventManager*/ ) {} /*! \brief Called by a TestRunner after running the test. @@ -136,7 +136,7 @@ class CPPUNIT_API TestListener * \param test Test that was run. * \param eventManager Event manager used for the test run. */ - virtual void endTestRun( Test * /*test*/, + virtual void endTestRun( Test * /*test*/, TestResult * /*eventManager*/ ) {} }; diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/TestPath.h b/dependencies-external/cppunit-1.12.1/include/cppunit/TestPath.h index c3c851cc5b..b4ca86e759 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/TestPath.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/TestPath.h @@ -35,7 +35,7 @@ class CPPUNIT_API TestPath { public: /*! \brief Constructs an invalid path. - * + * * The path is invalid until a test is added with add(). */ TestPath(); @@ -53,16 +53,16 @@ class CPPUNIT_API TestPath * \param count Number of tests to copy. If < 0 then all test starting from index * \a indexFirst are copied. */ - TestPath( const TestPath &otherPath, - int indexFirst, + TestPath( const TestPath &otherPath, + int indexFirst, int count = -1 ); /*! \brief Resolves a path from a string returned by toString(). * * If \a pathAsString is an absolute path (begins with '/'), then the first test name - * of the path must be the name of \a searchRoot. Otherwise, \a pathAsString is a + * of the path must be the name of \a searchRoot. Otherwise, \a pathAsString is a * relative path, and the first test found using Test::findTest() matching the first - * test name is used as root. An empty string resolve to a path containing + * test name is used as root. An empty string resolve to a path containing * \a searchRoot. * * The resolved path is always valid. @@ -72,7 +72,7 @@ class CPPUNIT_API TestPath * \exception std::invalid_argument if one of the test names can not be resolved. * \see toString(). */ - TestPath( Test *searchRoot, + TestPath( Test *searchRoot, const std::string &pathAsString ); /*! \brief Copy constructor. @@ -154,7 +154,7 @@ class CPPUNIT_API TestPath * "Math::testAdd", toString() will return: * * "All Tests/Math/Math::testAdd". - * + * * \return A string composed of the test names separated with a '/'. It is a relative * path. */ diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/TestResult.h b/dependencies-external/cppunit-1.12.1/include/cppunit/TestResult.h index e7e1050a08..f672ddeb33 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/TestResult.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/TestResult.h @@ -41,9 +41,9 @@ class TestListener; * TestResult supplies a template method 'setSynchronizationObject()' * so that subclasses can provide mutual exclusion in the face of multiple * threads. This can be useful when tests execute in one thread and - * they fill a subclass of TestResult which effects change in another + * they fill a subclass of TestResult which effects change in another * thread. To have mutual exclusion, override setSynchronizationObject() - * and make sure that you create an instance of ExclusiveZone at the + * and make sure that you create an instance of ExclusiveZone at the * beginning of each method. * * \see Test, TestListener, TestResultCollector, Outputter. @@ -63,7 +63,7 @@ class CPPUNIT_API TestResult : protected SynchronizedObject /// Resets the stop flag. virtual void reset(); - + /// Stop testing virtual void stop(); @@ -73,7 +73,7 @@ class CPPUNIT_API TestResult : protected SynchronizedObject /// Informs TestListener that a test will be started. virtual void startTest( Test *test ); - /*! \brief Adds an error to the list of errors. + /*! \brief Adds an error to the list of errors. * The passed in exception * caused the error */ @@ -94,7 +94,7 @@ class CPPUNIT_API TestResult : protected SynchronizedObject virtual void endSuite( Test *test ); /*! \brief Run the specified test. - * + * * Calls startTestRun(), test->run(this), and finally endTestRun(). */ virtual void runTest( Test *test ); @@ -131,14 +131,14 @@ class CPPUNIT_API TestResult : protected SynchronizedObject virtual void startTestRun( Test *test ); virtual void endTestRun( Test *test ); - + protected: typedef CppUnitDeque TestListeners; TestListeners m_listeners; ProtectorChain *m_protectorChain; bool m_stop; -private: +private: TestResult( const TestResult &other ); TestResult &operator =( const TestResult &other ); }; diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/TestResultCollector.h b/dependencies-external/cppunit-1.12.1/include/cppunit/TestResultCollector.h index 01b0a547ab..469ea6b902 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/TestResultCollector.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/TestResultCollector.h @@ -23,8 +23,8 @@ CPPUNIT_NS_BEGIN /*! \brief Collects test result. * \ingroup WritingTestResult * \ingroup BrowsingCollectedTestResult - * - * A TestResultCollector is a TestListener which collects the results of executing + * + * A TestResultCollector is a TestListener which collects the results of executing * a test case. It is an instance of the Collecting Parameter pattern. * * The test framework distinguishes between failures and errors. diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/TestRunner.h b/dependencies-external/cppunit-1.12.1/include/cppunit/TestRunner.h index 930370ad97..15839c7c2f 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/TestRunner.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/TestRunner.h @@ -25,46 +25,46 @@ class TestResult; * #include * #include * #include - * - * - * int + * + * + * int * main( int argc, char* argv[] ) * { * std::string testPath = (argc > 1) ? std::string(argv[1]) : ""; - * + * * // Create the event manager and test controller * CppUnit::TestResult controller; - * + * * // Add a listener that colllects test result * CppUnit::TestResultCollector result; - * controller.addListener( &result ); - * + * controller.addListener( &result ); + * * // Add a listener that print dots as test run. * CppUnit::TextTestProgressListener progress; - * controller.addListener( &progress ); - * + * controller.addListener( &progress ); + * * // Add the top suite to the test runner * CppUnit::TestRunner runner; - * runner.addTest( CppUnit::TestFactoryRegistry::getRegistry().makeTest() ); + * runner.addTest( CppUnit::TestFactoryRegistry::getRegistry().makeTest() ); * try * { * std::cout << "Running " << testPath; * runner.run( controller, testPath ); - * + * * std::cerr << std::endl; - * + * * // Print test in a compiler compatible format. * CppUnit::CompilerOutputter outputter( &result, std::cerr ); - * outputter.write(); + * outputter.write(); * } * catch ( std::invalid_argument &e ) // Test path not resolved * { - * std::cerr << std::endl + * std::cerr << std::endl * << "ERROR: " << e.what() * << std::endl; * return 0; * } - * + * * return result.wasSuccessful() ? 0 : 1; * } * \endcode diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/TestSuite.h b/dependencies-external/cppunit-1.12.1/include/cppunit/TestSuite.h index 2b9cd8d497..6c43a2146e 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/TestSuite.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/TestSuite.h @@ -34,7 +34,7 @@ CPPUNIT_NS_BEGIN * control for any tests added to them. * * TestSuites do not register themselves in the TestRegistry. - * \see Test + * \see Test * \see TestCaller */ class CPPUNIT_API TestSuite : public TestComposite @@ -52,7 +52,7 @@ class CPPUNIT_API TestSuite : public TestComposite void addTest( Test *test ); /*! Returns the list of the tests (DEPRECATED). - * \deprecated Use getChildTestCount() & getChildTestAt() of the + * \deprecated Use getChildTestCount() & getChildTestAt() of the * TestComposite interface instead. * \return Reference on a vector that contains the tests of the suite. */ diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/TextTestProgressListener.h b/dependencies-external/cppunit-1.12.1/include/cppunit/TextTestProgressListener.h index 7521c40bcd..0bc58382e1 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/TextTestProgressListener.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/TextTestProgressListener.h @@ -7,7 +7,7 @@ CPPUNIT_NS_BEGIN -/*! +/*! * \brief TestListener that show the status of each TestCase test result. * \ingroup TrackingTestExecution */ @@ -25,7 +25,7 @@ class CPPUNIT_API TextTestProgressListener : public TestListener void addFailure( const TestFailure &failure ); - void endTestRun( Test *test, + void endTestRun( Test *test, TestResult *eventManager ); private: diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/TextTestResult.h b/dependencies-external/cppunit-1.12.1/include/cppunit/TextTestResult.h index e7b1fa3ea6..32ebc51ef0 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/TextTestResult.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/TextTestResult.h @@ -14,7 +14,7 @@ class Test; /*! \brief Holds printable test result (DEPRECATED). * \ingroup TrackingTestExecution - * + * * deprecated Use class TextTestProgressListener and TextOutputter instead. */ class CPPUNIT_API TextTestResult : public TestResult, @@ -29,7 +29,7 @@ class CPPUNIT_API TextTestResult : public TestResult, }; /** insertion operator for easy output */ -CPPUNIT_API OStream &operator <<( OStream &stream, +CPPUNIT_API OStream &operator <<( OStream &stream, TextTestResult &result ); CPPUNIT_NS_END diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/XmlOutputter.h b/dependencies-external/cppunit-1.12.1/include/cppunit/XmlOutputter.h index 0de9676d8f..55e5214abd 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/XmlOutputter.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/XmlOutputter.h @@ -28,10 +28,10 @@ class XmlOutputterHook; /*! \brief Outputs a TestResultCollector in XML format. * \ingroup WritingTestResult * - * Save the test result as a XML stream. + * Save the test result as a XML stream. * - * Additional datas can be added to the XML document using XmlOutputterHook. - * Hook are not owned by the XmlOutputter. They should be valid until + * Additional datas can be added to the XML document using XmlOutputterHook. + * Hook are not owned by the XmlOutputter. They should be valid until * destruction of the XmlOutputter. They can be removed with removeHook(). * * \see XmlDocument, XmlElement, XmlOutputterHook. @@ -42,7 +42,7 @@ class CPPUNIT_API XmlOutputter : public Outputter /*! \brief Constructs a XmlOutputter object. * \param result Result of the test run. * \param stream Stream used to output the XML output. - * \param encoding Encoding used in the XML file (default is Latin-1). + * \param encoding Encoding used in the XML file (default is Latin-1). */ XmlOutputter( TestResultCollector *result, OStream &stream, @@ -104,7 +104,7 @@ class CPPUNIT_API XmlOutputter : public Outputter XmlElement *rootNode ); /*! \brief Adds the statics element to the root node. - * + * * Creates a new element containing statistics data and adds it to the root element. * Then, for all hooks, call statisticsAdded(). * \param rootNode Root element. @@ -112,7 +112,7 @@ class CPPUNIT_API XmlOutputter : public Outputter virtual void addStatistics( XmlElement *rootNode ); /*! \brief Adds a failed test to the failed tests node. - * Creates a new element containing datas about the failed test, and adds it to + * Creates a new element containing datas about the failed test, and adds it to * the failed tests element. * Then, for all hooks, call failTestAdded(). */ @@ -126,11 +126,11 @@ class CPPUNIT_API XmlOutputter : public Outputter /*! \brief Adds a successful test to the successful tests node. - * Creates a new element containing datas about the successful test, and adds it to + * Creates a new element containing datas about the successful test, and adds it to * the successful tests element. * Then, for all hooks, call successfulTestAdded(). */ - virtual void addSuccessfulTest( Test *test, + virtual void addSuccessfulTest( Test *test, int testNumber, XmlElement *testsNode ); protected: diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/XmlOutputterHook.h b/dependencies-external/cppunit-1.12.1/include/cppunit/XmlOutputterHook.h index 5ded3b1ee8..373b06146c 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/XmlOutputterHook.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/XmlOutputterHook.h @@ -26,13 +26,13 @@ class XmlElement; * * See examples/ClockerPlugIn which makes use of most the hook. * - * Another simple example of an outputter hook is shown below. It may be + * Another simple example of an outputter hook is shown below. It may be * used to add some meta information to your result files. In the example, * the author name as well as the project name and test creation date is * added to the head of the xml file. * - * In order to make this information stored within the xml file, the virtual - * member function beginDocument() is overriden where a new + * In order to make this information stored within the xml file, the virtual + * member function beginDocument() is overriden where a new * XmlElement object is created. * * This element is simply added to the root node of the document which @@ -43,9 +43,9 @@ class XmlElement; * #include * #include * #include - * + * * ... - * + * * class MyXmlOutputterHook : public CppUnit::XmlOutputterHook * { * public: @@ -55,11 +55,11 @@ class XmlElement; * m_projectName = projectName; * m_author = author; * }; - * + * * virtual ~MyXmlOutputterHook() * { * }; - * + * * void beginDocument(CppUnit::XmlDocument* document) * { * if (!document) @@ -67,34 +67,34 @@ class XmlElement; * * // dump current time * std::string szDate = CppUnit::StringTools::toString( (int)time(0) ); - * CppUnit::XmlElement* metaEl = new CppUnit::XmlElement("SuiteInfo", + * CppUnit::XmlElement* metaEl = new CppUnit::XmlElement("SuiteInfo", * ""); * * metaEl->addElement( new CppUnit::XmlElement("Author", m_author) ); * metaEl->addElement( new CppUnit::XmlElement("Project", m_projectName) ); * metaEl->addElement( new CppUnit::XmlElement("Date", szDate ) ); - * + * * document->rootElement().addElement(metaEl); * }; * private: * std::string m_projectName; * std::string m_author; - * }; + * }; * \endcode * - * Within your application's main code, you need to snap the hook + * Within your application's main code, you need to snap the hook * object into your xml outputter object like shown below: * * \code * CppUnit::TextUi::TestRunner runner; * std::ofstream outputFile("testResults.xml"); - * + * * CppUnit::XmlOutputter* outputter = new CppUnit::XmlOutputter( &runner.result(), - * outputFile ); + * outputFile ); * MyXmlOutputterHook hook("myProject", "meAuthor"); * outputter->addHook(&hook); - * runner.setOutputter(outputter); - * runner.addTest( VectorFixture::suite() ); + * runner.setOutputter(outputter); + * runner.addTest( VectorFixture::suite() ); * runner.run(); * outputFile.close(); * \endcode diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/config-auto.h b/dependencies-external/cppunit-1.12.1/include/cppunit/config-auto.h index a8c2204468..5c454dc1a6 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/config-auto.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/config-auto.h @@ -1,6 +1,6 @@ #ifndef _INCLUDE_CPPUNIT_CONFIG_AUTO_H #define _INCLUDE_CPPUNIT_CONFIG_AUTO_H 1 - + /* include/cppunit/config-auto.h. Generated automatically at end of configure. */ /* config/config.h. Generated from config.h.in by configure. */ /* config/config.h.in. Generated from configure.in by autoheader. */ @@ -9,158 +9,158 @@ /* #undef CPPUNIT_FUNC_STRING_COMPARE_STRING_FIRST */ /* define if the library defines strstream */ -#ifndef CPPUNIT_HAVE_CLASS_STRSTREAM -#define CPPUNIT_HAVE_CLASS_STRSTREAM 1 +#ifndef CPPUNIT_HAVE_CLASS_STRSTREAM +#define CPPUNIT_HAVE_CLASS_STRSTREAM 1 #endif /* Define to 1 if you have the header file. */ -#ifndef CPPUNIT_HAVE_CMATH -#define CPPUNIT_HAVE_CMATH 1 +#ifndef CPPUNIT_HAVE_CMATH +#define CPPUNIT_HAVE_CMATH 1 #endif /* Define if you have the GNU dld library. */ /* #undef CPPUNIT_HAVE_DLD */ /* Define to 1 if you have the `dlerror' function. */ -#ifndef CPPUNIT_HAVE_DLERROR -#define CPPUNIT_HAVE_DLERROR 1 +#ifndef CPPUNIT_HAVE_DLERROR +#define CPPUNIT_HAVE_DLERROR 1 #endif /* Define to 1 if you have the header file. */ -#ifndef CPPUNIT_HAVE_DLFCN_H -#define CPPUNIT_HAVE_DLFCN_H 1 +#ifndef CPPUNIT_HAVE_DLFCN_H +#define CPPUNIT_HAVE_DLFCN_H 1 #endif /* Define to 1 if you have the `finite' function. */ -#ifndef CPPUNIT_HAVE_FINITE -#define CPPUNIT_HAVE_FINITE 1 +#ifndef CPPUNIT_HAVE_FINITE +#define CPPUNIT_HAVE_FINITE 1 #endif /* define if the compiler supports GCC C++ ABI name demangling */ /* #undef CPPUNIT_HAVE_GCC_ABI_DEMANGLE */ /* Define to 1 if you have the header file. */ -#ifndef CPPUNIT_HAVE_INTTYPES_H -#define CPPUNIT_HAVE_INTTYPES_H 1 +#ifndef CPPUNIT_HAVE_INTTYPES_H +#define CPPUNIT_HAVE_INTTYPES_H 1 #endif /* define if compiler has isfinite */ -#ifndef CPPUNIT_HAVE_ISFINITE -#define CPPUNIT_HAVE_ISFINITE 1 +#ifndef CPPUNIT_HAVE_ISFINITE +#define CPPUNIT_HAVE_ISFINITE 1 #endif /* Define if you have the libdl library or equivalent. */ -#ifndef CPPUNIT_HAVE_LIBDL -#define CPPUNIT_HAVE_LIBDL 1 +#ifndef CPPUNIT_HAVE_LIBDL +#define CPPUNIT_HAVE_LIBDL 1 #endif /* Define to 1 if you have the header file. */ -#ifndef CPPUNIT_HAVE_MEMORY_H -#define CPPUNIT_HAVE_MEMORY_H 1 +#ifndef CPPUNIT_HAVE_MEMORY_H +#define CPPUNIT_HAVE_MEMORY_H 1 #endif /* define to 1 if the compiler implements namespaces */ -#ifndef CPPUNIT_HAVE_NAMESPACES -#define CPPUNIT_HAVE_NAMESPACES 1 +#ifndef CPPUNIT_HAVE_NAMESPACES +#define CPPUNIT_HAVE_NAMESPACES 1 #endif /* define if the compiler supports Run-Time Type Identification */ -#ifndef CPPUNIT_HAVE_RTTI -#define CPPUNIT_HAVE_RTTI 1 +#ifndef CPPUNIT_HAVE_RTTI +#define CPPUNIT_HAVE_RTTI 1 #endif /* Define if you have the shl_load function. */ /* #undef CPPUNIT_HAVE_SHL_LOAD */ /* define if the compiler has stringstream */ -#ifndef CPPUNIT_HAVE_SSTREAM -#define CPPUNIT_HAVE_SSTREAM 1 +#ifndef CPPUNIT_HAVE_SSTREAM +#define CPPUNIT_HAVE_SSTREAM 1 #endif /* Define to 1 if you have the header file. */ -#ifndef CPPUNIT_HAVE_STDINT_H -#define CPPUNIT_HAVE_STDINT_H 1 +#ifndef CPPUNIT_HAVE_STDINT_H +#define CPPUNIT_HAVE_STDINT_H 1 #endif /* Define to 1 if you have the header file. */ -#ifndef CPPUNIT_HAVE_STDLIB_H -#define CPPUNIT_HAVE_STDLIB_H 1 +#ifndef CPPUNIT_HAVE_STDLIB_H +#define CPPUNIT_HAVE_STDLIB_H 1 #endif /* Define to 1 if you have the header file. */ -#ifndef CPPUNIT_HAVE_STRINGS_H -#define CPPUNIT_HAVE_STRINGS_H 1 +#ifndef CPPUNIT_HAVE_STRINGS_H +#define CPPUNIT_HAVE_STRINGS_H 1 #endif /* Define to 1 if you have the header file. */ -#ifndef CPPUNIT_HAVE_STRING_H -#define CPPUNIT_HAVE_STRING_H 1 +#ifndef CPPUNIT_HAVE_STRING_H +#define CPPUNIT_HAVE_STRING_H 1 #endif /* Define to 1 if you have the header file. */ -#ifndef CPPUNIT_HAVE_STRSTREAM -#define CPPUNIT_HAVE_STRSTREAM 1 +#ifndef CPPUNIT_HAVE_STRSTREAM +#define CPPUNIT_HAVE_STRSTREAM 1 #endif /* Define to 1 if you have the header file. */ -#ifndef CPPUNIT_HAVE_SYS_STAT_H -#define CPPUNIT_HAVE_SYS_STAT_H 1 +#ifndef CPPUNIT_HAVE_SYS_STAT_H +#define CPPUNIT_HAVE_SYS_STAT_H 1 #endif /* Define to 1 if you have the header file. */ -#ifndef CPPUNIT_HAVE_SYS_TYPES_H -#define CPPUNIT_HAVE_SYS_TYPES_H 1 +#ifndef CPPUNIT_HAVE_SYS_TYPES_H +#define CPPUNIT_HAVE_SYS_TYPES_H 1 #endif /* Define to 1 if you have the header file. */ -#ifndef CPPUNIT_HAVE_UNISTD_H -#define CPPUNIT_HAVE_UNISTD_H 1 +#ifndef CPPUNIT_HAVE_UNISTD_H +#define CPPUNIT_HAVE_UNISTD_H 1 #endif /* Name of package */ -#ifndef CPPUNIT_PACKAGE -#define CPPUNIT_PACKAGE "cppunit" +#ifndef CPPUNIT_PACKAGE +#define CPPUNIT_PACKAGE "cppunit" #endif /* Define to the address where bug reports for this package should be sent. */ -#ifndef CPPUNIT_PACKAGE_BUGREPORT -#define CPPUNIT_PACKAGE_BUGREPORT "" +#ifndef CPPUNIT_PACKAGE_BUGREPORT +#define CPPUNIT_PACKAGE_BUGREPORT "" #endif /* Define to the full name of this package. */ -#ifndef CPPUNIT_PACKAGE_NAME -#define CPPUNIT_PACKAGE_NAME "" +#ifndef CPPUNIT_PACKAGE_NAME +#define CPPUNIT_PACKAGE_NAME "" #endif /* Define to the full name and version of this package. */ -#ifndef CPPUNIT_PACKAGE_STRING -#define CPPUNIT_PACKAGE_STRING "" +#ifndef CPPUNIT_PACKAGE_STRING +#define CPPUNIT_PACKAGE_STRING "" #endif /* Define to the one symbol short name of this package. */ -#ifndef CPPUNIT_PACKAGE_TARNAME -#define CPPUNIT_PACKAGE_TARNAME "" +#ifndef CPPUNIT_PACKAGE_TARNAME +#define CPPUNIT_PACKAGE_TARNAME "" #endif /* Define to the version of this package. */ -#ifndef CPPUNIT_PACKAGE_VERSION -#define CPPUNIT_PACKAGE_VERSION "" +#ifndef CPPUNIT_PACKAGE_VERSION +#define CPPUNIT_PACKAGE_VERSION "" #endif /* Define to 1 if you have the ANSI C header files. */ -#ifndef CPPUNIT_STDC_HEADERS -#define CPPUNIT_STDC_HEADERS 1 +#ifndef CPPUNIT_STDC_HEADERS +#define CPPUNIT_STDC_HEADERS 1 #endif /* Define to 1 to use type_info::name() for class names */ -#ifndef CPPUNIT_USE_TYPEINFO_NAME -#define CPPUNIT_USE_TYPEINFO_NAME CPPUNIT_HAVE_RTTI +#ifndef CPPUNIT_USE_TYPEINFO_NAME +#define CPPUNIT_USE_TYPEINFO_NAME CPPUNIT_HAVE_RTTI #endif /* Version number of package */ -#ifndef CPPUNIT_VERSION -#define CPPUNIT_VERSION "1.12.1" +#ifndef CPPUNIT_VERSION +#define CPPUNIT_VERSION "1.12.1" #endif - + /* _INCLUDE_CPPUNIT_CONFIG_AUTO_H */ #endif diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/config/CppUnitApi.h b/dependencies-external/cppunit-1.12.1/include/cppunit/config/CppUnitApi.h index a068bbd543..991b2bca5b 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/config/CppUnitApi.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/config/CppUnitApi.h @@ -29,5 +29,5 @@ #define CPPUNIT_NEED_DLL_DECL 0 #endif - + #endif // CPPUNIT_CONFIG_CPPUNITAPI diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/config/SelectDllLoader.h b/dependencies-external/cppunit-1.12.1/include/cppunit/config/SelectDllLoader.h index dc1c011558..96c9eec53e 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/config/SelectDllLoader.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/config/SelectDllLoader.h @@ -10,14 +10,14 @@ /*! * \def CPPUNIT_NO_TESTPLUGIN * \brief If defined, then plug-in related classes and functions will not be compiled. - * + * * \internal * CPPUNIT_HAVE_WIN32_DLL_LOADER * If defined, Win32 implementation of DynamicLibraryManager will be used. - * + * * CPPUNIT_HAVE_BEOS_DLL_LOADER * If defined, BeOs implementation of DynamicLibraryManager will be used. - * + * * CPPUNIT_HAVE_UNIX_DLL_LOADER * If defined, Unix implementation (dlfcn.h) of DynamicLibraryManager will be used. */ @@ -27,7 +27,7 @@ * \ingroup WritingTestPlugIn * \brief A macro to export a function from a dynamic library * - * This macro export the C function following it from a dynamic library. + * This macro export the C function following it from a dynamic library. * Exporting the function makes it accessible to the DynamicLibraryManager. * * Example of usage: diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/config/config-bcb5.h b/dependencies-external/cppunit-1.12.1/include/cppunit/config/config-bcb5.h index d491452062..bbff4cfed3 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/config/config-bcb5.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/config/config-bcb5.h @@ -2,46 +2,46 @@ #define _INCLUDE_CPPUNIT_CONFIG_BCB5_H 1 #define HAVE_CMATH 1 - -/* include/cppunit/config-bcb5.h. Manually adapted from + +/* include/cppunit/config-bcb5.h. Manually adapted from include/cppunit/config-auto.h */ /* define to 1 if the compiler implements namespaces */ -#ifndef CPPUNIT_HAVE_NAMESPACES -#define CPPUNIT_HAVE_NAMESPACES 1 +#ifndef CPPUNIT_HAVE_NAMESPACES +#define CPPUNIT_HAVE_NAMESPACES 1 #endif /* define if library uses std::string::compare(string,pos,n) */ -#ifndef CPPUNIT_FUNC_STRING_COMPARE_STRING_FIRST +#ifndef CPPUNIT_FUNC_STRING_COMPARE_STRING_FIRST #define CPPUNIT_FUNC_STRING_COMPARE_STRING_FIRST 0 #endif /* Define if you have the header file. */ -#ifdef CPPUNIT_HAVE_DLFCN_H -#undef CPPUNIT_HAVE_DLFCN_H +#ifdef CPPUNIT_HAVE_DLFCN_H +#undef CPPUNIT_HAVE_DLFCN_H #endif /* define to 1 if the compiler implements namespaces */ -#ifndef CPPUNIT_HAVE_NAMESPACES -#define CPPUNIT_HAVE_NAMESPACES 1 +#ifndef CPPUNIT_HAVE_NAMESPACES +#define CPPUNIT_HAVE_NAMESPACES 1 #endif /* define if the compiler supports Run-Time Type Identification */ -#ifndef CPPUNIT_HAVE_RTTI -#define CPPUNIT_HAVE_RTTI 1 +#ifndef CPPUNIT_HAVE_RTTI +#define CPPUNIT_HAVE_RTTI 1 #endif /* Define to 1 to use type_info::name() for class names */ -#ifndef CPPUNIT_USE_TYPEINFO_NAME -#define CPPUNIT_USE_TYPEINFO_NAME CPPUNIT_HAVE_RTTI +#ifndef CPPUNIT_USE_TYPEINFO_NAME +#define CPPUNIT_USE_TYPEINFO_NAME CPPUNIT_HAVE_RTTI #endif #define CPPUNIT_HAVE_SSTREAM 1 /* Name of package */ -#ifndef CPPUNIT_PACKAGE -#define CPPUNIT_PACKAGE "cppunit" +#ifndef CPPUNIT_PACKAGE +#define CPPUNIT_PACKAGE "cppunit" #endif - + /* _INCLUDE_CPPUNIT_CONFIG_BCB5_H */ #endif diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/config/config-evc4.h b/dependencies-external/cppunit-1.12.1/include/cppunit/config/config-evc4.h index a79169812d..746f988a23 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/config/config-evc4.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/config/config-evc4.h @@ -6,38 +6,38 @@ #endif // _MSC_VER > 1000 #define HAVE_CMATH 1 - -/* include/cppunit/config-msvc6.h. Manually adapted from + +/* include/cppunit/config-msvc6.h. Manually adapted from include/cppunit/config-auto.h */ /* define to 1 if the compiler implements namespaces */ -#ifndef CPPUNIT_HAVE_NAMESPACES -#define CPPUNIT_HAVE_NAMESPACES 1 +#ifndef CPPUNIT_HAVE_NAMESPACES +#define CPPUNIT_HAVE_NAMESPACES 1 #endif /* define if library uses std::string::compare(string,pos,n) */ -#ifdef CPPUNIT_FUNC_STRING_COMPARE_STRING_FIRST +#ifdef CPPUNIT_FUNC_STRING_COMPARE_STRING_FIRST #undef CPPUNIT_FUNC_STRING_COMPARE_STRING_FIRST #endif /* Define if you have the header file. */ -#ifdef CPPUNIT_HAVE_DLFCN_H -#undef CPPUNIT_HAVE_DLFCN_H +#ifdef CPPUNIT_HAVE_DLFCN_H +#undef CPPUNIT_HAVE_DLFCN_H #endif /* define to 1 if the compiler implements namespaces */ -#ifndef CPPUNIT_HAVE_NAMESPACES -#define CPPUNIT_HAVE_NAMESPACES 1 +#ifndef CPPUNIT_HAVE_NAMESPACES +#define CPPUNIT_HAVE_NAMESPACES 1 #endif /* define if the compiler supports Run-Time Type Identification */ -#ifndef CPPUNIT_HAVE_RTTI +#ifndef CPPUNIT_HAVE_RTTI #define CPPUNIT_HAVE_RTTI 0 #endif /* Define to 1 to use type_info::name() for class names */ -#ifndef CPPUNIT_USE_TYPEINFO_NAME -#define CPPUNIT_USE_TYPEINFO_NAME CPPUNIT_HAVE_RTTI +#ifndef CPPUNIT_USE_TYPEINFO_NAME +#define CPPUNIT_USE_TYPEINFO_NAME CPPUNIT_HAVE_RTTI #endif #define CPPUNIT_NO_STREAM 1 @@ -46,8 +46,8 @@ #define CPPUNIT_HAVE_SSTREAM 0 /* Name of package */ -#ifndef CPPUNIT_PACKAGE -#define CPPUNIT_PACKAGE "cppunit" +#ifndef CPPUNIT_PACKAGE +#define CPPUNIT_PACKAGE "cppunit" #endif @@ -62,10 +62,10 @@ /* define to 1 if the compiler has _finite() */ #ifndef CPPUNIT_HAVE__FINITE -#define CPPUNIT_HAVE__FINITE 1 +#define CPPUNIT_HAVE__FINITE 1 #endif -// Uncomment to turn on STL wrapping => use this to test compilation. +// Uncomment to turn on STL wrapping => use this to test compilation. // This will make CppUnit subclass std::vector & co to provide default // parameter. /*#define CPPUNIT_STD_NEED_ALLOCATOR 1 diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/config/config-mac.h b/dependencies-external/cppunit-1.12.1/include/cppunit/config/config-mac.h index 4ace906cf9..7dc0be283d 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/config/config-mac.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/config/config-mac.h @@ -8,50 +8,50 @@ know a suitable preprocessor symbol that will distinguish MacOS X from other MacOS versions. Email us if you know the answer. */ - + /* define if library uses std::string::compare(string,pos,n) */ -#ifdef CPPUNIT_FUNC_STRING_COMPARE_STRING_FIRST +#ifdef CPPUNIT_FUNC_STRING_COMPARE_STRING_FIRST #undef CPPUNIT_FUNC_STRING_COMPARE_STRING_FIRST #endif /* define if the library defines strstream */ -#ifndef CPPUNIT_HAVE_CLASS_STRSTREAM -#define CPPUNIT_HAVE_CLASS_STRSTREAM 1 +#ifndef CPPUNIT_HAVE_CLASS_STRSTREAM +#define CPPUNIT_HAVE_CLASS_STRSTREAM 1 #endif /* Define if you have the header file. */ -#ifdef CPPUNIT_HAVE_CMATH +#ifdef CPPUNIT_HAVE_CMATH #undef CPPUNIT_HAVE_CMATH #endif /* Define if you have the header file. */ -#ifdef CPPUNIT_HAVE_DLFCN_H +#ifdef CPPUNIT_HAVE_DLFCN_H #undef CPPUNIT_HAVE_DLFCN_H #endif /* define to 1 if the compiler implements namespaces */ -#ifndef CPPUNIT_HAVE_NAMESPACES -#define CPPUNIT_HAVE_NAMESPACES 1 +#ifndef CPPUNIT_HAVE_NAMESPACES +#define CPPUNIT_HAVE_NAMESPACES 1 #endif /* define if the compiler supports Run-Time Type Identification */ -#ifndef CPPUNIT_HAVE_RTTI -#define CPPUNIT_HAVE_RTTI 1 +#ifndef CPPUNIT_HAVE_RTTI +#define CPPUNIT_HAVE_RTTI 1 #endif /* define if the compiler has stringstream */ -#ifndef CPPUNIT_HAVE_SSTREAM -#define CPPUNIT_HAVE_SSTREAM 1 +#ifndef CPPUNIT_HAVE_SSTREAM +#define CPPUNIT_HAVE_SSTREAM 1 #endif /* Define if you have the header file. */ -#ifndef CPPUNIT_HAVE_STRSTREAM -#define CPPUNIT_HAVE_STRSTREAM 1 +#ifndef CPPUNIT_HAVE_STRSTREAM +#define CPPUNIT_HAVE_STRSTREAM 1 #endif /* Define to 1 to use type_info::name() for class names */ -#ifndef CPPUNIT_USE_TYPEINFO_NAME -#define CPPUNIT_USE_TYPEINFO_NAME CPPUNIT_HAVE_RTTI +#ifndef CPPUNIT_USE_TYPEINFO_NAME +#define CPPUNIT_USE_TYPEINFO_NAME CPPUNIT_HAVE_RTTI #endif /* _INCLUDE_CPPUNIT_CONFIG_MAC_H */ diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/config/config-msvc6.h b/dependencies-external/cppunit-1.12.1/include/cppunit/config/config-msvc6.h index d6881711ab..cc55485774 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/config/config-msvc6.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/config/config-msvc6.h @@ -6,28 +6,28 @@ #endif // _MSC_VER > 1000 #define HAVE_CMATH 1 - -/* include/cppunit/config-msvc6.h. Manually adapted from + +/* include/cppunit/config-msvc6.h. Manually adapted from include/cppunit/config-auto.h */ /* define to 1 if the compiler implements namespaces */ -#ifndef CPPUNIT_HAVE_NAMESPACES -#define CPPUNIT_HAVE_NAMESPACES 1 +#ifndef CPPUNIT_HAVE_NAMESPACES +#define CPPUNIT_HAVE_NAMESPACES 1 #endif /* define if library uses std::string::compare(string,pos,n) */ -#ifdef CPPUNIT_FUNC_STRING_COMPARE_STRING_FIRST +#ifdef CPPUNIT_FUNC_STRING_COMPARE_STRING_FIRST #undef CPPUNIT_FUNC_STRING_COMPARE_STRING_FIRST #endif /* Define if you have the header file. */ -#ifdef CPPUNIT_HAVE_DLFCN_H -#undef CPPUNIT_HAVE_DLFCN_H +#ifdef CPPUNIT_HAVE_DLFCN_H +#undef CPPUNIT_HAVE_DLFCN_H #endif /* define to 1 if the compiler implements namespaces */ -#ifndef CPPUNIT_HAVE_NAMESPACES -#define CPPUNIT_HAVE_NAMESPACES 1 +#ifndef CPPUNIT_HAVE_NAMESPACES +#define CPPUNIT_HAVE_NAMESPACES 1 #endif /* define if the compiler supports Run-Time Type Identification */ @@ -40,15 +40,15 @@ #endif /* Define to 1 to use type_info::name() for class names */ -#ifndef CPPUNIT_USE_TYPEINFO_NAME -#define CPPUNIT_USE_TYPEINFO_NAME CPPUNIT_HAVE_RTTI +#ifndef CPPUNIT_USE_TYPEINFO_NAME +#define CPPUNIT_USE_TYPEINFO_NAME CPPUNIT_HAVE_RTTI #endif #define CPPUNIT_HAVE_SSTREAM 1 /* Name of package */ -#ifndef CPPUNIT_PACKAGE -#define CPPUNIT_PACKAGE "cppunit" +#ifndef CPPUNIT_PACKAGE +#define CPPUNIT_PACKAGE "cppunit" #endif @@ -66,11 +66,11 @@ /* define to 1 if the compiler has _finite() */ #ifndef CPPUNIT_HAVE__FINITE -#define CPPUNIT_HAVE__FINITE 1 +#define CPPUNIT_HAVE__FINITE 1 #endif -// Uncomment to turn on STL wrapping => use this to test compilation. +// Uncomment to turn on STL wrapping => use this to test compilation. // This will make CppUnit subclass std::vector & co to provide default // parameter. /*#define CPPUNIT_STD_NEED_ALLOCATOR 1 diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/ExceptionTestCaseDecorator.h b/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/ExceptionTestCaseDecorator.h index 9c816addb3..1969c8c082 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/ExceptionTestCaseDecorator.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/ExceptionTestCaseDecorator.h @@ -21,7 +21,7 @@ CPPUNIT_NS_BEGIN * * \code * - * class NetworkErrorTestCaseDecorator : + * class NetworkErrorTestCaseDecorator : * public ExceptionTestCaseDecorator * { * public: @@ -39,7 +39,7 @@ CPPUNIT_NS_BEGIN * }; * \endcode * - */ + */ template class ExceptionTestCaseDecorator : public TestCaseDecorator { @@ -79,8 +79,8 @@ class ExceptionTestCaseDecorator : public TestCaseDecorator #if CPPUNIT_USE_TYPEINFO_NAME throw Exception( Message( "expected exception not thrown", - "Expected exception type: " + - TypeInfoHelper::getClassName( + "Expected exception type: " + + TypeInfoHelper::getClassName( typeid( ExpectedExceptionType ) ) ) ); #else throw Exception( Message("expected exception not thrown") ); diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/HelperMacros.h b/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/HelperMacros.h index 12431e4657..bd5b621c8e 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/HelperMacros.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/HelperMacros.h @@ -42,14 +42,14 @@ * void testSetName(); * }; * \endcode - * + * * The effect of these macros is to define two methods in the * class MyTest. The first method is an auxiliary function * named registerTests that you will not need to call directly. * The second function * \code static CppUnit::TestSuite *suite()\endcode * returns a pointer to the suite of tests defined by the CPPUNIT_TEST() - * macros. + * macros. * * Rather than invoking suite() directly, * the macro CPPUNIT_TEST_SUITE_REGISTRATION() is @@ -62,7 +62,7 @@ * CppUnit::Test* tp = * CppUnit::TestFactoryRegistry::getRegistry().makeTest(); * \endcode - * + * * The test suite macros can even be used with templated test classes. * For example: * @@ -72,7 +72,7 @@ * CPPUNIT_TEST_SUITE( StringTest ); * CPPUNIT_TEST( testAppend ); * CPPUNIT_TEST_SUITE_END(); - * public: + * public: * ... * }; * \endcode @@ -94,7 +94,7 @@ * * \param ATestFixtureType Type of the test case class. This type \b MUST * be derived from TestFixture. - * \see CPPUNIT_TEST_SUB_SUITE, CPPUNIT_TEST, CPPUNIT_TEST_SUITE_END, + * \see CPPUNIT_TEST_SUB_SUITE, CPPUNIT_TEST, CPPUNIT_TEST_SUITE_END, * \see CPPUNIT_TEST_SUITE_REGISTRATION, CPPUNIT_TEST_EXCEPTION, CPPUNIT_TEST_FAIL. */ #define CPPUNIT_TEST_SUITE( ATestFixtureType ) \ @@ -119,7 +119,7 @@ /*! \brief Begin test suite (includes parent suite) - * + * * This macro may only be used in a class whose parent class * defines a test suite using CPPUNIT_TEST_SUITE() or CPPUNIT_TEST_SUB_SUITE(). * @@ -127,7 +127,7 @@ * manner as CPPUNIT_TEST_SUITE(). In addition, the test suite of the * parent is automatically inserted in the test suite being * defined. - * + * * Here is an example: * * \code @@ -184,7 +184,7 @@ /*! \brief End declaration of an abstract test suite. * * Use this macro to indicate that the %TestFixture is abstract. No - * static suite() method will be declared. + * static suite() method will be declared. * * After this macro, member access is set to "private". * @@ -200,7 +200,7 @@ * CPPUNIT_TEST_SUITE_END_ABSTRACT(); * public: * void testInsertText(); - * + * * void setUp() * { * m_document = makeDocument(); @@ -261,7 +261,7 @@ * of test case which fails if the execution last more than a given time limit. * It relies on an imaginary TimeOutTestCaller class which has an interface similar * to TestCaller. - * + * * \code * #define CPPUNITEX_TEST_TIMELIMIT( testMethod, timeLimit ) \ * CPPUNIT_TEST_SUITE_ADD_TEST( (new TimeOutTestCaller( \ @@ -269,7 +269,7 @@ * &TestFixtureType::testMethod, \ * factory.makeFixture(), \ * timeLimit ) ) ) - * + * * class PerformanceTest : CppUnit::TestFixture * { * public: @@ -320,7 +320,7 @@ * \endcode * * \param testMethod Name of the method of the test case to add to the suite. - * \param ExceptionType Type of the exception that must be thrown by the test + * \param ExceptionType Type of the exception that must be thrown by the test * method. * \deprecated Use the assertion macro CPPUNIT_ASSERT_THROW instead. */ @@ -339,7 +339,7 @@ * * \code * CPPUNIT_TEST_FAIL( testAssertFalseFail ); - * + * * void testAssertFalseFail() * { * CPPUNIT_ASSERT( false ); @@ -354,14 +354,14 @@ /*! \brief Adds some custom test cases. * * Use this to add one or more test cases to the fixture suite. The specified - * method is called with a context parameter that can be used to name, + * method is called with a context parameter that can be used to name, * instantiate fixture, and add instantiated test case to the fixture suite. * The specified method must have the following signature: * \code * static void aMethodName( TestSuiteBuilderContextType &context ); * \endcode * - * \c TestSuiteBuilderContextType is typedef to + * \c TestSuiteBuilderContextType is typedef to * TestSuiteBuilderContext declared by CPPUNIT_TEST_SUITE(). * * Here is an example that add two custom tests: @@ -424,14 +424,14 @@ * causes a test suite factory to be inserted in a global registry * of such factories. The registry is available by calling * the static function CppUnit::TestFactoryRegistry::getRegistry(). - * + * * \param ATestFixtureType Type of the test case class. * \warning This macro should be used only once per line of code (the line * number is used to name a hidden static variable). * \see CPPUNIT_TEST_SUITE_NAMED_REGISTRATION * \see CPPUNIT_REGISTRY_ADD_TO_DEFAULT * \see CPPUNIT_REGISTRY_ADD - * \see CPPUNIT_TEST_SUITE, CppUnit::AutoRegisterSuite, + * \see CPPUNIT_TEST_SUITE, CppUnit::AutoRegisterSuite, * CppUnit::TestFactoryRegistry. */ #define CPPUNIT_TEST_SUITE_REGISTRATION( ATestFixtureType ) \ @@ -446,7 +446,7 @@ * causes a test suite factory to be inserted in the global registry * suite of the specified name. The registry is available by calling * the static function CppUnit::TestFactoryRegistry::getRegistry(). - * + * * For the suite name, use a string returned by a static function rather * than a hardcoded string. That way, you can know what are the name of * named registry and you don't risk mistyping the registry name. @@ -454,26 +454,26 @@ * \code * // MySuites.h * namespace MySuites { - * std::string math() { + * std::string math() { * return "Math"; * } * } * * // ComplexNumberTest.cpp * #include "MySuites.h" - * + * * CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ComplexNumberTest, MySuites::math() ); * \endcode * * \param ATestFixtureType Type of the test case class. - * \param suiteName Name of the global registry suite the test suite is + * \param suiteName Name of the global registry suite the test suite is * registered into. * \warning This macro should be used only once per line of code (the line * number is used to name a hidden static variable). * \see CPPUNIT_TEST_SUITE_REGISTRATION * \see CPPUNIT_REGISTRY_ADD_TO_DEFAULT * \see CPPUNIT_REGISTRY_ADD - * \see CPPUNIT_TEST_SUITE, CppUnit::AutoRegisterSuite, + * \see CPPUNIT_TEST_SUITE, CppUnit::AutoRegisterSuite, * CppUnit::TestFactoryRegistry.. */ #define CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ATestFixtureType, suiteName ) \ @@ -490,7 +490,7 @@ * - FloatMath * - FastFloat * - StandardFloat - * + * * You can do this automatically with: * \code * CPPUNIT_REGISTRY_ADD( "FastFloat", "FloatMath" ); diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/Orthodox.h b/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/Orthodox.h index 722125937e..82970ef540 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/Orthodox.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/Orthodox.h @@ -18,13 +18,13 @@ CPPUNIT_NS_BEGIN * safe passage - copy construction * * If operations for each of these are not declared - * the template will not instantiate. If it does + * the template will not instantiate. If it does * instantiate, tests are performed to make sure * that the operations have correct semantics. - * - * Adding an orthodox test to a suite is very - * easy: - * + * + * Adding an orthodox test to a suite is very + * easy: + * * public: Test *suite () { * TestSuite *suiteOfTests = new TestSuite; * suiteOfTests->addTest (new ComplexNumberTest ("testAdd"); @@ -83,7 +83,7 @@ template void Orthodox::runTest () // Exercise a call -template +template ClassUnderTest Orthodox::call (ClassUnderTest object) { return object; diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/RepeatedTest.h b/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/RepeatedTest.h index 390ce4807b..48f0ea6439 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/RepeatedTest.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/RepeatedTest.h @@ -15,13 +15,13 @@ class TestResult; * * Does not assume ownership of the test it decorates */ -class CPPUNIT_API RepeatedTest : public TestDecorator +class CPPUNIT_API RepeatedTest : public TestDecorator { public: - RepeatedTest( Test *test, - int timesRepeat ) : - TestDecorator( test ), - m_timesRepeat(timesRepeat) + RepeatedTest( Test *test, + int timesRepeat ) : + TestDecorator( test ), + m_timesRepeat(timesRepeat) { } diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/TestCaseDecorator.h b/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/TestCaseDecorator.h index 3a15ba9747..ea62b08837 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/TestCaseDecorator.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/TestCaseDecorator.h @@ -14,7 +14,7 @@ CPPUNIT_NS_BEGIN * subclass the decorater and use it to wrap the test class. * * Does not assume ownership of the test it decorates - */ + */ class CPPUNIT_API TestCaseDecorator : public TestCase { public: diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/TestDecorator.h b/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/TestDecorator.h index 59d9a302e5..8e0b428639 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/TestDecorator.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/TestDecorator.h @@ -17,7 +17,7 @@ class TestResult; * subclass the decorater and use it to wrap the test class. * * Does not assume ownership of the test it decorates - */ + */ class CPPUNIT_API TestDecorator : public Test { public: diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/TestFactory.h b/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/TestFactory.h index 214d353490..b7f87c43cb 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/TestFactory.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/TestFactory.h @@ -10,7 +10,7 @@ class Test; /*! \brief Abstract Test factory. */ -class CPPUNIT_API TestFactory +class CPPUNIT_API TestFactory { public: virtual ~TestFactory() {} diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/TestFactoryRegistry.h b/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/TestFactoryRegistry.h index fc8723e400..f38e452cc7 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/TestFactoryRegistry.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/TestFactoryRegistry.h @@ -28,7 +28,7 @@ class TestSuite; * Notes that the registry \b DON'T assumes lifetime control for any registered tests * anymore. * - * The default registry is the registry returned by getRegistry() with the + * The default registry is the registry returned by getRegistry() with the * default name parameter value. * * To register tests, use the macros: @@ -71,7 +71,7 @@ class TestSuite; * CppUnit::TestSuite *suite = registry.makeTest(); * \endcode * - * Since a TestFactoryRegistry is a TestFactory, the named registries can be + * Since a TestFactoryRegistry is a TestFactory, the named registries can be * registered in the unnamed registry, creating the hierarchy links. * * \see TestSuiteFactory, AutoRegisterSuite @@ -90,7 +90,7 @@ class CPPUNIT_API TestFactoryRegistry : public TestFactory virtual ~TestFactoryRegistry(); /** Returns a new TestSuite that contains the registered test. - * \return A new TestSuite which contains all the test added using + * \return A new TestSuite which contains all the test added using * registerFactory(TestFactory *). */ virtual Test *makeTest(); @@ -113,12 +113,12 @@ class CPPUNIT_API TestFactoryRegistry : public TestFactory /** Adds the specified TestFactory to the registry. * - * \param factory Factory to register. + * \param factory Factory to register. */ void registerFactory( TestFactory *factory ); /*! Removes the specified TestFactory from the registry. - * + * * The specified factory is not destroyed. * \param factory Factory to remove from the registry. * \todo Address case when trying to remove a TestRegistryFactory. @@ -126,7 +126,7 @@ class CPPUNIT_API TestFactoryRegistry : public TestFactory void unregisterFactory( TestFactory *factory ); /*! Adds a registry to the registry. - * + * * Convenience method to help create test hierarchy. See TestFactoryRegistry detail * for examples of use. Calling this method is equivalent to: * \code @@ -139,14 +139,14 @@ class CPPUNIT_API TestFactoryRegistry : public TestFactory /*! Tests if the registry is valid. * - * This method should be used when unregistering test factory on static variable - * destruction to ensure that the registry has not been already destroyed (in + * This method should be used when unregistering test factory on static variable + * destruction to ensure that the registry has not been already destroyed (in * that case there is no need to unregister the test factory). * * You should not concern yourself with this method unless you are writing a class * like AutoRegisterSuite. * - * \return \c true if the specified registry has not been destroyed, + * \return \c true if the specified registry has not been destroyed, * otherwise returns \c false. * \see AutoRegisterSuite. */ @@ -154,7 +154,7 @@ class CPPUNIT_API TestFactoryRegistry : public TestFactory /** Adds the specified TestFactory with a specific name (DEPRECATED). * \param name Name associated to the factory. - * \param factory Factory to register. + * \param factory Factory to register. * \deprecated Use registerFactory( TestFactory *) instead. */ void registerFactory( const std::string &name, diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/TestFixtureFactory.h b/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/TestFixtureFactory.h index 45354c62be..a96ff15ae1 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/TestFixtureFactory.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/TestFixtureFactory.h @@ -32,8 +32,8 @@ class ConcretTestFixtureFactory : public CPPUNIT_NS::TestFixtureFactory { /*! \brief Returns a new TestFixture instance. * \return A new fixture instance. The fixture instance is returned by - * the TestFixtureFactory passed on construction. The actual type - * is that of the fixture on which the static method suite() + * the TestFixtureFactory passed on construction. The actual type + * is that of the fixture on which the static method suite() * was called. */ TestFixture *makeFixture() diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/TestNamer.h b/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/TestNamer.h index 5a6471c0c3..8191a11638 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/TestNamer.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/TestNamer.h @@ -19,7 +19,7 @@ * RTTI is used if CPPUNIT_USE_TYPEINFO_NAME is defined and not null. * * \code - * void someMethod() + * void someMethod() * { * CPPUNIT_TESTNAMER_DECL( namer, AFixtureType ); * std::string fixtureName = namer.getFixtureName(); @@ -71,8 +71,8 @@ class CPPUNIT_API TestNamer /*! \brief Returns the name of the test for the specified method. * \param testMethodName Name of the method that implements a test. - * \return A string that is the concatenation of the test fixture name - * (returned by getFixtureName()) and\a testMethodName, + * \return A string that is the concatenation of the test fixture name + * (returned by getFixtureName()) and\a testMethodName, * separated using '::'. This provides a fairly unique name for a given * test. */ diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/TestSetUp.h b/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/TestSetUp.h index f2128ecd74..4425ca3413 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/TestSetUp.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/TestSetUp.h @@ -11,7 +11,7 @@ class TestResult; /*! \brief Decorates a test by providing a specific setUp() and tearDown(). */ -class CPPUNIT_API TestSetUp : public TestDecorator +class CPPUNIT_API TestSetUp : public TestDecorator { public: TestSetUp( Test *test ); diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/TestSuiteBuilderContext.h b/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/TestSuiteBuilderContext.h index db26926cd4..99b74eaae5 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/TestSuiteBuilderContext.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/extensions/TestSuiteBuilderContext.h @@ -23,7 +23,7 @@ class TestNamer; * Base class for all context used when creating test suite. The * actual context type during test suite creation is TestSuiteBuilderContext. * - * \sa CPPUNIT_TEST_SUITE, CPPUNIT_TEST_SUITE_ADD_TEST, + * \sa CPPUNIT_TEST_SUITE, CPPUNIT_TEST_SUITE_ADD_TEST, * CPPUNIT_TEST_SUITE_ADD_CUSTOM_TESTS. */ class CPPUNIT_API TestSuiteBuilderContextBase @@ -31,7 +31,7 @@ class CPPUNIT_API TestSuiteBuilderContextBase public: /*! \brief Constructs a new context. * - * You should not use this. The context is created in + * You should not use this. The context is created in * CPPUNIT_TEST_SUITE(). */ TestSuiteBuilderContextBase( TestSuite &suite, @@ -55,8 +55,8 @@ class CPPUNIT_API TestSuiteBuilderContextBase /*! \brief Returns the name of the test for the specified method. * * \param testMethodName Name of the method that implements a test. - * \return A string that is the concatenation of the test fixture name - * (returned by getFixtureName()) and\a testMethodName, + * \return A string that is the concatenation of the test fixture name + * (returned by getFixtureName()) and\a testMethodName, * separated using '::'. This provides a fairly unique name for a given * test. */ @@ -66,9 +66,9 @@ class CPPUNIT_API TestSuiteBuilderContextBase * \param key PropertyKey string to add. * \param value PropertyValue string to add. */ - void addProperty( const std::string &key, + void addProperty( const std::string &key, const std::string &value ); - + /*! \brief Returns property value assigned to param key. * \param key PropertyKey string. */ @@ -93,7 +93,7 @@ class CPPUNIT_API TestSuiteBuilderContextBase /*! \brief Type-sage context used when creating test suite in HelperMacros. - * + * * \sa TestSuiteBuilderContextBase. */ template @@ -109,13 +109,13 @@ class TestSuiteBuilderContext : public TestSuiteBuilderContextBase /*! \brief Returns a new TestFixture instance. * \return A new fixture instance. The fixture instance is returned by - * the TestFixtureFactory passed on construction. The actual type - * is that of the fixture on which the static method suite() + * the TestFixtureFactory passed on construction. The actual type + * is that of the fixture on which the static method suite() * was called. */ FixtureType *makeFixture() const { - return CPPUNIT_STATIC_CAST( FixtureType *, + return CPPUNIT_STATIC_CAST( FixtureType *, TestSuiteBuilderContextBase::makeTestFixture() ); } }; diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/plugin/DynamicLibraryManager.h b/dependencies-external/cppunit-1.12.1/include/cppunit/plugin/DynamicLibraryManager.h index d70ccde462..42ee3be90a 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/plugin/DynamicLibraryManager.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/plugin/DynamicLibraryManager.h @@ -17,7 +17,7 @@ CPPUNIT_NS_BEGIN * * If an error occurs, a DynamicLibraryManagerException is thrown. * - * \internal Implementation of the OS independent methods is in + * \internal Implementation of the OS independent methods is in * DynamicLibraryManager.cpp. * * \internal Porting to a new platform: @@ -27,7 +27,7 @@ CPPUNIT_NS_BEGIN * - Makes a copy of UnixDynamicLibraryManager.cpp and named it after the platform. * - Updated the 'guard' in your file (CPPUNIT_HAVE_XYZ_DLL_LOADER) so that it is * only processed if the matching platform has been detected. - * - Change the implementation of methods doLoadLibrary(), doReleaseLibrary(), + * - Change the implementation of methods doLoadLibrary(), doReleaseLibrary(), * doFindSymbol() in your copy. Those methods usually maps directly to OS calls. * - Adds the file to the project. */ @@ -63,13 +63,13 @@ class DynamicLibraryManager void loadLibrary( const std::string &libraryName ); /*! Releases the loaded library. - * + * * \warning Must NOT throw any exceptions (called from destructor). */ void releaseLibrary(); /*! Loads the specified library. - * + * * May throw any exceptions (indicates failure). * \param libraryName Name of the library to load. * \return Handle of the loaded library. \c NULL indicates failure. @@ -85,7 +85,7 @@ class DynamicLibraryManager void doReleaseLibrary(); /*! Returns a pointer on the specified symbol exported by the library. - * + * * May throw any exceptions (indicates failure). * \param symbol Name of the symbol exported by the library. * \return Pointer on the symbol. \c NULL indicates failure. diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/plugin/PlugInManager.h b/dependencies-external/cppunit-1.12.1/include/cppunit/plugin/PlugInManager.h index 6ecedc89b5..01aa50541b 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/plugin/PlugInManager.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/plugin/PlugInManager.h @@ -68,7 +68,7 @@ class CPPUNIT_API PlugInManager void addXmlOutputterHooks( XmlOutputter *outputter ); /*! \brief Called when the XmlOutputter is destroyed. - * + * * Can be used to free some resources allocated by addXmlOutputterHooks(). */ void removeXmlOutputterHooks(); diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/plugin/TestPlugIn.h b/dependencies-external/cppunit-1.12.1/include/cppunit/plugin/TestPlugIn.h index 1c9b929a5f..76c0b77e4a 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/plugin/TestPlugIn.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/plugin/TestPlugIn.h @@ -27,7 +27,7 @@ CPPUNIT_NS_END * This class define the interface implemented by test plug-in. A pointer to that * interface is returned by the function exported by the test plug-in. * - * Plug-in are loaded/unloaded by PlugInManager. When a plug-in is loaded, + * Plug-in are loaded/unloaded by PlugInManager. When a plug-in is loaded, * initialize() is called. Before unloading the plug-in, the PlugInManager * call uninitialize(). * @@ -42,7 +42,7 @@ CPPUNIT_NS_END */ struct CppUnitTestPlugIn { - /*! \brief Called just after loading the dynamic library. + /*! \brief Called just after loading the dynamic library. * * Override this method to add additional suite to the registry, though this * is preferably done using the macros (CPPUNIT_TEST_SUITE_REGISTRATION...). @@ -59,10 +59,10 @@ struct CppUnitTestPlugIn const CPPUNIT_NS::PlugInParameters ¶meters ) =0; /*! \brief Gives a chance to the plug-in to register TestListener. - * + * * Override this method to add a TestListener for the test run. This is useful * if you are writing a custom TestListener, but also if you need to - * setUp some global resource: listen to TestListener::startTestRun(), + * setUp some global resource: listen to TestListener::startTestRun(), * and TestListener::endTestRun(). */ virtual void addListener( CPPUNIT_NS::TestResult *eventManager ) =0; @@ -78,17 +78,17 @@ struct CppUnitTestPlugIn virtual void addXmlOutputterHooks( CPPUNIT_NS::XmlOutputter *outputter ) =0; /*! \brief Called when the XmlOutputter is destroyed. - * + * * Can be used to free some resources allocated by addXmlOutputterHooks(). */ virtual void removeXmlOutputterHooks() = 0; /*! \brief Called just before unloading the dynamic library. - * + * * Override this method to unregister test factory added in initialize(). * This is necessary to keep the TestFactoryRegistry 'clean'. When * the plug-in is unloaded from memory, the TestFactoryRegistry will hold - * reference on test that are no longer available if they are not + * reference on test that are no longer available if they are not * unregistered. */ virtual void uninitialize( CPPUNIT_NS::TestFactoryRegistry *registry ) =0; @@ -134,14 +134,14 @@ typedef CppUnitTestPlugIn *(*TestPlugInSignature)(); * \brief Implements the 'main' function for the plug-in. * * This macros implements the main() function for dynamic library. - * For example, WIN32 requires a DllMain function, while some Unix + * For example, WIN32 requires a DllMain function, while some Unix * requires a main() function. This macros takes care of the implementation. */ // Win32 #if defined(CPPUNIT_HAVE_WIN32_DLL_LOADER) #if !defined(APIENTRY) -#define WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN #define NOGDI #define NOUSER #define NOKERNEL @@ -178,12 +178,12 @@ typedef CppUnitTestPlugIn *(*TestPlugInSignature)(); /*! \brief Implements and exports the test plug-in interface. * \ingroup WritingTestPlugIn * - * This macro exports the test plug-in function using the subclass, - * and implements the 'main' function for the plug-in using + * This macro exports the test plug-in function using the subclass, + * and implements the 'main' function for the plug-in using * CPPUNIT_PLUGIN_IMPLEMENT_MAIN(). * * When using this macro, CppUnit must be linked as a DLL (shared library). - * Otherwise, tests registered to the TestFactoryRegistry in the DLL will + * Otherwise, tests registered to the TestFactoryRegistry in the DLL will * not be visible to the DllPlugInTester. * * \see CppUnitTestPlugIn diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/plugin/TestPlugInDefaultImpl.h b/dependencies-external/cppunit-1.12.1/include/cppunit/plugin/TestPlugInDefaultImpl.h index fa4b8078f9..7c67804390 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/plugin/TestPlugInDefaultImpl.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/plugin/TestPlugInDefaultImpl.h @@ -19,7 +19,7 @@ class TestSuite; * Override getSuiteName() to specify the suite name. Default is "All Tests". * * CppUnitTestPlugIn::getTestSuite() returns a suite that contains - * all the test registered to the default test factory registry + * all the test registered to the default test factory registry * ( TestFactoryRegistry::getRegistry() ). * */ diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/portability/CppUnitDeque.h b/dependencies-external/cppunit-1.12.1/include/cppunit/portability/CppUnitDeque.h index bbab21f56c..62e1e358b1 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/portability/CppUnitDeque.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/portability/CppUnitDeque.h @@ -2,7 +2,7 @@ #define CPPUNIT_PORTABILITY_CPPUNITDEQUE_H // The technic used is similar to the wrapper of STLPort. - + #include #include diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/portability/CppUnitMap.h b/dependencies-external/cppunit-1.12.1/include/cppunit/portability/CppUnitMap.h index 0cdc723a20..526bc4c451 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/portability/CppUnitMap.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/portability/CppUnitMap.h @@ -2,7 +2,7 @@ #define CPPUNIT_PORTABILITY_CPPUNITMAP_H // The technic used is similar to the wrapper of STLPort. - + #include #include #include diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/portability/CppUnitSet.h b/dependencies-external/cppunit-1.12.1/include/cppunit/portability/CppUnitSet.h index 18b8662ebf..73ed0b927b 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/portability/CppUnitSet.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/portability/CppUnitSet.h @@ -2,7 +2,7 @@ #define CPPUNIT_PORTABILITY_CPPUNITSET_H // The technic used is similar to the wrapper of STLPort. - + #include #include #include diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/portability/CppUnitStack.h b/dependencies-external/cppunit-1.12.1/include/cppunit/portability/CppUnitStack.h index bc7785b037..1f6e5077e4 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/portability/CppUnitStack.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/portability/CppUnitStack.h @@ -2,7 +2,7 @@ #define CPPUNIT_PORTABILITY_CPPUNITSTACK_H // The technic used is similar to the wrapper of STLPort. - + #include #include #include diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/portability/CppUnitVector.h b/dependencies-external/cppunit-1.12.1/include/cppunit/portability/CppUnitVector.h index 6666a63b0d..b5bcde8d5c 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/portability/CppUnitVector.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/portability/CppUnitVector.h @@ -2,7 +2,7 @@ #define CPPUNIT_PORTABILITY_CPPUNITVECTOR_H // The technic used is similar to the wrapper of STLPort. - + #include #include diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/portability/FloatingPoint.h b/dependencies-external/cppunit-1.12.1/include/cppunit/portability/FloatingPoint.h index e8c91b3f5c..791aad5e6e 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/portability/FloatingPoint.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/portability/FloatingPoint.h @@ -7,9 +7,9 @@ CPPUNIT_NS_BEGIN /// \brief Tests if a floating-point is a NaN. -// According to IEEE-754 floating point standard, +// According to IEEE-754 floating point standard, // (see e.g. page 8 of -// http://www.cs.berkeley.edu/~wkahan/ieee754status/ieee754.ps) +// http://www.cs.berkeley.edu/~wkahan/ieee754status/ieee754.ps) // all comparisons with NaN are false except "x != x", which is true. // // At least Microsoft Visual Studio 6 is known not to implement this test correctly. @@ -18,7 +18,7 @@ CPPUNIT_NS_BEGIN // fnstsw ax // copie fp (floating-point) status register to ax // test ah,40h // test bit 14 of ax (0x4000) => C3 of fp status register // According to the following documentation on the x86 floating point status register, -// the C2 bit should be tested to test for NaN value. +// the C2 bit should be tested to test for NaN value. // http://webster.cs.ucr.edu/AoA/Windows/HTML/RealArithmetic.html#1000117 // In Microsoft Visual Studio 2003 & 2005, the test is implemented with: // test ah,44h // Visual Studio 2005 test both C2 & C3... diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/portability/Stream.h b/dependencies-external/cppunit-1.12.1/include/cppunit/portability/Stream.h index e9beb8c1b2..866483cbc1 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/portability/Stream.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/portability/Stream.h @@ -68,7 +68,7 @@ class FileStreamBuffer : public StreamBuffer fwrite( text, sizeof(char), length, file_ ); } - void flush() + void flush() { if ( file_ ) fflush( file_ ); @@ -265,13 +265,13 @@ class OFileStream : public OStream bool ownFile_; }; -inline OStream &stdCOut() +inline OStream &stdCOut() { static OFileStream stream( stdout ); return stream; } -inline OStream &stdCErr() +inline OStream &stdCErr() { static OFileStream stream( stderr ); return stream; @@ -299,7 +299,7 @@ CPPUNIT_NS_END CPPUNIT_NS_BEGIN - class OStringStream : public std::ostrstream + class OStringStream : public std::ostrstream { public: std::string str() @@ -329,18 +329,18 @@ CPPUNIT_NS_END typedef std::ostream OStream; - inline OStream &stdCOut() + inline OStream &stdCOut() { return std::cout; } - inline OStream &stdCErr() + inline OStream &stdCErr() { return std::cerr; } CPPUNIT_NS_END - + #endif // #if !defined( CPPUNIT_NO_STREAM ) #endif // CPPUNIT_PORTABILITY_STREAM_H_INCLUDED diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/tools/Algorithm.h b/dependencies-external/cppunit-1.12.1/include/cppunit/tools/Algorithm.h index e5746a2bf5..1342b6a28f 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/tools/Algorithm.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/tools/Algorithm.h @@ -7,7 +7,7 @@ CPPUNIT_NS_BEGIN template void -removeFromSequence( SequenceType &sequence, +removeFromSequence( SequenceType &sequence, const ValueType &valueToRemove ) { for ( unsigned int index =0; index < sequence.size(); ++index ) diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/tools/StringTools.h b/dependencies-external/cppunit-1.12.1/include/cppunit/tools/StringTools.h index 7a6b6d710d..d5b93a6fde 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/tools/StringTools.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/tools/StringTools.h @@ -20,7 +20,7 @@ struct StringTools static std::string CPPUNIT_API toString( double value ); - static Strings CPPUNIT_API split( const std::string &text, + static Strings CPPUNIT_API split( const std::string &text, char separator ); static std::string CPPUNIT_API wrap( const std::string &text, diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/tools/XmlDocument.h b/dependencies-external/cppunit-1.12.1/include/cppunit/tools/XmlDocument.h index 4ee73257ad..bc02f60d0c 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/tools/XmlDocument.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/tools/XmlDocument.h @@ -28,7 +28,7 @@ class CPPUNIT_API XmlDocument { public: /*! \brief Constructs a XmlDocument object. - * \param encoding Encoding used in the XML file (default is Latin-1, ISO-8859-1 ). + * \param encoding Encoding used in the XML file (default is Latin-1, ISO-8859-1 ). * \param styleSheet Name of the XSL style sheet file used. If empty then no * style sheet will be specified in the output. */ @@ -40,7 +40,7 @@ class CPPUNIT_API XmlDocument std::string encoding() const; void setEncoding( const std::string &encoding = "" ); - + std::string styleSheet() const; void setStyleSheet( const std::string &styleSheet = "" ); @@ -55,7 +55,7 @@ class CPPUNIT_API XmlDocument * if false, it will be not. */ void setStandalone( bool standalone ); - + void setRootElement( XmlElement *rootElement ); XmlElement &rootElement() const; diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/tools/XmlElement.h b/dependencies-external/cppunit-1.12.1/include/cppunit/tools/XmlElement.h index 0b36bd2388..e6f03dd611 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/tools/XmlElement.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/tools/XmlElement.h @@ -23,7 +23,7 @@ class XmlElement; /*! \brief A XML Element. - * + * * A XML element has: * - a name, specified on construction, * - a content, specified on construction (may be empty), diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/ui/mfc/MfcTestRunner.h b/dependencies-external/cppunit-1.12.1/include/cppunit/ui/mfc/MfcTestRunner.h index 6a5f7b770f..d41bebdf4a 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/ui/mfc/MfcTestRunner.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/ui/mfc/MfcTestRunner.h @@ -10,7 +10,7 @@ /* Refer to MSDN documentation to know how to write and use MFC extension DLL: mk:@MSITStore:h:\DevStudio\MSDN\98VSa\1036\vcmfc.chm::/html/_mfcnotes_tn033.htm#_mfcnotes_how_to_write_an_mfc_extension_dll - + This can be found in the index with "mfc extension" The basic: Using: @@ -38,13 +38,13 @@ CPPUNIT_NS_BEGIN * #include * #include * - * void + * void * CHostAppApp::RunUnitTests() * { * CppUnit::MfcTestRunner runner; * runner.addTest( CppUnit::TestFactoryRegistry::getRegistry().makeTest() ); * - * runner.run(); + * runner.run(); * } * \endcode * \see CppUnit::TextTestRunner, CppUnit::TestFactoryRegistry. diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/ui/qt/QtTestRunner.h b/dependencies-external/cppunit-1.12.1/include/cppunit/ui/qt/QtTestRunner.h index 4b6ab4e4ef..c3bbae33ec 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/ui/qt/QtTestRunner.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/ui/qt/QtTestRunner.h @@ -16,7 +16,7 @@ CPPUNIT_NS_BEGIN class TestSuite; -/*! +/*! * \brief QT test runner. * \ingroup ExecutingTest * @@ -27,7 +27,7 @@ CPPUNIT_NS_BEGIN * * [...] * - * void + * void * QDepWindow::runTests() * { * CppUnit::QtUi::TestRunner runner; diff --git a/dependencies-external/cppunit-1.12.1/include/cppunit/ui/text/TextTestRunner.h b/dependencies-external/cppunit-1.12.1/include/cppunit/ui/text/TextTestRunner.h index 86da4d4b30..c8f78943c8 100644 --- a/dependencies-external/cppunit-1.12.1/include/cppunit/ui/text/TextTestRunner.h +++ b/dependencies-external/cppunit-1.12.1/include/cppunit/ui/text/TextTestRunner.h @@ -25,7 +25,7 @@ class TestResultCollector; * * The test runner manage the life cycle of the added tests. * - * The test runner can run only one of the added tests or all the tests. + * The test runner can run only one of the added tests or all the tests. * * TestRunner prints out a trace as the tests are executed followed by a * summary at the end. The trace and summary print are optional. @@ -39,10 +39,10 @@ class TestResultCollector; * \endcode * * The trace is printed using a TextTestProgressListener. The summary is printed - * using a TextOutputter. + * using a TextOutputter. * * You can specify an alternate Outputter at construction - * or later with setOutputter(). + * or later with setOutputter(). * * After construction, you can register additional TestListener to eventManager(), * for a custom progress trace, for example. @@ -50,7 +50,7 @@ class TestResultCollector; * \code * CppUnit::TextTestRunner runner; * runner.addTest( ExampleTestCase::suite() ); - * runner.setOutputter( CppUnit::CompilerOutputter::defaultOutputter( + * runner.setOutputter( CppUnit::CompilerOutputter::defaultOutputter( * &runner.result(), * std::cerr ) ); * MyCustomProgressTestListener progress; diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/Asserter.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/Asserter.cpp index a9cf95cb4a..24c78da779 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/Asserter.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/Asserter.cpp @@ -6,25 +6,25 @@ CPPUNIT_NS_BEGIN -void -Asserter::fail( std::string message, +void +Asserter::fail( std::string message, const SourceLine &sourceLine ) { fail( Message( "assertion failed", message ), sourceLine ); } -void -Asserter::fail( const Message &message, +void +Asserter::fail( const Message &message, const SourceLine &sourceLine ) { throw Exception( message, sourceLine ); } -void -Asserter::failIf( bool shouldFail, - const Message &message, +void +Asserter::failIf( bool shouldFail, + const Message &message, const SourceLine &sourceLine ) { if ( shouldFail ) @@ -32,30 +32,30 @@ Asserter::failIf( bool shouldFail, } -void -Asserter::failIf( bool shouldFail, - std::string message, +void +Asserter::failIf( bool shouldFail, + std::string message, const SourceLine &sourceLine ) { failIf( shouldFail, Message( "assertion failed", message ), sourceLine ); } -std::string +std::string Asserter::makeExpected( const std::string &expectedValue ) { return "Expected: " + expectedValue; } -std::string +std::string Asserter::makeActual( const std::string &actualValue ) { return "Actual : " + actualValue; } -Message +Message Asserter::makeNotEqualMessage( const std::string &expectedValue, const std::string &actualValue, const AdditionalMessage &additionalMessage, @@ -70,9 +70,9 @@ Asserter::makeNotEqualMessage( const std::string &expectedValue, } -void -Asserter::failNotEqual( std::string expected, - std::string actual, +void +Asserter::failNotEqual( std::string expected, + std::string actual, const SourceLine &sourceLine, const AdditionalMessage &additionalMessage, std::string shortDescription ) @@ -80,15 +80,15 @@ Asserter::failNotEqual( std::string expected, fail( makeNotEqualMessage( expected, actual, additionalMessage, - shortDescription ), + shortDescription ), sourceLine ); } -void +void Asserter::failNotEqualIf( bool shouldFail, - std::string expected, - std::string actual, + std::string expected, + std::string actual, const SourceLine &sourceLine, const AdditionalMessage &additionalMessage, std::string shortDescription ) diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/BeOsDynamicLibraryManager.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/BeOsDynamicLibraryManager.cpp index b8568be0ce..5373082072 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/BeOsDynamicLibraryManager.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/BeOsDynamicLibraryManager.cpp @@ -9,34 +9,34 @@ CPPUNIT_NS_BEGIN -DynamicLibraryManager::LibraryHandle +DynamicLibraryManager::LibraryHandle DynamicLibraryManager::doLoadLibrary( const std::string &libraryName ) { return (LibraryHandle)::load_add_on( libraryName.c_str() ); } -void +void DynamicLibraryManager::doReleaseLibrary() { ::unload_add_on( (image_id)m_libraryHandle ); } -DynamicLibraryManager::Symbol +DynamicLibraryManager::Symbol DynamicLibraryManager::doFindSymbol( const std::string &symbol ) { void *symbolPointer; - if ( ::get_image_symbol( (image_id)m_libraryHandle, - symbol.c_str(), - B_SYMBOL_TYPE_TEXT, + if ( ::get_image_symbol( (image_id)m_libraryHandle, + symbol.c_str(), + B_SYMBOL_TYPE_TEXT, &symbolPointer ) == B_OK ) return symnolPointer; return NULL; } -std::string +std::string DynamicLibraryManager::getLastErrorDetail() const { return ""; diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/BriefTestProgressListener.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/BriefTestProgressListener.cpp index c38cea067b..9e7269426b 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/BriefTestProgressListener.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/BriefTestProgressListener.cpp @@ -18,7 +18,7 @@ BriefTestProgressListener::~BriefTestProgressListener() } -void +void BriefTestProgressListener::startTest( Test *test ) { stdCOut() << test->getName(); @@ -28,7 +28,7 @@ BriefTestProgressListener::startTest( Test *test ) } -void +void BriefTestProgressListener::addFailure( const TestFailure &failure ) { stdCOut() << " : " << (failure.isError() ? "error" : "assertion"); @@ -36,7 +36,7 @@ BriefTestProgressListener::addFailure( const TestFailure &failure ) } -void +void BriefTestProgressListener::endTest( Test *test ) { if ( !m_lastTestFailed ) diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/CompilerOutputter.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/CompilerOutputter.cpp index 8196a5f87c..990d231077 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/CompilerOutputter.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/CompilerOutputter.cpp @@ -27,7 +27,7 @@ CompilerOutputter::~CompilerOutputter() } -void +void CompilerOutputter::setLocationFormat( const std::string &locationFormat ) { m_locationFormat = locationFormat; @@ -42,7 +42,7 @@ CompilerOutputter::defaultOutputter( TestResultCollector *result, } -void +void CompilerOutputter::write() { if ( m_result->wasSuccessful() ) @@ -52,14 +52,14 @@ CompilerOutputter::write() } -void +void CompilerOutputter::printSuccess() { m_stream << "OK (" << m_result->runTests() << ")\n"; } -void +void CompilerOutputter::printFailureReport() { printFailuresList(); @@ -67,7 +67,7 @@ CompilerOutputter::printFailureReport() } -void +void CompilerOutputter::printFailuresList() { for ( int index =0; index < m_result->testFailuresTotal(); ++index) @@ -77,7 +77,7 @@ CompilerOutputter::printFailuresList() } -void +void CompilerOutputter::printFailureDetail( TestFailure *failure ) { printFailureLocation( failure->sourceLine() ); @@ -86,8 +86,8 @@ CompilerOutputter::printFailureDetail( TestFailure *failure ) printFailureMessage( failure ); } - -void + +void CompilerOutputter::printFailureLocation( SourceLine sourceLine ) { if ( !sourceLine.isValid() ) @@ -115,8 +115,8 @@ CompilerOutputter::printFailureLocation( SourceLine sourceLine ) } -bool -CompilerOutputter::processLocationFormatCommand( char command, +bool +CompilerOutputter::processLocationFormatCommand( char command, const SourceLine &sourceLine ) { switch ( command ) @@ -131,19 +131,19 @@ CompilerOutputter::processLocationFormatCommand( char command, m_stream << extractBaseName( sourceLine.fileName() ); return true; } - + return false; } -std::string +std::string CompilerOutputter::extractBaseName( const std::string &fileName ) const { int indexLastDirectorySeparator = fileName.find_last_of( '/' ); - + if ( indexLastDirectorySeparator < 0 ) indexLastDirectorySeparator = fileName.find_last_of( '\\' ); - + if ( indexLastDirectorySeparator < 0 ) return fileName; @@ -151,21 +151,21 @@ CompilerOutputter::extractBaseName( const std::string &fileName ) const } -void +void CompilerOutputter::printFailureType( TestFailure *failure ) { m_stream << (failure->isError() ? "Error" : "Assertion"); } -void +void CompilerOutputter::printFailedTestName( TestFailure *failure ) { m_stream << "\nTest name: " << failure->failedTestName(); } -void +void CompilerOutputter::printFailureMessage( TestFailure *failure ) { m_stream << "\n"; @@ -180,7 +180,7 @@ CompilerOutputter::printFailureMessage( TestFailure *failure ) } -void +void CompilerOutputter::printStatistics() { m_stream << "Failures !!!\n"; @@ -192,21 +192,21 @@ CompilerOutputter::printStatistics() } -void +void CompilerOutputter::setWrapColumn( int wrapColumn ) { m_wrapColumn = wrapColumn; } -void +void CompilerOutputter::setNoWrap() { m_wrapColumn = 0; } -int +int CompilerOutputter::wrapColumn() const { return m_wrapColumn; diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/DefaultProtector.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/DefaultProtector.cpp index 6fb306b257..6f21be7e3b 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/DefaultProtector.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/DefaultProtector.cpp @@ -6,7 +6,7 @@ CPPUNIT_NS_BEGIN -bool +bool DefaultProtector::protect( const Functor &functor, const ProtectorContext &context ) { @@ -34,7 +34,7 @@ DefaultProtector::protect( const Functor &functor, reportError( context, Message( "uncaught exception of unknown type") ); } - + return false; } diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/DynamicLibraryManager.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/DynamicLibraryManager.cpp index e6f6294553..642e13608d 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/DynamicLibraryManager.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/DynamicLibraryManager.cpp @@ -20,7 +20,7 @@ DynamicLibraryManager::~DynamicLibraryManager() } -DynamicLibraryManager::Symbol +DynamicLibraryManager::Symbol DynamicLibraryManager::findSymbol( const std::string &symbol ) { try @@ -33,7 +33,7 @@ DynamicLibraryManager::findSymbol( const std::string &symbol ) { } - throw DynamicLibraryManagerException( m_libraryName, + throw DynamicLibraryManagerException( m_libraryName, symbol, DynamicLibraryManagerException::symbolNotFound ); return NULL; // keep compiler happy @@ -60,7 +60,7 @@ DynamicLibraryManager::loadLibrary( const std::string &libraryName ) } -void +void DynamicLibraryManager::releaseLibrary() { if ( m_libraryHandle != NULL ) diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/DynamicLibraryManagerException.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/DynamicLibraryManagerException.cpp index 8498652e02..2601ef1fb1 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/DynamicLibraryManagerException.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/DynamicLibraryManagerException.cpp @@ -5,7 +5,7 @@ CPPUNIT_NS_BEGIN -DynamicLibraryManagerException::DynamicLibraryManagerException( +DynamicLibraryManagerException::DynamicLibraryManagerException( const std::string &libraryName, const std::string &errorDetail, Cause cause ) @@ -13,15 +13,15 @@ DynamicLibraryManagerException::DynamicLibraryManagerException( m_cause( cause ) { if ( cause == loadingFailed ) - m_message = "Failed to load dynamic library: " + libraryName + "\n" + + m_message = "Failed to load dynamic library: " + libraryName + "\n" + errorDetail; else - m_message = "Symbol [" + errorDetail + "] not found in dynamic libary:" + + m_message = "Symbol [" + errorDetail + "] not found in dynamic libary:" + libraryName; } -DynamicLibraryManagerException::Cause +DynamicLibraryManagerException::Cause DynamicLibraryManagerException::getCause() const { return m_cause; diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/Exception.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/Exception.cpp index 3bbe24b9b2..f90c60ccf8 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/Exception.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/Exception.cpp @@ -19,13 +19,13 @@ const long Exception::UNKNOWNLINENUMBER = -1; Exception::Exception( const Exception &other ) : std::exception( other ) -{ - m_message = other.m_message; +{ + m_message = other.m_message; m_sourceLine = other.m_sourceLine; -} +} -Exception::Exception( const Message &message, +Exception::Exception( const Message &message, const SourceLine &sourceLine ) : m_message( message ) , m_sourceLine( sourceLine ) @@ -34,8 +34,8 @@ Exception::Exception( const Message &message, #ifdef CPPUNIT_ENABLE_SOURCELINE_DEPRECATED -Exception::Exception( std::string message, - long lineNumber, +Exception::Exception( std::string message, + long lineNumber, std::string fileName ) : m_message( message ) , m_sourceLine( fileName, lineNumber ) @@ -49,21 +49,21 @@ Exception::~Exception() throw() } -Exception & +Exception & Exception::operator =( const Exception& other ) -{ +{ // Don't call superclass operator =(). VC++ STL implementation -// has a bug. It calls the destructor and copy constructor of +// has a bug. It calls the destructor and copy constructor of // std::exception() which reset the virtual table to std::exception. // SuperClass::operator =(other); if ( &other != this ) { - m_message = other.m_message; + m_message = other.m_message; m_sourceLine = other.m_sourceLine; } - return *this; + return *this; } @@ -71,27 +71,27 @@ const char* Exception::what() const throw() { Exception *mutableThis = CPPUNIT_CONST_CAST( Exception *, this ); - mutableThis->m_whatMessage = m_message.shortDescription() + "\n" + + mutableThis->m_whatMessage = m_message.shortDescription() + "\n" + m_message.details(); return m_whatMessage.c_str(); } -SourceLine +SourceLine Exception::sourceLine() const { return m_sourceLine; } -Message +Message Exception::message() const { return m_message; } -void +void Exception::setMessage( const Message &message ) { m_message = message; @@ -99,18 +99,18 @@ Exception::setMessage( const Message &message ) #ifdef CPPUNIT_ENABLE_SOURCELINE_DEPRECATED -long +long Exception::lineNumber() const -{ - return m_sourceLine.isValid() ? m_sourceLine.lineNumber() : - UNKNOWNLINENUMBER; +{ + return m_sourceLine.isValid() ? m_sourceLine.lineNumber() : + UNKNOWNLINENUMBER; } -std::string +std::string Exception::fileName() const -{ - return m_sourceLine.isValid() ? m_sourceLine.fileName() : +{ + return m_sourceLine.isValid() ? m_sourceLine.fileName() : UNKNOWNFILENAME; } #endif diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/Message.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/Message.cpp index 9d6a0e92b7..ab045aacd9 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/Message.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/Message.cpp @@ -71,14 +71,14 @@ Message::shortDescription() const } -int +int Message::detailCount() const { return m_details.size(); } -std::string +std::string Message::detailAt( int index ) const { if ( index < 0 || index >= detailCount() ) @@ -88,7 +88,7 @@ Message::detailAt( int index ) const } -std::string +std::string Message::details() const { std::string details; @@ -102,21 +102,21 @@ Message::details() const } -void +void Message::clearDetails() { m_details.clear(); } -void +void Message::addDetail( const std::string &detail ) { m_details.push_back( detail ); } -void +void Message::addDetail( const std::string &detail1, const std::string &detail2 ) { @@ -125,7 +125,7 @@ Message::addDetail( const std::string &detail1, } -void +void Message::addDetail( const std::string &detail1, const std::string &detail2, const std::string &detail3 ) @@ -135,23 +135,23 @@ Message::addDetail( const std::string &detail1, } -void +void Message::addDetail( const Message &message ) { - m_details.insert( m_details.end(), - message.m_details.begin(), + m_details.insert( m_details.end(), + message.m_details.begin(), message.m_details.end() ); } -void +void Message::setShortDescription( const std::string &shortDescription ) { m_shortDescription = shortDescription; } -bool +bool Message::operator ==( const Message &other ) const { return m_shortDescription == other.m_shortDescription && @@ -159,7 +159,7 @@ Message::operator ==( const Message &other ) const } -bool +bool Message::operator !=( const Message &other ) const { return !( *this == other ); diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/PlugInManager.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/PlugInManager.cpp index b595deefba..471646e836 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/PlugInManager.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/PlugInManager.cpp @@ -31,17 +31,17 @@ PlugInManager::load( const std::string &libraryFileName, info.m_fileName = libraryFileName; info.m_manager = new DynamicLibraryManager( libraryFileName ); - TestPlugInSignature plug = (TestPlugInSignature)info.m_manager->findSymbol( + TestPlugInSignature plug = (TestPlugInSignature)info.m_manager->findSymbol( CPPUNIT_STRINGIZE( CPPUNIT_PLUGIN_EXPORTED_NAME ) ); info.m_interface = (*plug)(); m_plugIns.push_back( info ); - + info.m_interface->initialize( &TestFactoryRegistry::getRegistry(), parameters ); } -void +void PlugInManager::unload( const std::string &libraryFileName ) { for ( PlugIns::iterator it = m_plugIns.begin(); it != m_plugIns.end(); ++it ) @@ -56,7 +56,7 @@ PlugInManager::unload( const std::string &libraryFileName ) } -void +void PlugInManager::addListener( TestResult *eventManager ) { for ( PlugIns::iterator it = m_plugIns.begin(); it != m_plugIns.end(); ++it ) @@ -64,7 +64,7 @@ PlugInManager::addListener( TestResult *eventManager ) } -void +void PlugInManager::removeListener( TestResult *eventManager ) { for ( PlugIns::iterator it = m_plugIns.begin(); it != m_plugIns.end(); ++it ) @@ -72,7 +72,7 @@ PlugInManager::removeListener( TestResult *eventManager ) } -void +void PlugInManager::unload( PlugInInfo &plugIn ) { try @@ -89,7 +89,7 @@ PlugInManager::unload( PlugInInfo &plugIn ) } -void +void PlugInManager::addXmlOutputterHooks( XmlOutputter *outputter ) { for ( PlugIns::iterator it = m_plugIns.begin(); it != m_plugIns.end(); ++it ) @@ -97,7 +97,7 @@ PlugInManager::addXmlOutputterHooks( XmlOutputter *outputter ) } -void +void PlugInManager::removeXmlOutputterHooks() { for ( PlugIns::iterator it = m_plugIns.begin(); it != m_plugIns.end(); ++it ) diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/PlugInParameters.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/PlugInParameters.cpp index 1b532f9fa2..7bb789f320 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/PlugInParameters.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/PlugInParameters.cpp @@ -16,7 +16,7 @@ PlugInParameters::~PlugInParameters() } -std::string +std::string PlugInParameters::getCommandLine() const { return m_commandLine; diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/Protector.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/Protector.cpp index 5c171ec462..bc7105c33f 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/Protector.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/Protector.cpp @@ -17,19 +17,19 @@ Protector::~Protector() } -void +void Protector::reportError( const ProtectorContext &context, const Exception &error ) const { std::auto_ptr actualError( error.clone() ); actualError->setMessage( actualMessage( actualError->message(), context ) ); - context.m_result->addError( context.m_test, + context.m_result->addError( context.m_test, actualError.release() ); } -void +void Protector::reportError( const ProtectorContext &context, const Message &message, const SourceLine &sourceLine ) const @@ -38,18 +38,18 @@ Protector::reportError( const ProtectorContext &context, } -void +void Protector::reportFailure( const ProtectorContext &context, const Exception &failure ) const { std::auto_ptr actualFailure( failure.clone() ); actualFailure->setMessage( actualMessage( actualFailure->message(), context ) ); - context.m_result->addFailure( context.m_test, + context.m_result->addFailure( context.m_test, actualFailure.release() ); } -Message +Message Protector::actualMessage( const Message &message, const ProtectorContext &context ) const { @@ -58,7 +58,7 @@ Protector::actualMessage( const Message &message, theActualMessage = message; else { - theActualMessage = Message( context.m_shortDescription, + theActualMessage = Message( context.m_shortDescription, message.shortDescription() ); theActualMessage.addDetail( message ); } diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/ProtectorChain.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/ProtectorChain.cpp index f528341eb1..6bea269883 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/ProtectorChain.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/ProtectorChain.cpp @@ -34,28 +34,28 @@ ProtectorChain::~ProtectorChain() } -void +void ProtectorChain::push( Protector *protector ) { m_protectors.push_back( protector ); } -void +void ProtectorChain::pop() { delete m_protectors.back(); m_protectors.pop_back(); } -int +int ProtectorChain::count() const { return m_protectors.size(); } -bool +bool ProtectorChain::protect( const Functor &functor, const ProtectorContext &context ) { @@ -65,11 +65,11 @@ ProtectorChain::protect( const Functor &functor, Functors functors; for ( int index = m_protectors.size()-1; index >= 0; --index ) { - const Functor &protectedFunctor = + const Functor &protectedFunctor = functors.empty() ? functor : *functors.back(); functors.push_back( new ProtectFunctor( m_protectors[index], - protectedFunctor, + protectedFunctor, context ) ); } diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/RepeatedTest.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/RepeatedTest.cpp index 2533ca1d9a..05abb008c9 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/RepeatedTest.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/RepeatedTest.cpp @@ -7,16 +7,16 @@ CPPUNIT_NS_BEGIN // Counts the number of test cases that will be run by this test. int RepeatedTest::countTestCases() const -{ - return TestDecorator::countTestCases() * m_timesRepeat; +{ + return TestDecorator::countTestCases() * m_timesRepeat; } // Runs a repeated test -void +void RepeatedTest::run( TestResult *result ) { - for ( int n = 0; n < m_timesRepeat; n++ ) + for ( int n = 0; n < m_timesRepeat; n++ ) { if ( result->shouldStop() ) break; diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/ShlDynamicLibraryManager.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/ShlDynamicLibraryManager.cpp index 9f4be22772..7ec9d5d2a5 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/ShlDynamicLibraryManager.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/ShlDynamicLibraryManager.cpp @@ -10,37 +10,37 @@ CPPUNIT_NS_BEGIN -DynamicLibraryManager::LibraryHandle +DynamicLibraryManager::LibraryHandle DynamicLibraryManager::doLoadLibrary( const std::string &libraryName ) { return ::shl_load(libraryName.c_str(), BIND_IMMEDIATE, 0L); } -void +void DynamicLibraryManager::doReleaseLibrary() { ::shl_unload( (shl_t)m_libraryHandle); } -DynamicLibraryManager::Symbol +DynamicLibraryManager::Symbol DynamicLibraryManager::doFindSymbol( const std::string &symbol ) { DynamicLibraryManager::Symbol L_symaddr = 0; - if ( ::shl_findsym( (shl_t*)(&m_libraryHandle), - symbol.c_str(), - TYPE_UNDEFINED, + if ( ::shl_findsym( (shl_t*)(&m_libraryHandle), + symbol.c_str(), + TYPE_UNDEFINED, &L_symaddr ) == 0 ) { return L_symaddr; - } + } return 0; } -std::string +std::string DynamicLibraryManager::getLastErrorDetail() const { return ""; diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/SourceLine.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/SourceLine.cpp index dfadae3f0e..f0eda79fd9 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/SourceLine.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/SourceLine.cpp @@ -42,28 +42,28 @@ SourceLine::~SourceLine() } -bool +bool SourceLine::isValid() const { return !m_fileName.empty(); } -int +int SourceLine::lineNumber() const { return m_lineNumber; } -std::string +std::string SourceLine::fileName() const { return m_fileName; } -bool +bool SourceLine::operator ==( const SourceLine &other ) const { return m_fileName == other.m_fileName && @@ -71,7 +71,7 @@ SourceLine::operator ==( const SourceLine &other ) const } -bool +bool SourceLine::operator !=( const SourceLine &other ) const { return !( *this == other ); diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/StringTools.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/StringTools.cpp index dc995d8b27..1b05ae1046 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/StringTools.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/StringTools.cpp @@ -6,7 +6,7 @@ CPPUNIT_NS_BEGIN -std::string +std::string StringTools::toString( int value ) { OStringStream stream; @@ -15,7 +15,7 @@ StringTools::toString( int value ) } -std::string +std::string StringTools::toString( double value ) { OStringStream stream; @@ -25,7 +25,7 @@ StringTools::toString( double value ) StringTools::Strings -StringTools::split( const std::string &text, +StringTools::split( const std::string &text, char separator ) { Strings splittedText; @@ -33,8 +33,8 @@ StringTools::split( const std::string &text, std::string::const_iterator itStart = text.begin(); while ( !text.empty() ) { - std::string::const_iterator itSeparator = std::find( itStart, - text.end(), + std::string::const_iterator itSeparator = std::find( itStart, + text.end(), separator ); splittedText.push_back( text.substr( itStart - text.begin(), itSeparator - itStart ) ); @@ -47,7 +47,7 @@ StringTools::split( const std::string &text, } -std::string +std::string StringTools::wrap( const std::string &text, int wrapColumn ) { diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/SynchronizedObject.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/SynchronizedObject.cpp index 1764538e59..cea6653fd0 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/SynchronizedObject.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/SynchronizedObject.cpp @@ -5,7 +5,7 @@ CPPUNIT_NS_BEGIN SynchronizedObject::SynchronizedObject( SynchronizationObject *syncObject ) - : m_syncObject( syncObject == 0 ? new SynchronizationObject() : + : m_syncObject( syncObject == 0 ? new SynchronizationObject() : syncObject ) { } @@ -20,11 +20,11 @@ SynchronizedObject::~SynchronizedObject() /** Accept a new synchronization object for protection of this instance * TestResult assumes ownership of the object */ -void +void SynchronizedObject::setSynchronizationObject( SynchronizationObject *syncObject ) -{ - delete m_syncObject; - m_syncObject = syncObject; +{ + delete m_syncObject; + m_syncObject = syncObject; } diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/Test.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/Test.cpp index fef8be7939..e477244dbd 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/Test.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/Test.cpp @@ -28,7 +28,7 @@ Test::findTest( const std::string &testName ) const } -bool +bool Test::findTestPath( const std::string &testName, TestPath &testPath ) const { @@ -53,7 +53,7 @@ Test::findTestPath( const std::string &testName, } -bool +bool Test::findTestPath( const Test *test, TestPath &testPath ) const { @@ -78,7 +78,7 @@ Test::findTestPath( const Test *test, } -TestPath +TestPath Test::resolveTestPath( const std::string &testPath ) const { Test *mutableThis = CPPUNIT_CONST_CAST( Test *, this ); @@ -86,12 +86,12 @@ Test::resolveTestPath( const std::string &testPath ) const } -void +void Test::checkIsValidIndex( int index ) const { if ( index < 0 || index >= getChildTestCount() ) throw std::out_of_range( "Test::checkValidIndex(): invalid index" ); } - + CPPUNIT_NS_END diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/TestAssert.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/TestAssert.cpp index 6e4e794b25..be81d80c2b 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/TestAssert.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/TestAssert.cpp @@ -4,14 +4,14 @@ CPPUNIT_NS_BEGIN -void +void assertDoubleEquals( double expected, double actual, double delta, SourceLine sourceLine, const std::string &message ) { - AdditionalMessage msg( "Delta : " + + AdditionalMessage msg( "Delta : " + assertion_traits::toString(delta) ); msg.addDetail( AdditionalMessage(message) ); @@ -25,7 +25,7 @@ assertDoubleEquals( double expected, // expected and actual have the same value (infinity sign). // NaN Value should always lead to a failed equality. if ( floatingPointIsUnordered(expected) || floatingPointIsUnordered(actual) ) - { + { equal = false; // expected or actual is a NaN } else // ordered values, +inf or -inf comparison @@ -37,8 +37,8 @@ assertDoubleEquals( double expected, Asserter::failNotEqualIf( !equal, assertion_traits::toString(expected), assertion_traits::toString(actual), - sourceLine, - msg, + sourceLine, + msg, "double equality assertion failed" ); } diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/TestCase.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/TestCase.cpp index 13c05257f6..8ef39387fd 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/TestCase.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/TestCase.cpp @@ -48,8 +48,8 @@ TestCase::TestCase( const std::string &name ) } -/// Run the test and catch any exceptions that are triggered by it -void +/// Run the test and catch any exceptions that are triggered by it +void TestCase::run( TestResult *result ) { result->startTest(this); @@ -65,7 +65,7 @@ TestCase::run( TestResult *result ) result->addFailure( this, copy ); } catch ( std::exception &e ) { - result->addError( this, new Exception( Message( "uncaught std::exception", + result->addError( this, new Exception( Message( "uncaught std::exception", e.what() ) ) ); } catch (...) { @@ -100,8 +100,8 @@ TestCase::run( TestResult *result ) } -/// All the work for runTest is deferred to subclasses -void +/// All the work for runTest is deferred to subclasses +void TestCase::runTest() { } @@ -127,11 +127,11 @@ TestCase::~TestCase() /// Returns the name of the test case -std::string +std::string TestCase::getName() const -{ - return m_name; +{ + return m_name; } - + CPPUNIT_NS_END diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/TestCaseDecorator.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/TestCaseDecorator.cpp index a7229f4b25..850d649d5a 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/TestCaseDecorator.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/TestCaseDecorator.cpp @@ -6,7 +6,7 @@ CPPUNIT_NS_BEGIN TestCaseDecorator::TestCaseDecorator( TestCase *test ) : TestCase( test->getName() ), m_test( test ) -{ +{ } @@ -16,28 +16,28 @@ TestCaseDecorator::~TestCaseDecorator() } -std::string +std::string TestCaseDecorator::getName() const -{ - return m_test->getName(); +{ + return m_test->getName(); } -void +void TestCaseDecorator::setUp() { m_test->setUp(); } -void +void TestCaseDecorator::tearDown() { m_test->tearDown(); } -void +void TestCaseDecorator::runTest() { m_test->runTest(); diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/TestComposite.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/TestComposite.cpp index 4768791b57..1f26be8aae 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/TestComposite.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/TestComposite.cpp @@ -16,7 +16,7 @@ TestComposite::~TestComposite() } -void +void TestComposite::run( TestResult *result ) { doStartSuite( result ); @@ -25,34 +25,34 @@ TestComposite::run( TestResult *result ) } -int +int TestComposite::countTestCases() const { int count = 0; - + int childCount = getChildTestCount(); for ( int index =0; index < childCount; ++index ) count += getChildTestAt( index )->countTestCases(); - + return count; } -std::string +std::string TestComposite::getName() const { return m_name; } -void +void TestComposite::doStartSuite( TestResult *controller ) { controller->startSuite( this ); } -void +void TestComposite::doRunChildTests( TestResult *controller ) { int childCount = getChildTestCount(); @@ -66,7 +66,7 @@ TestComposite::doRunChildTests( TestResult *controller ) } -void +void TestComposite::doEndSuite( TestResult *controller ) { controller->endSuite( this ); diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/TestDecorator.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/TestDecorator.cpp index 4e25a6af9b..701f7d8fe0 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/TestDecorator.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/TestDecorator.cpp @@ -5,7 +5,7 @@ CPPUNIT_NS_BEGIN TestDecorator::TestDecorator( Test *test ) : m_test( test) -{ +{ } @@ -15,28 +15,28 @@ TestDecorator::~TestDecorator() } -int +int TestDecorator::countTestCases() const -{ - return m_test->countTestCases(); +{ + return m_test->countTestCases(); } -void +void TestDecorator::run( TestResult *result ) -{ - m_test->run(result); +{ + m_test->run(result); } -std::string +std::string TestDecorator::getName() const -{ - return m_test->getName(); +{ + return m_test->getName(); } -int +int TestDecorator::getChildTestCount() const { return m_test->getChildTestCount(); diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/TestFactoryRegistry.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/TestFactoryRegistry.cpp index afe10bb4b9..ca42e7ea8a 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/TestFactoryRegistry.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/TestFactoryRegistry.cpp @@ -64,8 +64,8 @@ class TestFactoryRegistryList static TestFactoryRegistry *getRegistry( const std::string &name ) { - // If the following assertion failed, then TestFactoryRegistry::getRegistry() - // was called during static variable destruction without checking the registry + // If the following assertion failed, then TestFactoryRegistry::getRegistry() + // was called during static variable destruction without checking the registry // validity beforehand using TestFactoryRegistry::isValid() beforehand. assert( isValid() ); if ( !isValid() ) // release mode @@ -100,7 +100,7 @@ TestFactoryRegistry::getRegistry( const std::string &name ) } -void +void TestFactoryRegistry::registerFactory( const std::string &name, TestFactory *factory ) { @@ -108,21 +108,21 @@ TestFactoryRegistry::registerFactory( const std::string &name, } -void +void TestFactoryRegistry::registerFactory( TestFactory *factory ) { m_factories.insert( factory ); } -void +void TestFactoryRegistry::unregisterFactory( TestFactory *factory ) { m_factories.erase( factory ); } -void +void TestFactoryRegistry::addRegistry( const std::string &name ) { registerFactory( &getRegistry( name ) ); @@ -138,11 +138,11 @@ TestFactoryRegistry::makeTest() } -void +void TestFactoryRegistry::addTestToSuite( TestSuite *suite ) { - for ( Factories::iterator it = m_factories.begin(); - it != m_factories.end(); + for ( Factories::iterator it = m_factories.begin(); + it != m_factories.end(); ++it ) { TestFactory *factory = *it; @@ -151,7 +151,7 @@ TestFactoryRegistry::addTestToSuite( TestSuite *suite ) } -bool +bool TestFactoryRegistry::isValid() { return TestFactoryRegistryList::isValid(); diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/TestFailure.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/TestFailure.cpp index e31e138938..20a0ecf2e3 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/TestFailure.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/TestFailure.cpp @@ -6,10 +6,10 @@ CPPUNIT_NS_BEGIN /// Constructs a TestFailure with the given test and exception. -TestFailure::TestFailure( Test *failedTest, +TestFailure::TestFailure( Test *failedTest, Exception *thrownException, bool isError ) : - m_failedTest( failedTest ), + m_failedTest( failedTest ), m_thrownException( thrownException ), m_isError( isError ) { @@ -17,28 +17,28 @@ TestFailure::TestFailure( Test *failedTest, /// Deletes the owned exception. TestFailure::~TestFailure() -{ - delete m_thrownException; +{ + delete m_thrownException; } /// Gets the failed test. Test * TestFailure::failedTest() const -{ - return m_failedTest; +{ + return m_failedTest; } /// Gets the thrown exception. Never \c NULL. Exception * TestFailure::thrownException() const -{ - return m_thrownException; +{ + return m_thrownException; } /// Gets the failure location. -SourceLine +SourceLine TestFailure::sourceLine() const { return m_thrownException->sourceLine(); @@ -46,7 +46,7 @@ TestFailure::sourceLine() const /// Indicates if the failure is a failed assertion or an error. -bool +bool TestFailure::isError() const { return m_isError; @@ -54,7 +54,7 @@ TestFailure::isError() const /// Gets the name of the failed test. -std::string +std::string TestFailure::failedTestName() const { return m_failedTest->getName(); diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/TestLeaf.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/TestLeaf.cpp index 3d8767cf52..be9d32d038 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/TestLeaf.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/TestLeaf.cpp @@ -4,14 +4,14 @@ CPPUNIT_NS_BEGIN -int +int TestLeaf::countTestCases() const { return 1; } -int +int TestLeaf::getChildTestCount() const { return 0; diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/TestNamer.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/TestNamer.cpp index eec9be9734..4a6bb7ec90 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/TestNamer.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/TestNamer.cpp @@ -25,14 +25,14 @@ TestNamer::~TestNamer() } -std::string +std::string TestNamer::getFixtureName() const { return m_fixtureName; } -std::string +std::string TestNamer::getTestNameFor( const std::string &testMethodName ) const { return getFixtureName() + "::" + testMethodName; diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/TestPath.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/TestPath.cpp index a2783a293e..2cd19d93eb 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/TestPath.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/TestPath.cpp @@ -18,8 +18,8 @@ TestPath::TestPath( Test *root ) } -TestPath::TestPath( const TestPath &other, - int indexFirst, +TestPath::TestPath( const TestPath &other, + int indexFirst, int count ) { int countAdjustment = 0; @@ -40,7 +40,7 @@ TestPath::TestPath( const TestPath &other, } -TestPath::TestPath( Test *searchRoot, +TestPath::TestPath( Test *searchRoot, const std::string &pathAsString ) { PathTestNames testNames; @@ -90,21 +90,21 @@ TestPath::operator =( const TestPath &other ) } -bool +bool TestPath::isValid() const { return getTestCount() > 0; } -void +void TestPath::add( Test *test ) { m_tests.push_back( test ); } -void +void TestPath::add( const TestPath &path ) { for ( int index =0; index < path.getTestCount(); ++index ) @@ -112,8 +112,8 @@ TestPath::add( const TestPath &path ) } -void -TestPath::insert( Test *test, +void +TestPath::insert( Test *test, int index ) { if ( index < 0 || index > getTestCount() ) @@ -121,8 +121,8 @@ TestPath::insert( Test *test, m_tests.insert( m_tests.begin() + index, test ); } -void -TestPath::insert( const TestPath &path, +void +TestPath::insert( const TestPath &path, int index ) { int itemIndex = path.getTestCount() -1; @@ -131,7 +131,7 @@ TestPath::insert( const TestPath &path, } -void +void TestPath::removeTests() { while ( isValid() ) @@ -139,7 +139,7 @@ TestPath::removeTests() } -void +void TestPath::removeTest( int index ) { checkIndexValid( index ); @@ -147,7 +147,7 @@ TestPath::removeTest( int index ) } -void +void TestPath::up() { checkIndexValid( 0 ); @@ -155,7 +155,7 @@ TestPath::up() } -int +int TestPath::getTestCount() const { return m_tests.size(); @@ -177,7 +177,7 @@ TestPath::getChildTest() const } -void +void TestPath::checkIndexValid( int index ) const { if ( index < 0 || index >= getTestCount() ) @@ -185,7 +185,7 @@ TestPath::checkIndexValid( int index ) const } -std::string +std::string TestPath::toString() const { std::string asString( "/" ); @@ -249,6 +249,6 @@ TestPath::splitPathString( const std::string &pathAsString, return isRelative; } - + CPPUNIT_NS_END diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/TestPlugInDefaultImpl.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/TestPlugInDefaultImpl.cpp index 1e39825868..f4bb6b28fa 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/TestPlugInDefaultImpl.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/TestPlugInDefaultImpl.cpp @@ -10,7 +10,7 @@ CPPUNIT_NS_BEGIN -TestPlugInDefaultImpl::TestPlugInDefaultImpl() +TestPlugInDefaultImpl::TestPlugInDefaultImpl() { } @@ -20,38 +20,38 @@ TestPlugInDefaultImpl::~TestPlugInDefaultImpl() } -void +void TestPlugInDefaultImpl::initialize( TestFactoryRegistry *registry, const PlugInParameters ¶meters ) { } -void +void TestPlugInDefaultImpl::addListener( TestResult *eventManager ) { } -void +void TestPlugInDefaultImpl::removeListener( TestResult *eventManager ) { } -void +void TestPlugInDefaultImpl::addXmlOutputterHooks( XmlOutputter *outputter ) { } -void +void TestPlugInDefaultImpl::removeXmlOutputterHooks() { } -void +void TestPlugInDefaultImpl::uninitialize( TestFactoryRegistry *registry ) { } diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/TestResult.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/TestResult.cpp index 6be19f1a1b..74355015fb 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/TestResult.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/TestResult.cpp @@ -15,7 +15,7 @@ TestResult::TestResult( SynchronizationObject *syncObject ) : SynchronizedObject( syncObject ) , m_protectorChain( new ProtectorChain() ) , m_stop( false ) -{ +{ m_protectorChain->push( new DefaultProtector() ); } @@ -26,119 +26,119 @@ TestResult::~TestResult() } -void +void TestResult::reset() { - ExclusiveZone zone( m_syncObject ); + ExclusiveZone zone( m_syncObject ); m_stop = false; } -void -TestResult::addError( Test *test, +void +TestResult::addError( Test *test, Exception *e ) -{ +{ TestFailure failure( test, e, true ); addFailure( failure ); } -void +void TestResult::addFailure( Test *test, Exception *e ) -{ +{ TestFailure failure( test, e, false ); addFailure( failure ); } -void +void TestResult::addFailure( const TestFailure &failure ) { - ExclusiveZone zone( m_syncObject ); + ExclusiveZone zone( m_syncObject ); for ( TestListeners::iterator it = m_listeners.begin(); - it != m_listeners.end(); + it != m_listeners.end(); ++it ) (*it)->addFailure( failure ); } -void +void TestResult::startTest( Test *test ) -{ - ExclusiveZone zone( m_syncObject ); +{ + ExclusiveZone zone( m_syncObject ); for ( TestListeners::iterator it = m_listeners.begin(); - it != m_listeners.end(); + it != m_listeners.end(); ++it ) (*it)->startTest( test ); } - -void + +void TestResult::endTest( Test *test ) -{ - ExclusiveZone zone( m_syncObject ); +{ + ExclusiveZone zone( m_syncObject ); for ( TestListeners::iterator it = m_listeners.begin(); - it != m_listeners.end(); + it != m_listeners.end(); ++it ) (*it)->endTest( test ); } -void +void TestResult::startSuite( Test *test ) { - ExclusiveZone zone( m_syncObject ); + ExclusiveZone zone( m_syncObject ); for ( TestListeners::iterator it = m_listeners.begin(); - it != m_listeners.end(); + it != m_listeners.end(); ++it ) (*it)->startSuite( test ); } -void +void TestResult::endSuite( Test *test ) { - ExclusiveZone zone( m_syncObject ); + ExclusiveZone zone( m_syncObject ); for ( TestListeners::iterator it = m_listeners.begin(); - it != m_listeners.end(); + it != m_listeners.end(); ++it ) (*it)->endSuite( test ); } -bool +bool TestResult::shouldStop() const -{ +{ ExclusiveZone zone( m_syncObject ); - return m_stop; + return m_stop; } -void +void TestResult::stop() -{ +{ ExclusiveZone zone( m_syncObject ); - m_stop = true; + m_stop = true; } -void +void TestResult::addListener( TestListener *listener ) { - ExclusiveZone zone( m_syncObject ); + ExclusiveZone zone( m_syncObject ); m_listeners.push_back( listener ); } -void +void TestResult::removeListener ( TestListener *listener ) { - ExclusiveZone zone( m_syncObject ); + ExclusiveZone zone( m_syncObject ); removeFromSequence( m_listeners, listener ); } -void +void TestResult::runTest( Test *test ) { startTestRun( test ); @@ -147,29 +147,29 @@ TestResult::runTest( Test *test ) } -void +void TestResult::startTestRun( Test *test ) { - ExclusiveZone zone( m_syncObject ); + ExclusiveZone zone( m_syncObject ); for ( TestListeners::iterator it = m_listeners.begin(); - it != m_listeners.end(); + it != m_listeners.end(); ++it ) (*it)->startTestRun( test, this ); } -void +void TestResult::endTestRun( Test *test ) { - ExclusiveZone zone( m_syncObject ); + ExclusiveZone zone( m_syncObject ); for ( TestListeners::iterator it = m_listeners.begin(); - it != m_listeners.end(); + it != m_listeners.end(); ++it ) (*it)->endTestRun( test, this ); } -bool +bool TestResult::protect( const Functor &functor, Test *test, const std::string &shortDescription ) @@ -179,14 +179,14 @@ TestResult::protect( const Functor &functor, } -void +void TestResult::pushProtector( Protector *protector ) { m_protectorChain->push( protector ); } -void +void TestResult::popProtector() { m_protectorChain->pop(); diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/TestResultCollector.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/TestResultCollector.cpp index 4371c50306..869c14dd11 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/TestResultCollector.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/TestResultCollector.cpp @@ -18,7 +18,7 @@ TestResultCollector::~TestResultCollector() } -void +void TestResultCollector::freeFailures() { TestFailures::iterator itFailure = m_failures.begin(); @@ -28,32 +28,32 @@ TestResultCollector::freeFailures() } -void +void TestResultCollector::reset() { TestSuccessListener::reset(); - ExclusiveZone zone( m_syncObject ); + ExclusiveZone zone( m_syncObject ); freeFailures(); m_testErrors = 0; m_tests.clear(); } -void +void TestResultCollector::startTest( Test *test ) { - ExclusiveZone zone (m_syncObject); + ExclusiveZone zone (m_syncObject); m_tests.push_back( test ); } -void +void TestResultCollector::addFailure( const TestFailure &failure ) { TestSuccessListener::addFailure( failure ); - ExclusiveZone zone( m_syncObject ); + ExclusiveZone zone( m_syncObject ); if ( failure.isError() ) ++m_testErrors; m_failures.push_back( failure.clone() ); @@ -61,47 +61,47 @@ TestResultCollector::addFailure( const TestFailure &failure ) /// Gets the number of run tests. -int +int TestResultCollector::runTests() const -{ - ExclusiveZone zone( m_syncObject ); - return m_tests.size(); +{ + ExclusiveZone zone( m_syncObject ); + return m_tests.size(); } /// Gets the number of detected errors (uncaught exception). -int +int TestResultCollector::testErrors() const -{ +{ ExclusiveZone zone( m_syncObject ); return m_testErrors; } /// Gets the number of detected failures (failed assertion). -int +int TestResultCollector::testFailures() const -{ - ExclusiveZone zone( m_syncObject ); +{ + ExclusiveZone zone( m_syncObject ); return m_failures.size() - m_testErrors; } /// Gets the total number of detected failures. -int +int TestResultCollector::testFailuresTotal() const { - ExclusiveZone zone( m_syncObject ); + ExclusiveZone zone( m_syncObject ); return m_failures.size(); } /// Returns a the list failures (random access collection). -const TestResultCollector::TestFailures & +const TestResultCollector::TestFailures & TestResultCollector::failures() const -{ +{ ExclusiveZone zone( m_syncObject ); - return m_failures; + return m_failures; } diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/TestRunner.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/TestRunner.cpp index 8d95a6308c..4e005534ef 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/TestRunner.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/TestRunner.cpp @@ -7,13 +7,13 @@ CPPUNIT_NS_BEGIN -TestRunner::WrappingSuite::WrappingSuite( const std::string &name ) +TestRunner::WrappingSuite::WrappingSuite( const std::string &name ) : TestSuite( name ) { } -int +int TestRunner::WrappingSuite::getChildTestCount() const { if ( hasOnlyOneTest() ) @@ -22,7 +22,7 @@ TestRunner::WrappingSuite::getChildTestCount() const } -std::string +std::string TestRunner::WrappingSuite::getName() const { if ( hasOnlyOneTest() ) @@ -40,7 +40,7 @@ TestRunner::WrappingSuite::doGetChildTestAt( int index ) const } -void +void TestRunner::WrappingSuite::run( TestResult *result ) { if ( hasOnlyOneTest() ) @@ -50,7 +50,7 @@ TestRunner::WrappingSuite::run( TestResult *result ) } -bool +bool TestRunner::WrappingSuite::hasOnlyOneTest() const { return TestSuite::getChildTestCount() == 1; @@ -79,14 +79,14 @@ TestRunner::~TestRunner() } -void +void TestRunner::addTest( Test *test ) { - m_suite->addTest( test ); + m_suite->addTest( test ); } -void +void TestRunner::run( TestResult &controller, const std::string &testPath ) { diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/TestSetUp.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/TestSetUp.cpp index d4d8530893..814d89db73 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/TestSetUp.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/TestSetUp.cpp @@ -3,26 +3,26 @@ CPPUNIT_NS_BEGIN -TestSetUp::TestSetUp( Test *test ) : TestDecorator( test ) +TestSetUp::TestSetUp( Test *test ) : TestDecorator( test ) { } -void +void TestSetUp::setUp() { } -void -TestSetUp::tearDown() +void +TestSetUp::tearDown() { } void TestSetUp::run( TestResult *result ) -{ +{ setUp(); TestDecorator::run(result); tearDown(); diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/TestSuccessListener.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/TestSuccessListener.cpp index 3c9c8214c6..690934708f 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/TestSuccessListener.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/TestSuccessListener.cpp @@ -16,7 +16,7 @@ TestSuccessListener::~TestSuccessListener() } -void +void TestSuccessListener::reset() { ExclusiveZone zone( m_syncObject ); @@ -24,7 +24,7 @@ TestSuccessListener::reset() } -void +void TestSuccessListener::addFailure( const TestFailure &failure ) { ExclusiveZone zone( m_syncObject ); @@ -32,7 +32,7 @@ TestSuccessListener::addFailure( const TestFailure &failure ) } -bool +bool TestSuccessListener::wasSuccessful() const { ExclusiveZone zone( m_syncObject ); diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/TestSuite.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/TestSuite.cpp index 8dd2ea6e71..b345adca15 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/TestSuite.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/TestSuite.cpp @@ -14,13 +14,13 @@ TestSuite::TestSuite( std::string name ) /// Destructor TestSuite::~TestSuite() -{ - deleteContents(); +{ + deleteContents(); } /// Deletes all tests in the suite. -void +void TestSuite::deleteContents() { int childCount = getChildTestCount(); @@ -31,11 +31,11 @@ TestSuite::deleteContents() } -/// Adds a test to the suite. -void +/// Adds a test to the suite. +void TestSuite::addTest( Test *test ) -{ - m_tests.push_back( test ); +{ + m_tests.push_back( test ); } @@ -46,7 +46,7 @@ TestSuite::getTests() const } -int +int TestSuite::getChildTestCount() const { return m_tests.size(); diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/TestSuiteBuilderContext.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/TestSuiteBuilderContext.cpp index ff71b52c13..037ed5c0c6 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/TestSuiteBuilderContext.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/TestSuiteBuilderContext.cpp @@ -6,7 +6,7 @@ CPPUNIT_NS_BEGIN -TestSuiteBuilderContextBase::TestSuiteBuilderContextBase( +TestSuiteBuilderContextBase::TestSuiteBuilderContextBase( TestSuite &suite, const TestNamer &namer, TestFixtureFactory &factory ) @@ -22,22 +22,22 @@ TestSuiteBuilderContextBase::~TestSuiteBuilderContextBase() } -void +void TestSuiteBuilderContextBase::addTest( Test *test ) { m_suite.addTest( test ); } -std::string +std::string TestSuiteBuilderContextBase::getFixtureName() const { return m_namer.getFixtureName(); } -std::string -TestSuiteBuilderContextBase::getTestNameFor( +std::string +TestSuiteBuilderContextBase::getTestNameFor( const std::string &testMethodName ) const { return m_namer.getTestNameFor( testMethodName ); @@ -51,8 +51,8 @@ TestSuiteBuilderContextBase::makeTestFixture() const } -void -TestSuiteBuilderContextBase::addProperty( const std::string &key, +void +TestSuiteBuilderContextBase::addProperty( const std::string &key, const std::string &value ) { Properties::iterator it = m_properties.begin(); @@ -69,7 +69,7 @@ TestSuiteBuilderContextBase::addProperty( const std::string &key, m_properties.push_back( property ); } -const std::string +const std::string TestSuiteBuilderContextBase::getStringProperty( const std::string &key ) const { Properties::const_iterator it = m_properties.begin(); diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/TextOutputter.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/TextOutputter.cpp index f74214fc63..f7653d3273 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/TextOutputter.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/TextOutputter.cpp @@ -21,8 +21,8 @@ TextOutputter::~TextOutputter() } -void -TextOutputter::write() +void +TextOutputter::write() { printHeader(); m_stream << "\n"; @@ -31,12 +31,12 @@ TextOutputter::write() } -void +void TextOutputter::printFailures() { TestResultCollector::TestFailures::const_iterator itFailure = m_result->failures().begin(); int failureNumber = 1; - while ( itFailure != m_result->failures().end() ) + while ( itFailure != m_result->failures().end() ) { m_stream << "\n"; printFailure( *itFailure++, failureNumber++ ); @@ -44,7 +44,7 @@ TextOutputter::printFailures() } -void +void TextOutputter::printFailure( TestFailure *failure, int failureNumber ) { @@ -61,21 +61,21 @@ TextOutputter::printFailure( TestFailure *failure, } -void +void TextOutputter::printFailureListMark( int failureNumber ) { m_stream << failureNumber << ")"; } -void +void TextOutputter::printFailureTestName( TestFailure *failure ) { m_stream << "test: " << failure->failedTestName(); } -void +void TextOutputter::printFailureType( TestFailure *failure ) { m_stream << "(" @@ -84,7 +84,7 @@ TextOutputter::printFailureType( TestFailure *failure ) } -void +void TextOutputter::printFailureLocation( SourceLine sourceLine ) { if ( !sourceLine.isValid() ) @@ -95,7 +95,7 @@ TextOutputter::printFailureLocation( SourceLine sourceLine ) } -void +void TextOutputter::printFailureDetail( Exception *thrownException ) { m_stream << thrownException->message().shortDescription() << "\n"; @@ -103,7 +103,7 @@ TextOutputter::printFailureDetail( Exception *thrownException ) } -void +void TextOutputter::printHeader() { if ( m_result->wasSuccessful() ) @@ -117,14 +117,14 @@ TextOutputter::printHeader() } -void +void TextOutputter::printFailureWarning() { m_stream << "!!!FAILURES!!!\n"; } -void +void TextOutputter::printStatistics() { m_stream << "Test Results:\n"; diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/TextTestProgressListener.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/TextTestProgressListener.cpp index 7fa92ce39e..21d370d302 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/TextTestProgressListener.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/TextTestProgressListener.cpp @@ -16,22 +16,22 @@ TextTestProgressListener::~TextTestProgressListener() } -void +void TextTestProgressListener::startTest( Test *test ) { stdCOut() << "."; } -void +void TextTestProgressListener::addFailure( const TestFailure &failure ) { stdCOut() << ( failure.isError() ? "E" : "F" ); } -void -TextTestProgressListener::endTestRun( Test *test, +void +TextTestProgressListener::endTestRun( Test *test, TestResult *eventManager ) { stdCOut() << "\n"; diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/TextTestResult.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/TextTestResult.cpp index 871eb6da33..34202040ee 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/TextTestResult.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/TextTestResult.cpp @@ -15,7 +15,7 @@ TextTestResult::TextTestResult() } -void +void TextTestResult::addFailure( const TestFailure &failure ) { TestResultCollector::addFailure( failure ); @@ -23,7 +23,7 @@ TextTestResult::addFailure( const TestFailure &failure ) } -void +void TextTestResult::startTest( Test *test ) { TestResultCollector::startTest (test); @@ -31,8 +31,8 @@ TextTestResult::startTest( Test *test ) } -void -TextTestResult::print( OStream &stream ) +void +TextTestResult::print( OStream &stream ) { TextOutputter outputter( this, stream ); outputter.write(); @@ -40,10 +40,10 @@ TextTestResult::print( OStream &stream ) OStream & -operator <<( OStream &stream, +operator <<( OStream &stream, TextTestResult &result ) -{ - result.print (stream); return stream; +{ + result.print (stream); return stream; } diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/TextTestRunner.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/TextTestRunner.cpp index 1534ec0ccd..d57a12155e 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/TextTestRunner.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/TextTestRunner.cpp @@ -17,7 +17,7 @@ CPPUNIT_NS_BEGIN /*! Constructs a new text runner. * \param outputter used to print text result. Owned by the runner. */ -TextTestRunner::TextTestRunner( Outputter *outputter ) +TextTestRunner::TextTestRunner( Outputter *outputter ) : m_result( new TestResultCollector() ) , m_eventManager( new TestResult() ) , m_outputter( outputter ) @@ -41,7 +41,7 @@ TextTestRunner::~TextTestRunner() * \param testName Name of the test case to run. If an empty is given, then * all added tests are run. The name can be the name of any * test in the hierarchy. - * \param doWait if \c true then the user must press the RETURN key + * \param doWait if \c true then the user must press the RETURN key * before the run() method exit. * \param doPrintResult if \c true (default) then the test result are printed * on the standard output. @@ -73,11 +73,11 @@ TextTestRunner::run( std::string testName, } -void +void TextTestRunner::wait( bool doWait ) { #if !defined( CPPUNIT_NO_STREAM ) - if ( doWait ) + if ( doWait ) { stdCOut() << " to continue\n"; stdCOut().flush(); @@ -87,7 +87,7 @@ TextTestRunner::wait( bool doWait ) } -void +void TextTestRunner::printResult( bool doPrintResult ) { stdCOut() << "\n"; @@ -121,11 +121,11 @@ TextTestRunner::eventManager() const * * Notes that the outputter will be use after the test run only if \a printResult was * \c true. - * \param outputter New outputter to use. The previous outputter is destroyed. + * \param outputter New outputter to use. The previous outputter is destroyed. * The TextTestRunner assumes ownership of the outputter. * \see CompilerOutputter, XmlOutputter, TextOutputter. */ -void +void TextTestRunner::setOutputter( Outputter *outputter ) { delete m_outputter; @@ -133,7 +133,7 @@ TextTestRunner::setOutputter( Outputter *outputter ) } -void +void TextTestRunner::run( TestResult &controller, const std::string &testPath ) { diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/TypeInfoHelper.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/TypeInfoHelper.cpp index bd01001b46..804a85a109 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/TypeInfoHelper.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/TypeInfoHelper.cpp @@ -13,7 +13,7 @@ CPPUNIT_NS_BEGIN -std::string +std::string TypeInfoHelper::getClassName( const std::type_info &info ) { #if defined(CPPUNIT_HAVE_GCC_ABI_DEMANGLE) && CPPUNIT_HAVE_GCC_ABI_DEMANGLE @@ -22,9 +22,9 @@ TypeInfoHelper::getClassName( const std::type_info &info ) char* c_name = 0; c_name = abi::__cxa_demangle( info.name(), 0, 0, &status ); - + std::string name( c_name ); - free( c_name ); + free( c_name ); #else // CPPUNIT_HAVE_GCC_ABI_DEMANGLE diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/UnixDynamicLibraryManager.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/UnixDynamicLibraryManager.cpp index f235cce5ae..936447e8b1 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/UnixDynamicLibraryManager.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/UnixDynamicLibraryManager.cpp @@ -10,28 +10,28 @@ CPPUNIT_NS_BEGIN -DynamicLibraryManager::LibraryHandle +DynamicLibraryManager::LibraryHandle DynamicLibraryManager::doLoadLibrary( const std::string &libraryName ) { return ::dlopen( libraryName.c_str(), RTLD_NOW | RTLD_GLOBAL ); } -void +void DynamicLibraryManager::doReleaseLibrary() { ::dlclose( m_libraryHandle); } -DynamicLibraryManager::Symbol +DynamicLibraryManager::Symbol DynamicLibraryManager::doFindSymbol( const std::string &symbol ) { return ::dlsym ( m_libraryHandle, symbol.c_str() ); } -std::string +std::string DynamicLibraryManager::getLastErrorDetail() const { return ""; diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/Win32DynamicLibraryManager.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/Win32DynamicLibraryManager.cpp index acadf46274..f4473de039 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/Win32DynamicLibraryManager.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/Win32DynamicLibraryManager.cpp @@ -3,56 +3,56 @@ #if defined(CPPUNIT_HAVE_WIN32_DLL_LOADER) #include -#define WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN #define NOGDI #define NOUSER #define NOKERNEL #define NOSOUND #define NOMINMAX -#define BLENDFUNCTION void // for mingw & gcc +#define BLENDFUNCTION void // for mingw & gcc #include CPPUNIT_NS_BEGIN -DynamicLibraryManager::LibraryHandle +DynamicLibraryManager::LibraryHandle DynamicLibraryManager::doLoadLibrary( const std::string &libraryName ) { return ::LoadLibraryA( libraryName.c_str() ); } -void +void DynamicLibraryManager::doReleaseLibrary() { ::FreeLibrary( (HINSTANCE)m_libraryHandle ); } -DynamicLibraryManager::Symbol +DynamicLibraryManager::Symbol DynamicLibraryManager::doFindSymbol( const std::string &symbol ) { - return (DynamicLibraryManager::Symbol)::GetProcAddress( - (HINSTANCE)m_libraryHandle, + return (DynamicLibraryManager::Symbol)::GetProcAddress( + (HINSTANCE)m_libraryHandle, symbol.c_str() ); } -std::string +std::string DynamicLibraryManager::getLastErrorDetail() const { LPVOID lpMsgBuf; - ::FormatMessageA( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | + ::FormatMessageA( + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPSTR) &lpMsgBuf, 0, - NULL + NULL ); std::string message = (LPCSTR)lpMsgBuf; diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/XmlDocument.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/XmlDocument.cpp index 31f9115a7e..c379eeeb91 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/XmlDocument.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/XmlDocument.cpp @@ -23,28 +23,28 @@ XmlDocument::~XmlDocument() -std::string +std::string XmlDocument::encoding() const { return m_encoding; } -void +void XmlDocument::setEncoding( const std::string &encoding ) { m_encoding = encoding.empty() ? std::string("ISO-8859-1") : encoding; } -std::string +std::string XmlDocument::styleSheet() const { return m_styleSheet; } -void +void XmlDocument::setStyleSheet( const std::string &styleSheet ) { m_styleSheet = styleSheet; @@ -65,7 +65,7 @@ XmlDocument::setStandalone( bool standalone ) } -void +void XmlDocument::setRootElement( XmlElement *rootElement ) { if ( rootElement == m_rootElement ) @@ -83,7 +83,7 @@ XmlDocument::rootElement() const } -std::string +std::string XmlDocument::toString() const { std::string asString = "\n"; + asString += " ?>\n"; if ( !m_styleSheet.empty() ) asString += "\n"; diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/XmlElement.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/XmlElement.cpp index f930ad4e93..76bfd35b5f 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/XmlElement.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/XmlElement.cpp @@ -5,15 +5,15 @@ CPPUNIT_NS_BEGIN - + XmlElement::XmlElement( std::string elementName, - std::string content ) + std::string content ) : m_name( elementName ) , m_content( content ) { } - + XmlElement::XmlElement( std::string elementName, int numericContent ) : m_name( elementName ) @@ -33,42 +33,42 @@ XmlElement::~XmlElement() } -std::string +std::string XmlElement::name() const { return m_name; } -std::string +std::string XmlElement::content() const { return m_content; } -void +void XmlElement::setName( const std::string &name ) { m_name = name; } -void +void XmlElement::setContent( const std::string &content ) { m_content = content; } -void +void XmlElement::setContent( int numericContent ) { m_content = StringTools::toString( numericContent ); } -void +void XmlElement::addAttribute( std::string attributeName, std::string value ) { @@ -76,7 +76,7 @@ XmlElement::addAttribute( std::string attributeName, } -void +void XmlElement::addAttribute( std::string attributeName, int numericValue ) { @@ -84,14 +84,14 @@ XmlElement::addAttribute( std::string attributeName, } -void +void XmlElement::addElement( XmlElement *node ) { m_elements.push_back( node ); } -int +int XmlElement::elementCount() const { return m_elements.size(); @@ -123,7 +123,7 @@ XmlElement::elementFor( const std::string &name ) const } -std::string +std::string XmlElement::toString( const std::string &indent ) const { std::string element( indent ); @@ -169,7 +169,7 @@ XmlElement::toString( const std::string &indent ) const } -std::string +std::string XmlElement::attributesAsString() const { std::string attributes; @@ -189,7 +189,7 @@ XmlElement::attributesAsString() const } -std::string +std::string XmlElement::escape( std::string value ) const { std::string escaped; @@ -198,26 +198,26 @@ XmlElement::escape( std::string value ) const char c = value[index ]; switch ( c ) // escape all predefined XML entity (safe?) { - case '<': + case '<': escaped += "<"; break; - case '>': + case '>': escaped += ">"; break; - case '&': + case '&': escaped += "&"; break; - case '\'': + case '\'': escaped += "'"; break; - case '"': + case '"': escaped += """; break; default: escaped += c; } } - + return escaped; } diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/XmlOutputter.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/XmlOutputter.cpp index c605e335c0..e2b550df04 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/XmlOutputter.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/XmlOutputter.cpp @@ -29,21 +29,21 @@ XmlOutputter::~XmlOutputter() } -void +void XmlOutputter::addHook( XmlOutputterHook *hook ) { m_hooks.push_back( hook ); } -void +void XmlOutputter::removeHook( XmlOutputterHook *hook ) { m_hooks.erase( std::find( m_hooks.begin(), m_hooks.end(), hook ) ); } -void +void XmlOutputter::write() { setRootNode(); @@ -51,7 +51,7 @@ XmlOutputter::write() } -void +void XmlOutputter::setStyleSheet( const std::string &styleSheet ) { m_xml->setStyleSheet( styleSheet ); @@ -63,7 +63,7 @@ XmlOutputter::setStandalone( bool standalone ) { m_xml->setStandalone( standalone ); } - + void XmlOutputter::setRootNode() @@ -86,7 +86,7 @@ XmlOutputter::setRootNode() } -void +void XmlOutputter::fillFailedTestsMap( FailedTests &failedTests ) { const TestResultCollector::TestFailures &failures = m_result->failures(); @@ -139,7 +139,7 @@ XmlOutputter::addStatistics( XmlElement *rootNode ) XmlElement *statisticsElement = new XmlElement( "Statistics" ); rootNode->addElement( statisticsElement ); statisticsElement->addElement( new XmlElement( "Tests", m_result->runTests() ) ); - statisticsElement->addElement( new XmlElement( "FailuresTotal", + statisticsElement->addElement( new XmlElement( "FailuresTotal", m_result->testFailuresTotal() ) ); statisticsElement->addElement( new XmlElement( "Errors", m_result->testErrors() ) ); statisticsElement->addElement( new XmlElement( "Failures", m_result->testFailures() ) ); @@ -156,13 +156,13 @@ XmlOutputter::addFailedTest( Test *test, XmlElement *testsNode ) { Exception *thrownException = failure->thrownException(); - + XmlElement *testElement = new XmlElement( "FailedTest" ); testsNode->addElement( testElement ); testElement->addAttribute( "id", testNumber ); testElement->addElement( new XmlElement( "Name", test->getName() ) ); - testElement->addElement( new XmlElement( "FailureType", - failure->isError() ? "Error" : + testElement->addElement( new XmlElement( "FailureType", + failure->isError() ? "Error" : "Assertion" ) ); if ( failure->sourceLine().isValid() ) @@ -188,7 +188,7 @@ XmlOutputter::addFailureLocation( TestFailure *failure, void -XmlOutputter::addSuccessfulTest( Test *test, +XmlOutputter::addSuccessfulTest( Test *test, int testNumber, XmlElement *testsNode ) { diff --git a/dependencies-external/cppunit-1.12.1/src/cppunit/XmlOutputterHook.cpp b/dependencies-external/cppunit-1.12.1/src/cppunit/XmlOutputterHook.cpp index 4b4e8d8e55..fc59b88d73 100644 --- a/dependencies-external/cppunit-1.12.1/src/cppunit/XmlOutputterHook.cpp +++ b/dependencies-external/cppunit-1.12.1/src/cppunit/XmlOutputterHook.cpp @@ -4,19 +4,19 @@ CPPUNIT_NS_BEGIN -void +void XmlOutputterHook::beginDocument( XmlDocument *document ) { } -void +void XmlOutputterHook::endDocument( XmlDocument *document ) { } -void +void XmlOutputterHook::failTestAdded( XmlDocument *document, XmlElement *testElement, Test *test, @@ -25,7 +25,7 @@ XmlOutputterHook::failTestAdded( XmlDocument *document, } -void +void XmlOutputterHook::successfulTestAdded( XmlDocument *document, XmlElement *testElement, Test *test ) @@ -33,7 +33,7 @@ XmlOutputterHook::successfulTestAdded( XmlDocument *document, } -void +void XmlOutputterHook::statisticsAdded( XmlDocument *document, XmlElement *statisticsElement ) { diff --git a/src/Common.cpp b/src/Common.cpp index 9ec8ce16cf..3799f36d95 100644 --- a/src/Common.cpp +++ b/src/Common.cpp @@ -45,10 +45,10 @@ void calculateDistances( float * __restrict__ valuesA[3], float* __restrict__ co float ** __restrict__ distances, float *** __restrict__ distanceVectors ) { /* for (int i = 0; i < numValuesA; i++) { - std::cout << "A Points: " << valuesA[0][i] << "," << valuesA[1][i] << "," << valuesA[2][i] << endl; + std::cout << "A Points: " << valuesA[0][i] << "," << valuesA[1][i] << "," << valuesA[2][i] << std::endl; } for (int i = 0; i < numValuesB; i++) { - std::cout << "B Points: " << valuesB[0][i] << "," << valuesB[1][i] << "," << valuesB[2][i] << endl; + std::cout << "B Points: " << valuesB[0][i] << "," << valuesB[1][i] << "," << valuesB[2][i] << std::endl; } */ diff --git a/src/Domain.cpp b/src/Domain.cpp index 0f46b653fa..b64528cdf9 100644 --- a/src/Domain.cpp +++ b/src/Domain.cpp @@ -21,9 +21,7 @@ #include "utils/Logger.h" #include "utils/arrayMath.h" #include "utils/CommVar.h" -using Log::global_log; -using namespace std; Domain::Domain(int rank) { @@ -34,29 +32,29 @@ Domain::Domain(int rank) { _globalVirial = 0; _globalRho = 0; - this->_componentToThermostatIdMap = map(); - this->_localThermostatN = map(); + this->_componentToThermostatIdMap = std::map(); + this->_localThermostatN = std::map(); this->_localThermostatN[-1] = 0; this->_localThermostatN[0] = 0; - this->_universalThermostatN = map(); + this->_universalThermostatN = std::map(); this->_universalThermostatN[-1] = 0; this->_universalThermostatN[0] = 0; - this->_localRotationalDOF = map(); + this->_localRotationalDOF = std::map(); this->_localRotationalDOF[-1] = 0; this->_localRotationalDOF[0] = 0; - this->_universalRotationalDOF = map(); + this->_universalRotationalDOF = std::map(); this->_universalRotationalDOF[-1] = 0; this->_universalRotationalDOF[0] = 0; this->_globalLength[0] = 0; this->_globalLength[1] = 0; this->_globalLength[2] = 0; - this->_universalBTrans = map(); + this->_universalBTrans = std::map(); this->_universalBTrans[0] = 1.0; - this->_universalBRot = map(); + this->_universalBRot = std::map(); this->_universalBRot[0] = 1.0; - this->_universalTargetTemperature = map(); + this->_universalTargetTemperature = std::map(); this->_universalTargetTemperature[0] = 1.0; - this->_globalTemperatureMap = map(); + this->_globalTemperatureMap = std::map(); this->_globalTemperatureMap[0] = 1.0; this->_local2KETrans[0] = 0.0; this->_local2KERot[0] = 0.0; @@ -67,9 +65,9 @@ Domain::Domain(int rank) { this->_globalSigmaUU = 0.0; this->_componentwiseThermostat = false; #ifdef COMPLEX_POTENTIAL_SET - this->_universalUndirectedThermostat = map(); - this->_universalThermostatDirectedVelocity = map >(); - this->_localThermostatDirectedVelocity = map >(); + this->_universalUndirectedThermostat = std::map(); + this->_universalThermostatDirectedVelocity = std::map >(); + this->_localThermostatDirectedVelocity = std::map >(); #endif this->_universalSelectiveThermostatCounter = 0; this->_universalSelectiveThermostatWarning = 0; @@ -84,17 +82,17 @@ void Domain::readXML(XMLfileUnits& xmlconfig) { if ( xmlconfig.changecurrentnode( "volume" )) { std::string type; xmlconfig.getNodeValue( "@type", type ); - global_log->info() << "Volume type: " << type << endl; + Log::global_log->info() << "Volume type: " << type << std::endl; if( type == "box" ) { xmlconfig.getNodeValueReduced( "lx", _globalLength[0] ); xmlconfig.getNodeValueReduced( "ly", _globalLength[1] ); xmlconfig.getNodeValueReduced( "lz", _globalLength[2] ); - global_log->info() << "Box size: " << _globalLength[0] << ", " + Log::global_log->info() << "Box size: " << _globalLength[0] << ", " << _globalLength[1] << ", " - << _globalLength[2] << endl; + << _globalLength[2] << std::endl; } else { - global_log->error() << "Unsupported volume type " << type << endl; + Log::global_log->error() << "Unsupported volume type " << type << std::endl; } xmlconfig.changecurrentnode(".."); } @@ -106,7 +104,7 @@ void Domain::readXML(XMLfileUnits& xmlconfig) { bInputOk = bInputOk && xmlconfig.getNodeValueReduced("temperature", temperature); if(bInputOk) { setGlobalTemperature(temperature); - global_log->info() << "Temperature: " << temperature << endl; + Log::global_log->info() << "Temperature: " << temperature << std::endl; } } @@ -127,7 +125,7 @@ double Domain::getGlobalBetaRot(int thermostat) { return _universalBRot[thermost void Domain::setLocalSummv2(double summv2, int thermostat) { #ifndef NDEBUG - global_log->debug() << "* local thermostat " << thermostat << ": mvv = " << summv2 << endl; + Log::global_log->debug() << "* local thermostat " << thermostat << ": mvv = " << summv2 << std::endl; #endif this->_local2KETrans[thermostat] = summv2; } @@ -161,14 +159,14 @@ void Domain::calculateGlobalValues( double Upot = _localUpot; double Virial = _localVirial; - // To calculate Upot, Ukin and Pressure, intermediate values from all - // processes are needed. Here the - // intermediate values of all processes are summed up so that the root - // process can calculate the final values. to be able to calculate all - // values at this point, the calculation of the intermediate value sum_v2 - // had to be moved from Thermostat to upd_postF and the final calculations - // of m_Ukin, m_Upot and Pressure had to be moved from Thermostat / upd_F - // to this point + // To calculate Upot, Ukin and Pressure, intermediate values from all + // processes are needed. Here the + // intermediate values of all processes are summed up so that the root + // process can calculate the final values. to be able to calculate all + // values at this point, the calculation of the intermediate value sum_v2 + // had to be moved from Thermostat to upd_postF and the final calculations + // of m_Ukin, m_Upot and Pressure had to be moved from Thermostat / upd_F + // to this point /* FIXME stuff for the ensemble class */ domainDecomp->collCommInit(2, 654); @@ -188,10 +186,10 @@ void Domain::calculateGlobalValues( * thermostat ID 0 represents the entire system */ - map::iterator thermit; + std::map::iterator thermit; if( _componentwiseThermostat ) { - global_log->debug() << "* applying a component-wise thermostat" << endl; + Log::global_log->debug() << "* applying a component-wise thermostat" << std::endl; this->_localThermostatN[0] = 0; this->_localRotationalDOF[0] = 0; this->_local2KETrans[0] = 0; @@ -226,8 +224,8 @@ void Domain::calculateGlobalValues( numMolecules = domainDecomp->collCommGetUnsLong(); rotDOF = domainDecomp->collCommGetUnsLong(); domainDecomp->collCommFinalize(); - global_log->debug() << "[ thermostat ID " << thermit->first << "]\tN = " << numMolecules << "\trotDOF = " << rotDOF - << "\tmv2 = " << summv2 << "\tIw2 = " << sumIw2 << endl; + Log::global_log->debug() << "[ thermostat ID " << thermit->first << "]\tN = " << numMolecules << "\trotDOF = " << rotDOF + << "\tmv2 = " << summv2 << "\tIw2 = " << sumIw2 << std::endl; this->_universalThermostatN[thermit->first] = numMolecules; this->_universalRotationalDOF[thermit->first] = rotDOF; @@ -259,10 +257,10 @@ void Domain::calculateGlobalValues( if( ( (_universalBTrans[thermit->first] < MIN_BETA) || (_universalBRot[thermit->first] < MIN_BETA) ) && (0 >= _universalSelectiveThermostatError) && _bDoExplosionHeuristics == true) { - global_log->warning() << "Explosion!" << endl; - global_log->debug() << "Selective thermostat will be applied to set " << thermit->first + Log::global_log->warning() << "Explosion!" << std::endl; + Log::global_log->debug() << "Selective thermostat will be applied to set " << thermit->first << " (beta_trans = " << this->_universalBTrans[thermit->first] - << ", beta_rot = " << this->_universalBRot[thermit->first] << "!)" << endl; + << ", beta_rot = " << this->_universalBRot[thermit->first] << "!)" << std::endl; int rot_dof; const double limit_energy = KINLIMIT_PER_T * Ti; @@ -276,7 +274,7 @@ void Domain::calculateGlobalValues( Utrans = tM->U_trans(); if (Utrans > limit_energy) { vcorr = sqrt(limit_energy / Utrans); - global_log->debug() << ": v(m" << tM->getID() << ") *= " << vcorr << endl; + Log::global_log->debug() << ": v(m" << tM->getID() << ") *= " << vcorr << std::endl; tM->scale_v(vcorr); tM->scale_F(vcorr); } @@ -287,7 +285,7 @@ void Domain::calculateGlobalValues( Urot = tM->U_rot(); if (Urot > limit_rot_energy) { Dcorr = sqrt(limit_rot_energy / Urot); - global_log->debug() << "D(m" << tM->getID() << ") *= " << Dcorr << endl; + Log::global_log->debug() << "D(m" << tM->getID() << ") *= " << Dcorr << std::endl; tM->scale_D(Dcorr); tM->scale_M(Dcorr); } @@ -318,9 +316,9 @@ void Domain::calculateGlobalValues( ((_universalSelectiveThermostatCounter % 20) == 10) ) #endif /* FIXME: why difference counters? */ - global_log->debug() << "counter " << _universalSelectiveThermostatCounter + Log::global_log->debug() << "counter " << _universalSelectiveThermostatCounter << ",\t warning " << _universalSelectiveThermostatWarning - << ",\t error " << _universalSelectiveThermostatError << endl; + << ",\t error " << _universalSelectiveThermostatError << std::endl; if(collectThermostatVelocities && _universalUndirectedThermostat[thermit->first]) { @@ -341,17 +339,17 @@ void Domain::calculateGlobalValues( _universalThermostatDirectedVelocity[thermit->first].fill(0.0); #ifndef NDEBUG - global_log->debug() << "* thermostat " << thermit->first + Log::global_log->debug() << "* thermostat " << thermit->first << " directed velocity: (" << _universalThermostatDirectedVelocity[thermit->first][0] << " / " << _universalThermostatDirectedVelocity[thermit->first][1] << " / " << _universalThermostatDirectedVelocity[thermit->first][2] - << ")" << endl; + << ")" << std::endl; #endif } #ifndef NDEBUG - global_log->debug() << "* Th" << thermit->first << " N=" << numMolecules + Log::global_log->debug() << "* Th" << thermit->first << " N=" << numMolecules << " DOF=" << rotDOF + 3.0*numMolecules << " Tcur=" << _globalTemperatureMap[thermit->first] << " Ttar=" << _universalTargetTemperature[thermit->first] @@ -373,7 +371,7 @@ void Domain::calculateThermostatDirectedVelocity(ParticleContainer* partCont) { if(this->_componentwiseThermostat) { - for( map::iterator thit = _universalUndirectedThermostat.begin(); + for( std::map::iterator thit = _universalUndirectedThermostat.begin(); thit != _universalUndirectedThermostat.end(); thit ++ ) { @@ -480,27 +478,27 @@ void Domain::calculateVelocitySums(ParticleContainer* partCont) this->_local2KETrans[0] = local2KETrans; this->_local2KERot[0] = local2KERot; - global_log->debug() << " * N = " << this->_localThermostatN[0] + Log::global_log->debug() << " * N = " << this->_localThermostatN[0] << " rotDOF = " << this->_localRotationalDOF[0] << " mv2 = " - << _local2KETrans[0] << " Iw2 = " << _local2KERot[0] << endl; + << _local2KETrans[0] << " Iw2 = " << _local2KERot[0] << std::endl; } } -void Domain::writeCheckpointHeader(string filename, +void Domain::writeCheckpointHeader(std::string filename, ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, double currentTime) { unsigned long globalNumMolecules = this->getglobalNumMolecules(true, particleContainer, domainDecomp); /* Rank 0 writes file header */ if(0 == this->_localRank) { - ofstream checkpointfilestream(filename.c_str()); + std::ofstream checkpointfilestream(filename.c_str()); checkpointfilestream << "mardyn trunk " << CHECKPOINT_FILE_VERSION; checkpointfilestream << "\n"; // store default format flags - ios::fmtflags f( checkpointfilestream.flags() ); + std::ios::fmtflags f( checkpointfilestream.flags() ); checkpointfilestream << "currentTime\t" << FORMAT_SCI_MAX_DIGITS << currentTime << "\n"; //edited by Michaela Heier checkpointfilestream.flags(f); // restore default format flags - checkpointfilestream << " Length\t" << setprecision(9) << _globalLength[0] << " " << _globalLength[1] << " " << _globalLength[2] << "\n"; + checkpointfilestream << " Length\t" << std::setprecision(9) << _globalLength[0] << " " << _globalLength[1] << " " << _globalLength[2] << "\n"; if(this->_componentwiseThermostat) { - for( map::iterator thermit = this->_componentToThermostatIdMap.begin(); + for( std::map::iterator thermit = this->_componentToThermostatIdMap.begin(); thermit != this->_componentToThermostatIdMap.end(); thermit++ ) { @@ -508,7 +506,7 @@ void Domain::writeCheckpointHeader(string filename, checkpointfilestream << " CT\t" << 1+thermit->first << "\t" << thermit->second << "\n"; } - for( map::iterator Tit = this->_universalTargetTemperature.begin(); + for( std::map::iterator Tit = this->_universalTargetTemperature.begin(); Tit != this->_universalTargetTemperature.end(); Tit++ ) { @@ -518,7 +516,7 @@ void Domain::writeCheckpointHeader(string filename, } else { - checkpointfilestream << " Temperature\t" << _universalTargetTemperature[0] << endl; + checkpointfilestream << " Temperature\t" << _universalTargetTemperature[0] << std::endl; } #ifndef NDEBUG checkpointfilestream << "# rho\t" << this->_globalRho << "\n"; @@ -529,14 +527,14 @@ void Domain::writeCheckpointHeader(string filename, if(this->_globalUSteps > 1) if(this->_globalUSteps > 1) { - checkpointfilestream << setprecision(13); + checkpointfilestream << std::setprecision(13); checkpointfilestream << " I\t" << this->_globalUSteps << " " << this->_globalSigmaU << " " << this->_globalSigmaUU << "\n"; - checkpointfilestream << setprecision(8); + checkpointfilestream << std::setprecision(8); } */ - vector* components = _simulation.getEnsemble()->getComponents(); - checkpointfilestream << " NumberOfComponents\t" << components->size() << endl; + std::vector* components = _simulation.getEnsemble()->getComponents(); + checkpointfilestream << " NumberOfComponents\t" << components->size() << std::endl; for(auto pos=components->begin();pos!=components->end();++pos){ pos->write(checkpointfilestream); } @@ -547,7 +545,7 @@ void Domain::writeCheckpointHeader(string filename, iout++; // 2 parameters (xi and eta) if(iout/2>=numperline) { - checkpointfilestream << endl; + checkpointfilestream << std::endl; iout=0; --numperline; } @@ -558,7 +556,7 @@ void Domain::writeCheckpointHeader(string filename, checkpointfilestream << " "; } } - checkpointfilestream << _epsilonRF << endl; + checkpointfilestream << _epsilonRF << std::endl; for( auto uutit = this->_universalUndirectedThermostat.begin(); uutit != this->_universalUndirectedThermostat.end(); uutit++ ) @@ -566,47 +564,47 @@ void Domain::writeCheckpointHeader(string filename, if(0 > uutit->first) continue; if(uutit->second) checkpointfilestream << " U\t" << uutit->first << "\n"; } - checkpointfilestream << " NumberOfMolecules\t" << globalNumMolecules << endl; + checkpointfilestream << " NumberOfMolecules\t" << globalNumMolecules << std::endl; - checkpointfilestream << " MoleculeFormat\t" << Molecule::getWriteFormat() << endl; + checkpointfilestream << " MoleculeFormat\t" << Molecule::getWriteFormat() << std::endl; checkpointfilestream.close(); } } -void Domain::writeCheckpointHeaderXML(string filename, ParticleContainer* particleContainer, +void Domain::writeCheckpointHeaderXML(std::string filename, ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, double currentTime) { unsigned long globalNumMolecules = this->getglobalNumMolecules(true, particleContainer, domainDecomp); if(0 != domainDecomp->getRank() ) return; - ofstream ofs(filename.c_str() ); + std::ofstream ofs(filename.c_str() ); - ofs << "" << endl; - ofs << "" << endl; - ofs << "\t" << endl; - ios::fmtflags f( ofs.flags() ); - ofs << "\t\t" << endl; - ofs << "\t\t" << endl; + ofs << "" << std::endl; + ofs << "" << std::endl; + ofs << "\t" << std::endl; + std::ios::fmtflags f( ofs.flags() ); + ofs << "\t\t" << std::endl; + ofs << "\t\t" << std::endl; ofs << "\t\t\t" << FORMAT_SCI_MAX_DIGITS_WIDTH_21 << _globalLength[0] << " " "" << FORMAT_SCI_MAX_DIGITS_WIDTH_21 << _globalLength[1] << " " - "" << FORMAT_SCI_MAX_DIGITS_WIDTH_21 << _globalLength[2] << "" << endl; - ofs << "\t\t" << endl; + "" << FORMAT_SCI_MAX_DIGITS_WIDTH_21 << _globalLength[2] << "" << std::endl; + ofs << "\t\t" << std::endl; ofs.flags(f); // restore default format flags - ofs << "\t\t" << globalNumMolecules << "" << endl; - ofs << "\t\t" << endl; - ofs << "\t" << endl; - ofs << "" << endl; + ofs << "\t\t" << globalNumMolecules << "" << std::endl; + ofs << "\t\t" << std::endl; + ofs << "\t" << std::endl; + ofs << "" << std::endl; } -void Domain::writeCheckpoint(string filename, +void Domain::writeCheckpoint(std::string filename, ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, double currentTime, bool useBinaryFormat) { domainDecomp->assertDisjunctivity(particleContainer); #ifdef ENABLE_REDUCED_MEMORY_MODE - global_log->warning() << "The checkpoints are not adapted for RMM-mode. Velocity will be one half-timestep ahead!" << std::endl; - global_log->warning() << "See Domain::writeCheckpoint() for a suggested workaround." << std::endl; + Log::global_log->warning() << "The checkpoints are not adapted for RMM-mode. Velocity will be one half-timestep ahead!" << std::endl; + Log::global_log->warning() << "See Domain::writeCheckpoint() for a suggested workaround." << std::endl; //TODO: desired correctness (compatibility to normal mode) should be achievable by: // 1. integrating positions by half a timestep forward (+ delta T / 2) // 2. writing the checkpoint (with currentTime + delta T ? ) @@ -660,8 +658,8 @@ void Domain::setTargetTemperature(int thermostatID, double targetT) { if(thermostatID < 0) { - global_log->warning() << "Warning: thermostat \'" << thermostatID << "\' (T = " - << targetT << ") will be ignored." << endl; + Log::global_log->warning() << "Warning: thermostat \'" << thermostatID << "\' (T = " + << targetT << ") will be ignored." << std::endl; return; } @@ -672,20 +670,20 @@ void Domain::setTargetTemperature(int thermostatID, double targetT) /* FIXME: Substantial change in program behavior! */ if(thermostatID == 0) { #ifndef UNIT_TESTS - global_log->warning() << "Disabling the component wise thermostat!" << endl; + Log::global_log->warning() << "Disabling the component wise thermostat!" << std::endl; #endif disableComponentwiseThermostat(); } if(thermostatID >= 1) { if( ! _componentwiseThermostat ) { /* FIXME: Substantial change in program behavior! */ - global_log->warning() << "Enabling the component wise thermostat!" << endl; + Log::global_log->warning() << "Enabling the component wise thermostat!" << std::endl; _componentwiseThermostat = true; _universalTargetTemperature.erase(0); _universalUndirectedThermostat.erase(0); this->_universalThermostatDirectedVelocity.erase(0); - vector* components = _simulation.getEnsemble()->getComponents(); - for( vector::iterator tc = components->begin(); tc != components->end(); tc ++ ) { + std::vector* components = _simulation.getEnsemble()->getComponents(); + for( std::vector::iterator tc = components->begin(); tc != components->end(); tc ++ ) { if(!(this->_componentToThermostatIdMap[ tc->ID() ] > 0)) { this->_componentToThermostatIdMap[ tc->ID() ] = -1; } @@ -700,8 +698,8 @@ void Domain::enableComponentwiseThermostat() this->_componentwiseThermostat = true; this->_universalTargetTemperature.erase(0); - vector* components = _simulation.getEnsemble()->getComponents(); - for( vector::iterator tc = components->begin(); tc != components->end(); tc ++ ) { + std::vector* components = _simulation.getEnsemble()->getComponents(); + for( std::vector::iterator tc = components->begin(); tc != components->end(); tc ++ ) { if(!(this->_componentToThermostatIdMap[ tc->ID() ] > 0)) { this->_componentToThermostatIdMap[ tc->ID() ] = -1; } @@ -715,7 +713,7 @@ void Domain::enableUndirectedThermostat(int tst) this->_universalThermostatDirectedVelocity[tst].fill(0.0); } -vector & Domain::getmixcoeff() { return _mixcoeff; } +std::vector & Domain::getmixcoeff() { return _mixcoeff; } double Domain::getepsilonRF() const { return _epsilonRF; } @@ -725,15 +723,15 @@ unsigned long Domain::getglobalNumMolecules(bool bUpdate, ParticleContainer* par DomainDecompBase* domainDecomp) { if (bUpdate) { if (particleContainer == nullptr) { - global_log->debug() << "Domain::getglobalNumMolecules: Passed Particle Container is null! Fetching pointer " + Log::global_log->debug() << "Domain::getglobalNumMolecules: Passed Particle Container is null! Fetching pointer " "from global_simulation." - << endl; + << std::endl; particleContainer = global_simulation->getMoleculeContainer(); } if (domainDecomp == nullptr) { - global_log->debug() << "Domain::getglobalNumMolecules: Passed Domain Decomposition is null! Fetching " + Log::global_log->debug() << "Domain::getglobalNumMolecules: Passed Domain Decomposition is null! Fetching " "pointer from global_simulation." - << endl; + << std::endl; domainDecomp = &(global_simulation->domainDecomposition()); } this->updateglobalNumMolecules(particleContainer, domainDecomp); @@ -757,7 +755,7 @@ void Domain::updateglobalNumMolecules(ParticleContainer* particleContainer, Doma numMolecules.global = numMolecules.local; #endif this->setglobalNumMolecules(numMolecules.global); - global_log->debug() << "Updated global number of particles from " << oldNum << " to N_new = " << _globalNumMolecules << std::endl; + Log::global_log->debug() << "Updated global number of particles from " << oldNum << " to N_new = " << _globalNumMolecules << std::endl; } CommVar Domain::getMaxMoleculeID() const { @@ -855,7 +853,7 @@ void Domain::submitDU(unsigned /*cid*/, double DU, double* r) double Domain::getAverageGlobalUpotCSpec() { - global_log->debug() << "number of fluid molecules = " << getNumFluidMolecules() << "\n"; + Log::global_log->debug() << "number of fluid molecules = " << getNumFluidMolecules() << "\n"; return _globalUpotCspecif / getNumFluidMolecules(); } diff --git a/src/Domain.h b/src/Domain.h index 4f340fc33b..332dacedcc 100644 --- a/src/Domain.h +++ b/src/Domain.h @@ -12,8 +12,8 @@ #include "ensemble/EnsembleBase.h" #include "Simulation.h" #include "utils/CommVar.h" -/* - * TODO add comments for variables +/* + * TODO add comments for variables */ #define CHECKPOINT_FILE_VERSION 20160512 /**< checkpoint file version */ @@ -31,19 +31,19 @@ class XMLfileUnits; //! This class is responsible for all macroscopic values. //! It is important to differentiate between local and global version of those values //! Macroscopic values are values that aggregate some property of a set of molecules. -//! As this program is designed to run on a parallel computer, there are typically -//! several processes. Each process has an instance of this class, but with a different -//! subset of molecules. Therefore, also the macroscopic values are only representative -//! for the "local" domain of that process. +//! As this program is designed to run on a parallel computer, there are typically +//! several processes. Each process has an instance of this class, but with a different +//! subset of molecules. Therefore, also the macroscopic values are only representative +//! for the "local" domain of that process. //! //! member variables that represent "local" macroscopic values begin with _local //! //! properties of the global system begin with _global if only the rank 0 process //! obtains the correct value (e.g., as a sum over corresponding local properties) //! and with _universal if the global value must be communicated to all processes. -//! -//! At some points of the simulation, macroscopic values for the whole set of molecules -//! have to be calculated. Those values are stored in member variables beginning with _global. +//! +//! At some points of the simulation, macroscopic values for the whole set of molecules +//! have to be calculated. Those values are stored in member variables beginning with _global. class Domain { private: @@ -51,7 +51,7 @@ class Domain { Domain(Domain &domain); Domain& operator=(Domain &domain); - + public: //! The constructor sets _localRank to rank and initializes all member variables Domain(int rank); @@ -130,16 +130,16 @@ class Domain { //! @brief get the potential of the local process double getLocalUpot() const; - + //! @brief set the fluid and fluid-solid potential of the local process void setLocalUpotCompSpecific(double UpotCspec); //! @brief set the number of fluid phase components (specified in the config-file) void setNumFluidComponents(unsigned nc); - + //! @brief get the numbr of fluid molecules as specified in the config file (*_1R.cfg) unsigned getNumFluidComponents(); - + //! @brief get the fluid and fluid-solid potential of the local process double getLocalUpotCompSpecific(); @@ -148,7 +148,7 @@ class Domain { //! @brief get the virial of the local process double getLocalVirial() const; - + //! @brief get thermostat scaling for translations double getGlobalBetaTrans(); double getGlobalBetaTrans(int thermostat); @@ -200,7 +200,7 @@ class Domain { //! @brief set globalNumMolecules void setglobalNumMolecules(unsigned long glnummol); - + //! @brief update globalNumMolecules //! This method must be called by all processes and not just by root! void updateglobalNumMolecules(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp); @@ -225,7 +225,7 @@ class Domain { double getAverageGlobalUpotCSpec(); //! by Stefan Becker: determine and return the totel number of fluid molecules - //! this method assumes all molecules with a component-ID less than _numFluidComponent to be fluid molecules + //! this method assumes all molecules with a component-ID less than _numFluidComponent to be fluid molecules unsigned long getNumFluidMolecules(); //! @brief get the global average virial per particle @@ -245,7 +245,7 @@ class Domain { this->_localThermostatN[thermostat] = N; this->_localRotationalDOF[thermostat] = rotDOF; } - + //! @brief get globalRho double getglobalRho(); @@ -384,12 +384,12 @@ class Domain { double cv(); // by Stefan Becker - /* method returning the sigma parameter of a component + /* method returning the sigma parameter of a component => needed in the output of the MmspdWriter (specifying the particles' radii in a movie) */ double getSigma(unsigned cid, unsigned nthSigma); // needed for the MmspdWriter (MegaMol) unsigned getNumberOfComponents(); - + void setUpotCorr(double upotcorr){ _UpotCorr = upotcorr; } void setVirialCorr(double virialcorr){ _VirialCorr = virialcorr; } @@ -405,7 +405,7 @@ class Domain { double _localUpot; //! by Stefan Becker: component specific potential of the local process (fluid-fluid and fluid-solid, but not solid-solid) double _localUpotCspecif; - //! by Stefan Becker: number of fluid components specified in the config file + //! by Stefan Becker: number of fluid components specified in the config file //! --> used to determine the average component specific potential energy unsigned _numFluidComponent; @@ -474,8 +474,8 @@ class Domain { std::map _local2KETrans; //! local sum (over all molecules) of the moment of inertia //! multiplied with the squared rotational velocity - std::map _local2KERot; - + std::map _local2KERot; + //! reaction field //! //! This is neither "local" nor "global" but a parameter of the reaction field method. diff --git a/src/MarDyn.cpp b/src/MarDyn.cpp index 964f5ae00d..a1468b90b5 100644 --- a/src/MarDyn.cpp +++ b/src/MarDyn.cpp @@ -25,8 +25,7 @@ #include "autopas/Version.h" #endif -using Log::global_log; -using std::endl; + using optparse::Values; /** @@ -60,45 +59,45 @@ void initOptions(optparse::OptionParser *op) { * @brief Helper function outputting program build information to given logger */ void program_build_info(Log::Logger *log) { - log->info() << "Compilation info:" << endl; + log->info() << "Compilation info:" << std::endl; char info_str[MAX_INFO_STRING_LENGTH]; get_compiler_info(info_str); - log->info() << " Compiler: " << info_str << endl; + log->info() << " Compiler: " << info_str << std::endl; get_compile_time(info_str); - log->info() << " Compiled on: " << info_str << endl; + log->info() << " Compiled on: " << info_str << std::endl; get_precision_info(info_str); - log->info() << " Precision: " << info_str << endl; + log->info() << " Precision: " << info_str << std::endl; get_intrinsics_info(info_str); - log->info() << " Intrinsics: " << info_str << endl; + log->info() << " Intrinsics: " << info_str << std::endl; get_rmm_normal_info(info_str); - log->info() << " RMM/normal: " << info_str << endl; + log->info() << " RMM/normal: " << info_str << std::endl; get_openmp_info(info_str); - log->info() << " OpenMP: " << info_str << endl; + log->info() << " OpenMP: " << info_str << std::endl; get_mpi_info(info_str); - log->info() << " MPI: " << info_str << endl; + log->info() << " MPI: " << info_str << std::endl; } /** * @brief Helper function outputting program invocation information to given logger */ void program_execution_info(int argc, char **argv, Log::Logger *log) { - log->info() << "Execution info:" << endl; + log->info() << "Execution info:" << std::endl; char info_str[MAX_INFO_STRING_LENGTH]; get_timestamp(info_str); - log->info() << " Started: " << info_str << endl; + log->info() << " Started: " << info_str << std::endl; get_host(info_str); - log->info() << " Execution host: " << info_str << endl; + log->info() << " Execution host: " << info_str << std::endl; std::stringstream arguments; for (int i = 0; i < argc; i++) { arguments << " " << argv[i]; } - log->info() << " Started with arguments: " << arguments.str() << endl; + log->info() << " Started with arguments: " << arguments.str() << std::endl; #if defined(_OPENMP) int num_threads = mardyn_get_max_threads(); - global_log->info() << " Running with " << num_threads << " OpenMP threads." << endl; + Log::global_log->info() << " Running with " << num_threads << " OpenMP threads." << std::endl; // print thread pinning info PrintThreadPinningToCPU(); #endif @@ -106,21 +105,21 @@ void program_execution_info(int argc, char **argv, Log::Logger *log) { #ifdef ENABLE_MPI int world_size = 1; MPI_CHECK(MPI_Comm_size(MPI_COMM_WORLD, &world_size)); - global_log->info() << " Running with " << world_size << " MPI processes." << endl; + Log::global_log->info() << " Running with " << world_size << " MPI processes." << std::endl; #endif } /** Run the internal unit tests */ -int run_unit_tests(const Values &options, const vector &args) { - string testcases(""); +int run_unit_tests(const Values &options, const std::vector &args) { + std::string testcases(""); if(args.size() == 1) { testcases = args[0]; - global_log->info() << "Running unit tests: " << testcases << endl; + Log::global_log->info() << "Running unit tests: " << testcases << std::endl; } else { - global_log->info() << "Running all unit tests!" << endl; + Log::global_log->info() << "Running all unit tests!" << std::endl; } std::string testDataDirectory(options.get("testDataDirectory")); - global_log->info() << "Test data directory: " << testDataDirectory << endl; + Log::global_log->info() << "Test data directory: " << testDataDirectory << std::endl; Log::logLevel testLogLevel = (options.is_set("verbose") && options.get("verbose")) ? Log::All : Log::Info; int testresult = runTests(testLogLevel, testDataDirectory, testcases); return testresult; @@ -137,45 +136,45 @@ int main(int argc, char** argv) { #endif /* Initialize the global log file */ - global_log = new Log::Logger(Log::Info); + Log::global_log = new Log::Logger(Log::Info); #ifdef ENABLE_MPI - global_log->set_mpi_output_root(0); + Log::global_log->set_mpi_output_root(0); //global_log->set_mpi_output_all(); #endif optparse::OptionParser op; initOptions(&op); optparse::Values options = op.parse_args(argc, argv); - vector args = op.args(); + std::vector args = op.args(); - global_log->info() << "Running ls1-MarDyn version " << MARDYN_VERSION << endl; + Log::global_log->info() << "Running ls1-MarDyn version " << MARDYN_VERSION << std::endl; #ifdef MARDYN_AUTOPAS - global_log->info() << "Built with AutoPas version " << AutoPas_VERSION << std::endl; + Log::global_log->info() << "Built with AutoPas version " << AutoPas_VERSION << std::endl; #endif #ifndef NDEBUG - global_log->warning() << "This ls1-MarDyn binary is a DEBUG build!" << endl; + Log::global_log->warning() << "This ls1-MarDyn binary is a DEBUG build!" << std::endl; #endif if( options.is_set_by_user("logfile") ) { - string logfileNamePrefix(options.get("logfile")); - global_log->info() << "Using logfile with prefix " << logfileNamePrefix << endl; - delete global_log; - global_log = new Log::Logger(Log::Info, logfileNamePrefix); + std::string logfileNamePrefix(options.get("logfile")); + Log::global_log->info() << "Using logfile with prefix " << logfileNamePrefix << std::endl; + delete Log::global_log; + Log::global_log = new Log::Logger(Log::Info, logfileNamePrefix); } if( options.is_set_by_user("verbose") ) { - global_log->info() << "Enabling verbose log output." << endl; - global_log->set_log_level(Log::All); + Log::global_log->info() << "Enabling verbose log output." << std::endl; + Log::global_log->set_log_level(Log::All); } #ifdef ENABLE_SIGHANDLER if (options.is_set_by_user("sigsegvhandler")) { - global_log->info() << "Enabling sigsegvhandler." << endl; + Log::global_log->info() << "Enabling sigsegvhandler." << std::endl; registerSigsegvHandler(); // from SigsegvHandler.h } #endif - program_build_info(global_log); - program_execution_info(argc, argv, global_log); + program_build_info(Log::global_log); + program_execution_info(argc, argv, Log::global_log); /* Run built in tests and exit */ @@ -193,38 +192,38 @@ int main(int argc, char** argv) { auto numArgs = args.size(); if(numArgs != 1) { - global_log->error() << "Incorrect number of arguments provided." << std::endl; + Log::global_log->error() << "Incorrect number of arguments provided." << std::endl; op.print_usage(); Simulation::exit(-1); } /* First read the given config file if it exists, then overwrite parameters with command line arguments. */ std::string configFileName(args[0]); if( fileExists(configFileName.c_str()) ) { - global_log->info() << "Config file: " << configFileName << endl; + Log::global_log->info() << "Config file: " << configFileName << std::endl; simulation.readConfigFile(configFileName); } else { - global_log->error() << "Cannot open config file '" << configFileName << "'" << endl; + Log::global_log->error() << "Cannot open config file '" << configFileName << "'" << std::endl; Simulation::exit(-2); } /* processing command line arguments */ if ( (int) options.get("legacy-cell-processor") > 0 ) { simulation.useLegacyCellProcessor(); - global_log->info() << "--legacy-cell-processor specified, using legacyCellProcessor" << endl; + Log::global_log->info() << "--legacy-cell-processor specified, using legacyCellProcessor" << std::endl; } if ( (int) options.get("final-checkpoint") > 0 ) { simulation.enableFinalCheckpoint(); - global_log->info() << "Final checkpoint enabled" << endl; + Log::global_log->info() << "Final checkpoint enabled" << std::endl; } else { simulation.disableFinalCheckpoint(); - global_log->info() << "Final checkpoint disabled." << endl; + Log::global_log->info() << "Final checkpoint disabled." << std::endl; } if( options.is_set_by_user("timed-checkpoint") ) { double checkpointtime = options.get("timed-checkpoint"); simulation.setForcedCheckpointTime(checkpointtime); - global_log->info() << "Enabling checkpoint after execution time: " << checkpointtime << " sec" << endl; + Log::global_log->info() << "Enabling checkpoint after execution time: " << checkpointtime << " sec" << std::endl; } if (options.is_set_by_user("timesteps")) { @@ -233,10 +232,10 @@ int main(int argc, char** argv) { if (options.is_set_by_user("loop-abort-time")) { simulation.setLoopAbortTime(options.get("loop-abort-time").operator double()); } - global_log->info() << "Simulating " << simulation.getNumTimesteps() << " steps." << endl; + Log::global_log->info() << "Simulating " << simulation.getNumTimesteps() << " steps." << std::endl; if(options.is_set_by_user("print-meminfo")) { - global_log->info() << "Enabling memory info output" << endl; + Log::global_log->info() << "Enabling memory info output" << std::endl; simulation.enableMemoryProfiler(); } size_t lastIndex = configFileName.rfind("."); @@ -245,7 +244,7 @@ int main(int argc, char** argv) { outPrefix = options["outputprefix"]; } simulation.setOutputPrefix(outPrefix.c_str()); - global_log->info() << "Default output prefix: " << simulation.getOutputPrefix() << endl; + Log::global_log->info() << "Default output prefix: " << simulation.getOutputPrefix() << std::endl; simulation.prepare_start(); @@ -256,17 +255,17 @@ int main(int argc, char** argv) { sim_timer.stop(); double runtime = sim_timer.get_etime(); //!@todo time only for simulation.simulate not "main"! - global_log->info() << "main: used " << fixed << setprecision(2) << runtime << " seconds" << endl << fixed << setprecision(5); - // FIXME: The statements "<< fixed << setprecision(5)" after endl are so that the next logger timestamp appears as expected. A better solution would be nice, of course. + Log::global_log->info() << "main: used " << std::fixed << std::setprecision(2) << runtime << " seconds" << std::endl << std::fixed << std::setprecision(5); + // FIXME: The statements "<< std::fixed << std::setprecision(5)" after endl are so that the next logger timestamp appears as expected. A better solution would be nice, of course. // print out total simulation speed const unsigned long numTimesteps = simulation.getNumTimesteps() - simulation.getNumInitTimesteps(); const double speed = simulation.getTotalNumberOfMolecules() * numTimesteps / runtime; - global_log->info() << "Simulation speed: " << scientific << setprecision(6) << speed << " Molecule-updates per second." << endl << fixed << setprecision(5); + Log::global_log->info() << "Simulation speed: " << std::scientific << std::setprecision(6) << speed << " Molecule-updates per second." << std::endl << std::fixed << std::setprecision(5); const double iterationsPerSecond = numTimesteps / runtime; - global_log->info() << "Iterations per second: " << fixed << setprecision(3) << iterationsPerSecond << endl << fixed << setprecision(5); - global_log->info() << "Time per iteration: " << fixed << setprecision(3) << 1.0 / iterationsPerSecond << " seconds." << endl << fixed << setprecision(5); + Log::global_log->info() << "Iterations per second: " << std::fixed << std::setprecision(3) << iterationsPerSecond << std::endl << std::fixed << std::setprecision(5); + Log::global_log->info() << "Time per iteration: " << std::fixed << std::setprecision(3) << 1.0 / iterationsPerSecond << " seconds." << std::endl << std::fixed << std::setprecision(5); double resources = runtime / 3600.0; #if defined(_OPENMP) @@ -278,11 +277,11 @@ int main(int argc, char** argv) { MPI_CHECK(MPI_Comm_size(MPI_COMM_WORLD, &world_size)); resources *= world_size; #endif - global_log->info() << "Used resources: " << fixed << setprecision(3) << resources << " core-hours" << endl << fixed << setprecision(5); + Log::global_log->info() << "Used resources: " << std::fixed << std::setprecision(3) << resources << " core-hours" << std::endl << std::fixed << std::setprecision(5); simulation.finalize(); - delete global_log; + delete Log::global_log; #ifdef ENABLE_MPI MPI_Finalize(); diff --git a/src/Simulation.cpp b/src/Simulation.cpp index ed3d3c11fa..aa55939f72 100644 --- a/src/Simulation.cpp +++ b/src/Simulation.cpp @@ -84,9 +84,6 @@ #include #endif -using Log::global_log; -using namespace std; - Simulation* global_simulation; Simulation::Simulation() @@ -173,61 +170,61 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { /* integrator */ if(xmlconfig.changecurrentnode("integrator")) { - string integratorType; + std::string integratorType; xmlconfig.getNodeValue("@type", integratorType); - global_log->info() << "Integrator type: " << integratorType << endl; + Log::global_log->info() << "Integrator type: " << integratorType << std::endl; if(integratorType == "Leapfrog") { #ifdef ENABLE_REDUCED_MEMORY_MODE - global_log->error() << "The reduced memory mode (RMM) requires the LeapfrogRMM integrator." << endl; + Log::global_log->error() << "The reduced memory mode (RMM) requires the LeapfrogRMM integrator." << std::endl; Simulation::exit(-1); #endif _integrator = new Leapfrog(); } else if (integratorType == "LeapfrogRMM") { _integrator = new LeapfrogRMM(); } else { - global_log-> error() << "Unknown integrator " << integratorType << endl; + Log::global_log-> error() << "Unknown integrator " << integratorType << std::endl; Simulation::exit(1); } _integrator->readXML(xmlconfig); _integrator->init(); xmlconfig.changecurrentnode(".."); } else { - global_log->error() << "Integrator section missing." << endl; + Log::global_log->error() << "Integrator section missing." << std::endl; } /* run section */ if(xmlconfig.changecurrentnode("run")) { xmlconfig.getNodeValueReduced("currenttime", _simulationTime); - global_log->info() << "Simulation start time: " << _simulationTime << endl; + Log::global_log->info() << "Simulation start time: " << _simulationTime << std::endl; /* steps */ xmlconfig.getNodeValue("equilibration/steps", _initStatistics); - global_log->info() << "Number of equilibration steps: " << _initStatistics << endl; + Log::global_log->info() << "Number of equilibration steps: " << _initStatistics << std::endl; xmlconfig.getNodeValue("production/steps", _numberOfTimesteps); - global_log->info() << "Number of timesteps: " << _numberOfTimesteps << endl; + Log::global_log->info() << "Number of timesteps: " << _numberOfTimesteps << std::endl; xmlconfig.getNodeValue("production/loop-abort-time", _maxWallTime); if(_maxWallTime != -1) { - global_log->info() << "Max loop-abort-time set: " << _maxWallTime << endl; + Log::global_log->info() << "Max loop-abort-time set: " << _maxWallTime << std::endl; _wallTimeEnabled = true; } xmlconfig.changecurrentnode(".."); } else { - global_log->error() << "Run section missing." << endl; + Log::global_log->error() << "Run section missing." << std::endl; } /* ensemble */ if(xmlconfig.changecurrentnode("ensemble")) { - string ensembletype; + std::string ensembletype; xmlconfig.getNodeValue("@type", ensembletype); - global_log->info() << "Ensemble: " << ensembletype<< endl; + Log::global_log->info() << "Ensemble: " << ensembletype<< std::endl; if (ensembletype == "NVT") { delete _ensemble; _ensemble = new CanonicalEnsemble(); } else if (ensembletype == "muVT") { - global_log->error() << "muVT ensemble not completely implemented via XML input." << endl; + Log::global_log->error() << "muVT ensemble not completely implemented via XML input." << std::endl; /* TODO: GrandCanonical terminates as readXML is not implemented and it is not tested yet. */ _ensemble = new GrandCanonicalEnsemble(); } else { - global_log->error() << "Unknown ensemble type: " << ensembletype << endl; + Log::global_log->error() << "Unknown ensemble type: " << ensembletype << std::endl; Simulation::exit(1); } _ensemble->readXML(xmlconfig); @@ -240,7 +237,7 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { xmlconfig.changecurrentnode(".."); } else { - global_log->error() << "Ensemble section missing." << endl; + Log::global_log->error() << "Ensemble section missing." << std::endl; Simulation::exit(1); } @@ -251,8 +248,8 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { //1 Comps: 0 coeffs; 2 Comps: 2 coeffs; 3 Comps: 6 coeffs; 4 Comps 12 coeffs const std::size_t neededCoeffs = compNum*(compNum-1); if(dmixcoeff.size() < neededCoeffs){ - global_log->warning() << "Not enough mixing coefficients were given! (Filling the missing ones with 1)" << '\n'; - global_log->warning() << "This can happen because the xml-input doesn't support these yet!" << endl; + Log::global_log->warning() << "Not enough mixing coefficients were given! (Filling the missing ones with 1)" << '\n'; + Log::global_log->warning() << "This can happen because the xml-input doesn't support these yet!" << std::endl; unsigned int numcomponents = _simulation.getEnsemble()->getComponents()->size(); for (unsigned int i = dmixcoeff.size(); i < neededCoeffs; i++) { dmixcoeff.push_back(1); @@ -264,25 +261,25 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { /* cutoffs */ if(xmlconfig.changecurrentnode("cutoffs")) { if(xmlconfig.getNodeValueReduced("defaultCutoff", _cutoffRadius)) { - global_log->info() << "dimensionless default cutoff radius:\t" << _cutoffRadius << endl; + Log::global_log->info() << "dimensionless default cutoff radius:\t" << _cutoffRadius << std::endl; } if(xmlconfig.getNodeValueReduced("radiusLJ", _LJCutoffRadius)) { - global_log->info() << "dimensionless LJ cutoff radius:\t" << _LJCutoffRadius << endl; + Log::global_log->info() << "dimensionless LJ cutoff radius:\t" << _LJCutoffRadius << std::endl; for(auto &component: *(_ensemble->getComponents())) { component.updateAllLJcentersShift(_LJCutoffRadius); } } /** @todo introduce maxCutoffRadius here for datastructures, ... * maybe use map/list to store cutoffs for different potentials? */ - _cutoffRadius = max(_cutoffRadius, _LJCutoffRadius); + _cutoffRadius = std::max(_cutoffRadius, _LJCutoffRadius); if(_cutoffRadius <= 0) { - global_log->error() << "cutoff radius <= 0." << endl; + Log::global_log->error() << "cutoff radius <= 0." << std::endl; Simulation::exit(1); } - global_log->info() << "dimensionless cutoff radius:\t" << _cutoffRadius << endl; + Log::global_log->info() << "dimensionless cutoff radius:\t" << _cutoffRadius << std::endl; xmlconfig.changecurrentnode(".."); } else { - global_log->error() << "Cutoff section missing." << endl; + Log::global_log->error() << "Cutoff section missing." << std::endl; Simulation::exit(1); } @@ -291,17 +288,17 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { if(xmlconfig.changecurrentnode("electrostatic[@type='ReactionField']")) { double epsilonRF = 0; xmlconfig.getNodeValueReduced("epsilon", epsilonRF); - global_log->info() << "Epsilon Reaction Field: " << epsilonRF << endl; + Log::global_log->info() << "Epsilon Reaction Field: " << epsilonRF << std::endl; _domain->setepsilonRF(epsilonRF); xmlconfig.changecurrentnode(".."); } else { - global_log->error() << "Electrostatics section for reaction field setup missing." << endl; + Log::global_log->error() << "Electrostatics section for reaction field setup missing." << std::endl; Simulation::exit(1); } if (xmlconfig.changecurrentnode("electrostatic[@type='FastMultipoleMethod']")) { #ifdef MARDYN_AUTOPAS - global_log->fatal() + Log::global_log->fatal() << "The fast multipole method is not compatible with AutoPas. Please disable the AutoPas mode (ENABLE_AUTOPAS)!" << std::endl; Simulation::exit(1); @@ -313,15 +310,15 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { /* parallelisation */ if(xmlconfig.changecurrentnode("parallelisation")) { - string parallelisationtype("DomainDecomposition"); + std::string parallelisationtype("DomainDecomposition"); xmlconfig.getNodeValue("@type", parallelisationtype); - global_log->info() << "Parallelisation type: " << parallelisationtype << endl; + Log::global_log->info() << "Parallelisation type: " << parallelisationtype << std::endl; xmlconfig.getNodeValue("overlappingP2P", _overlappingP2P); - global_log->info() << "Using overlapping p2p communication: " << _overlappingP2P << endl; + Log::global_log->info() << "Using overlapping p2p communication: " << _overlappingP2P << std::endl; #ifdef ENABLE_MPI /// @todo Dummy Decomposition now included in DecompBase - still keep this name? if(parallelisationtype == "DummyDecomposition") { - global_log->error() << "DummyDecomposition not available in parallel mode." << endl; + Log::global_log->error() << "DummyDecomposition not available in parallel mode." << std::endl; } else if(parallelisationtype == "DomainDecomposition") { delete _domainDecomposition; @@ -342,50 +339,50 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { // container's xml, because the ParticleContainer needs to be instantiated later. :/ xmlconfig.changecurrentnode(".."); if (xmlconfig.changecurrentnode("datastructure")) { - string datastructuretype; + std::string datastructuretype; xmlconfig.getNodeValue("@type", datastructuretype); if (datastructuretype == "AutoPas" or datastructuretype == "AutoPasContainer") { // check if skin is specified if (xmlconfig.getNodeValue("skin", skin) == 0) { - global_log->error() << "Skin not set in datastructure/AutoPas. " + Log::global_log->error() << "Skin not set in datastructure/AutoPas. " "This will lead to a different interaction length in the container " "vs the GeneralDomainDecomposition which can lead ALL to shrink the " "domain too small." - << endl; + << std::endl; this->exit(512435340); } } else { - global_log->warning() << "Using the GeneralDomainDecomposition without AutoPas is not " + Log::global_log->warning() << "Using the GeneralDomainDecomposition without AutoPas is not " "thoroughly tested and considered BETA." - << endl; + << std::endl; // Force grid! This is needed, as the linked cells container assumes a grid and the calculation // of global values will be faulty without one! - global_log->info() << "Forcing a grid for the GeneralDomainDecomposition! This is required " + Log::global_log->info() << "Forcing a grid for the GeneralDomainDecomposition! This is required " "to get correct global values!" - << endl; + << std::endl; forceLatchingToLinkedCellsGrid = true; } - global_log->info() << "Using skin = " << skin << " for the GeneralDomainDecomposition." << std::endl; + Log::global_log->info() << "Using skin = " << skin << " for the GeneralDomainDecomposition." << std::endl; } else { - global_log->error() << "Datastructure section missing" << endl; + Log::global_log->error() << "Datastructure section missing" << std::endl; Simulation::exit(1); } if(not xmlconfig.changecurrentnode("../parallelisation")){ - global_log->error() << "Could not go back to parallelisation path. Aborting." << endl; + Log::global_log->error() << "Could not go back to parallelisation path. Aborting." << std::endl; Simulation::exit(1); } delete _domainDecomposition; _domainDecomposition = new GeneralDomainDecomposition(getcutoffRadius() + skin, _domain, forceLatchingToLinkedCellsGrid); } else { - global_log->error() << "Unknown parallelisation type: " << parallelisationtype << endl; + Log::global_log->error() << "Unknown parallelisation type: " << parallelisationtype << std::endl; Simulation::exit(1); } #else /* serial */ if(parallelisationtype != "DummyDecomposition") { - global_log->warning() + Log::global_log->warning() << "Executable was compiled without support for parallel execution: " << parallelisationtype - << " not available. Using serial mode." << endl; + << " not available. Using serial mode." << std::endl; //Simulation::exit(1); } //_domainDecomposition = new DomainDecompBase(); // already set in initialize() @@ -397,22 +394,22 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { } #endif - string loadTimerStr("SIMULATION_FORCE_CALCULATION"); + std::string loadTimerStr("SIMULATION_FORCE_CALCULATION"); xmlconfig.getNodeValue("timerForLoad", loadTimerStr); - global_log->info() << "Using timer " << loadTimerStr << " for the load calculation." << std::endl; + Log::global_log->info() << "Using timer " << loadTimerStr << " for the load calculation." << std::endl; _timerForLoad = timers()->getTimer(loadTimerStr); if (not _timerForLoad) { - global_log->error() << "'timerForLoad' set to a timer that does not exist('" << loadTimerStr + Log::global_log->error() << "'timerForLoad' set to a timer that does not exist('" << loadTimerStr << "')! Aborting!" << std::endl; exit(1); } std::size_t timerForLoadAveragingLength{1ul}; xmlconfig.getNodeValue("timerForLoad_AveragingLength", timerForLoadAveragingLength); - global_log->info() << "Averaging over " << timerForLoadAveragingLength + Log::global_log->info() << "Averaging over " << timerForLoadAveragingLength << "time steps for the load calculation." << std::endl; if(timerForLoadAveragingLength < 1ul) { - global_log->fatal() << "timerForLoadAveragingLength has to be at least 1" << std::endl; + Log::global_log->fatal() << "timerForLoadAveragingLength has to be at least 1" << std::endl; Simulation::exit(15843); } _lastTraversalTimeHistory.setCapacity(timerForLoadAveragingLength); @@ -421,7 +418,7 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { } else { #ifdef ENABLE_MPI - global_log->error() << "Parallelisation section missing." << endl; + Log::global_log->error() << "Parallelisation section missing." << std::endl; Simulation::exit(1); #else /* serial */ // set _timerForLoad, s.t. it always exists. @@ -432,36 +429,36 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { /* datastructure */ if(xmlconfig.changecurrentnode("datastructure")) { - string datastructuretype; + std::string datastructuretype; xmlconfig.getNodeValue("@type", datastructuretype); - global_log->info() << "Datastructure type: " << datastructuretype << endl; + Log::global_log->info() << "Datastructure type: " << datastructuretype << std::endl; if(datastructuretype == "LinkedCells") { #ifdef MARDYN_AUTOPAS - global_log->fatal() + Log::global_log->fatal() << "LinkedCells not compiled (use AutoPas instead, or compile with disabled autopas mode)!" << std::endl; Simulation::exit(33); #else _moleculeContainer = new LinkedCells(); /** @todo Review if we need to know the max cutoff radius usable with any datastructure. */ - global_log->info() << "Setting cell cutoff radius for linked cell datastructure to " << _cutoffRadius << endl; + Log::global_log->info() << "Setting cell cutoff radius for linked cell datastructure to " << _cutoffRadius << std::endl; _moleculeContainer->setCutoff(_cutoffRadius); #endif } else if(datastructuretype == "AdaptiveSubCells") { - global_log->warning() << "AdaptiveSubCells no longer supported." << std::endl; + Log::global_log->warning() << "AdaptiveSubCells no longer supported." << std::endl; Simulation::exit(-1); } else if(datastructuretype == "AutoPas" || datastructuretype == "AutoPasContainer") { #ifdef MARDYN_AUTOPAS - global_log->info() << "Using AutoPas container." << std::endl; + Log::global_log->info() << "Using AutoPas container." << std::endl; _moleculeContainer = new AutoPasContainer(_cutoffRadius); - global_log->info() << "Setting cell cutoff radius for AutoPas container to " << _cutoffRadius << endl; + Log::global_log->info() << "Setting cell cutoff radius for AutoPas container to " << _cutoffRadius << std::endl; #else - global_log->fatal() << "AutoPas not compiled (use LinkedCells instead, or compile with enabled autopas mode)!" << std::endl; + Log::global_log->fatal() << "AutoPas not compiled (use LinkedCells instead, or compile with enabled autopas mode)!" << std::endl; Simulation::exit(33); #endif } else { - global_log->error() << "Unknown data structure type: " << datastructuretype << endl; + Log::global_log->error() << "Unknown data structure type: " << datastructuretype << std::endl; Simulation::exit(1); } _moleculeContainer->readXML(xmlconfig); @@ -473,7 +470,7 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { _domainDecomposition->updateSendLeavingWithCopies(sendTogether); xmlconfig.changecurrentnode(".."); } else { - global_log->error() << "Datastructure section missing" << endl; + Log::global_log->error() << "Datastructure section missing" << std::endl; Simulation::exit(1); } @@ -483,32 +480,32 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { long numThermostats = 0; XMLfile::Query query = xmlconfig.query("thermostat"); numThermostats = query.card(); - global_log->info() << "Number of thermostats: " << numThermostats << endl; + Log::global_log->info() << "Number of thermostats: " << numThermostats << std::endl; if(numThermostats > 1) { - global_log->info() << "Enabling component wise thermostat" << endl; + Log::global_log->info() << "Enabling component wise thermostat" << std::endl; _velocityScalingThermostat.enableComponentwise(); } - string oldpath = xmlconfig.getcurrentnodepath(); + std::string oldpath = xmlconfig.getcurrentnodepath(); XMLfile::Query::const_iterator thermostatIter; for( thermostatIter = query.begin(); thermostatIter; thermostatIter++ ) { xmlconfig.changecurrentnode( thermostatIter ); - string thermostattype; + std::string thermostattype; xmlconfig.getNodeValue("@type", thermostattype); if(thermostattype == "VelocityScaling") { double temperature = _ensemble->T(); xmlconfig.getNodeValue("temperature", temperature); - string componentName("global"); + std::string componentName("global"); xmlconfig.getNodeValue("@componentId", componentName); if(componentName == "global"){ _domain->setGlobalTemperature(temperature); - global_log->info() << "Adding global velocity scaling thermostat, T = " << temperature << endl; + Log::global_log->info() << "Adding global velocity scaling thermostat, T = " << temperature << std::endl; } else { int componentId = 0; componentId = getEnsemble()->getComponent(componentName)->ID(); int thermostatID = _domain->getThermostat(componentId); _domain->setTargetTemperature(thermostatID, temperature); - global_log->info() << "Adding velocity scaling thermostat for component '" << componentName << "' (ID: " << componentId << "), T = " << temperature << endl; + Log::global_log->info() << "Adding velocity scaling thermostat for component '" << componentName << "' (ID: " << componentId << "), T = " << temperature << std::endl; } } else if(thermostattype == "TemperatureControl") { @@ -516,14 +513,14 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { _temperatureControl = new TemperatureControl(); _temperatureControl->readXML(xmlconfig); } else { - global_log->error() << "Instance of TemperatureControl allready exist! Programm exit ..." - << endl; + Log::global_log->error() << "Instance of TemperatureControl allready exist! Programm exit ..." + << std::endl; Simulation::exit(-1); } } else { - global_log->warning() << "Unknown thermostat " << thermostattype << endl; + Log::global_log->warning() << "Unknown thermostat " << thermostattype << std::endl; continue; } } @@ -531,7 +528,7 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { xmlconfig.changecurrentnode(".."); } else { - global_log->warning() << "Thermostats section missing." << endl; + Log::global_log->warning() << "Thermostats section missing." << std::endl; } /* long range correction */ @@ -540,21 +537,21 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { std::string type; if( !xmlconfig.getNodeValue("@type", type) ) { - global_log->error() << "LongRangeCorrection: Missing type specification. Program exit ..." << endl; + Log::global_log->error() << "LongRangeCorrection: Missing type specification. Program exit ..." << std::endl; Simulation::exit(-1); } if("planar" == type) { unsigned int nSlabs = 10; delete _longRangeCorrection; - global_log->info() << "Initializing planar LRC." << endl; + Log::global_log->info() << "Initializing planar LRC." << std::endl; _longRangeCorrection = new Planar(_cutoffRadius, _LJCutoffRadius, _domain, _domainDecomposition, _moleculeContainer, nSlabs, global_simulation); _longRangeCorrection->readXML(xmlconfig); } else if("homogeneous" == type) { delete _longRangeCorrection; - global_log->info() << "Initializing homogeneous LRC." << endl; + Log::global_log->info() << "Initializing homogeneous LRC." << std::endl; _longRangeCorrection = new Homogeneous(_cutoffRadius, _LJCutoffRadius, _domain, global_simulation); } else if("none" == type) @@ -564,53 +561,53 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { } else { - global_log->error() << "LongRangeCorrection: Wrong type. Expected type == homogeneous|planar|none. Program exit ..." << endl; + Log::global_log->error() << "LongRangeCorrection: Wrong type. Expected type == homogeneous|planar|none. Program exit ..." << std::endl; Simulation::exit(-1); } xmlconfig.changecurrentnode(".."); } else { delete _longRangeCorrection; - global_log->info() << "Initializing default homogeneous LRC, as no LRC was defined." << endl; + Log::global_log->info() << "Initializing default homogeneous LRC, as no LRC was defined." << std::endl; _longRangeCorrection = new Homogeneous(_cutoffRadius, _LJCutoffRadius, _domain, global_simulation); } xmlconfig.changecurrentnode(".."); /* algorithm section */ } else { - global_log->error() << "Algorithm section missing." << endl; + Log::global_log->error() << "Algorithm section missing." << std::endl; } - global_log -> info() << "Registering default plugins..." << endl; + Log::global_log -> info() << "Registering default plugins..." << std::endl; // REGISTERING/ENABLING PLUGINS PluginFactory pluginFactory; pluginFactory.registerDefaultPlugins(); - global_log -> info() << "Successfully registered plugins." << endl; + Log::global_log -> info() << "Successfully registered plugins." << std::endl; long numPlugs = 0; numPlugs += pluginFactory.enablePlugins(_plugins, xmlconfig, "plugin", _domain); numPlugs += pluginFactory.enablePlugins(_plugins, xmlconfig, "output/outputplugin", _domain); - global_log -> info() << "Number of enabled Plugins: " << numPlugs << endl; + Log::global_log -> info() << "Number of enabled Plugins: " << numPlugs << std::endl; - global_log -> info() << "Registering callbacks." << endl; + Log::global_log -> info() << "Registering callbacks." << std::endl; for(auto&& plugin : _plugins) { plugin->registerCallbacks(_callbacks); } - global_log -> info() << _callbacks.size() << " callbacks registered." << endl; + Log::global_log -> info() << _callbacks.size() << " callbacks registered." << std::endl; - global_log -> info() << "Accessing callbacks." << endl; + Log::global_log -> info() << "Accessing callbacks." << std::endl; for(auto&& plugin : _plugins) { plugin->accessAllCallbacks(_callbacks); } - global_log -> info() << "Accessed callbacks." << endl; + Log::global_log -> info() << "Accessed callbacks." << std::endl; - string oldpath = xmlconfig.getcurrentnodepath(); + std::string oldpath = xmlconfig.getcurrentnodepath(); if(xmlconfig.changecurrentnode("ensemble/phasespacepoint/file")) { - global_log->info() << "Reading phase space from file." << endl; - string pspfiletype; + Log::global_log->info() << "Reading phase space from file." << std::endl; + std::string pspfiletype; xmlconfig.getNodeValue("@type", pspfiletype); - global_log->info() << "Phase space file type: " << pspfiletype << endl; + Log::global_log->info() << "Phase space file type: " << pspfiletype << std::endl; if (pspfiletype == "ASCII") { _inputReader = new ASCIIReader(); @@ -630,7 +627,7 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { } #endif else { - global_log->error() << "Unknown phase space file type" << endl; + Log::global_log->error() << "Unknown phase space file type" << std::endl; Simulation::exit(-1); } } @@ -638,9 +635,9 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { oldpath = xmlconfig.getcurrentnodepath(); if(xmlconfig.changecurrentnode("ensemble/phasespacepoint/generator")) { - string generatorName; + std::string generatorName; xmlconfig.getNodeValue("@name", generatorName); - global_log->info() << "Initializing phase space using generator: " << generatorName << endl; + Log::global_log->info() << "Initializing phase space using generator: " << generatorName << std::endl; if(generatorName == "MultiObjectGenerator") { _inputReader = new MultiObjectGenerator(); } @@ -660,7 +657,7 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { _inputReader = new PerCellGenerator(); } else { - global_log->error() << "Unknown generator: " << generatorName << endl; + Log::global_log->error() << "Unknown generator: " << generatorName << std::endl; Simulation::exit(1); } _inputReader->readXML(xmlconfig); @@ -681,57 +678,57 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { } -void Simulation::readConfigFile(string filename) { - string extension(getFileExtension(filename.c_str())); - global_log->debug() << "Found config filename extension: " << extension << endl; +void Simulation::readConfigFile(std::string filename) { + std::string extension(getFileExtension(filename.c_str())); + Log::global_log->debug() << "Found config filename extension: " << extension << std::endl; if (extension == "xml") { initConfigXML(filename); } else { - global_log->error() << "Unknown config file extension '" << extension << "'." << endl; + Log::global_log->error() << "Unknown config file extension '" << extension << "'." << std::endl; Simulation::exit(1); } } -void Simulation::initConfigXML(const string& inputfilename) { - global_log->info() << "Initializing XML config file: " << inputfilename << endl; +void Simulation::initConfigXML(const std::string& inputfilename) { + Log::global_log->info() << "Initializing XML config file: " << inputfilename << std::endl; try{ XMLfileUnits inp(inputfilename); - global_log->debug() << "Input XML:" << endl << string(inp) << endl; + Log::global_log->debug() << "Input XML:" << std::endl << std::string(inp) << std::endl; if(inp.changecurrentnode("/mardyn") < 0) { - global_log->error() << "Cound not find root node /mardyn in XML input file." << endl; - global_log->fatal() << "Not a valid MarDyn XML input file." << endl; + Log::global_log->error() << "Cound not find root node /mardyn in XML input file." << std::endl; + Log::global_log->fatal() << "Not a valid MarDyn XML input file." << std::endl; Simulation::exit(1); } - string version("unknown"); + std::string version("unknown"); inp.getNodeValue("@version", version); - global_log->info() << "MarDyn XML config file version: " << version << endl; + Log::global_log->info() << "MarDyn XML config file version: " << version << std::endl; - global_log->set_log_level(inp.getNodeValue_string("loglevel", "info")); + Log::global_log->set_log_level(inp.getNodeValue_string("loglevel", "info")); if(inp.changecurrentnode("simulation")) { readXML(inp); inp.changecurrentnode(".."); } // simulation-section else { - global_log->error() << "Simulation section missing" << endl; + Log::global_log->error() << "Simulation section missing" << std::endl; Simulation::exit(1); } parseMiscOptions(inp); if(_miscOptions["refreshIDs"]) { - global_log->info() << "Particle IDs will be refreshed before simulation start." << endl; + Log::global_log->info() << "Particle IDs will be refreshed before simulation start." << std::endl; } else { - global_log->info() << "Particle IDs will NOT be refreshed before simulation start." << endl; + Log::global_log->info() << "Particle IDs will NOT be refreshed before simulation start." << std::endl; } } catch (const std::exception& e) { - global_log->error() << "Error in XML config. Please check your input file!" << std::endl; - global_log->error() << "Exception: " << e.what() << std::endl; + Log::global_log->error() << "Error in XML config. Please check your input file!" << std::endl; + Log::global_log->error() << "Exception: " << e.what() << std::endl; Simulation::exit(7); } @@ -744,7 +741,7 @@ void Simulation::initConfigXML(const string& inputfilename) { #endif // read particle data (or generate particles, if a generator is chosen) - timers()->registerTimer("PHASESPACE_CREATION", vector{"SIMULATION_IO"}, new Timer()); + timers()->registerTimer("PHASESPACE_CREATION", std::vector{"SIMULATION_IO"}, new Timer()); timers()->setOutputString("PHASESPACE_CREATION", "Phasespace creation took:"); timers()->getTimer("PHASESPACE_CREATION")->start(); @@ -761,8 +758,8 @@ void Simulation::initConfigXML(const string& inputfilename) { unsigned long globalNumMolecules = _domain->getglobalNumMolecules(true, _moleculeContainer, _domainDecomposition); double rho_global = globalNumMolecules / _ensemble->V(); - global_log->info() << "Setting domain class parameters: N_global: " << globalNumMolecules - << ", rho_global: " << rho_global << ", T_global: " << _ensemble->T() << endl; + Log::global_log->info() << "Setting domain class parameters: N_global: " << globalNumMolecules + << ", rho_global: " << rho_global << ", T_global: " << _ensemble->T() << std::endl; _domain->setGlobalTemperature(_ensemble->T()); _domain->setglobalRho(rho_global); @@ -785,19 +782,19 @@ void Simulation::updateForces() { } void Simulation::prepare_start() { - global_log->info() << "Initializing simulation" << endl; + Log::global_log->info() << "Initializing simulation" << std::endl; - global_log->info() << "Initialising cell processor" << endl; + Log::global_log->info() << "Initialising cell processor" << std::endl; if (!_legacyCellProcessor) { #ifndef ENABLE_REDUCED_MEMORY_MODE - global_log->info() << "Using vectorized cell processor." << endl; + Log::global_log->info() << "Using vectorized cell processor." << std::endl; _cellProcessor = new VectorizedCellProcessor( *_domain, _cutoffRadius, _LJCutoffRadius); #else - global_log->info() << "Using reduced memory mode (RMM) cell processor." << endl; + Log::global_log->info() << "Using reduced memory mode (RMM) cell processor." << std::endl; _cellProcessor = new VCP1CLJRMM( *_domain, _cutoffRadius, _LJCutoffRadius); #endif } else { - global_log->info() << "Using legacy cell processor." << endl; + Log::global_log->info() << "Using legacy cell processor." << std::endl; _cellProcessor = new LegacyCellProcessor( _cutoffRadius, _LJCutoffRadius, _particlePairsHandler); } @@ -825,9 +822,9 @@ void Simulation::prepare_start() { } #endif - global_log->info() << "Clearing halos" << endl; + Log::global_log->info() << "Clearing halos" << std::endl; _moleculeContainer->deleteOuterParticles(); - global_log->info() << "Updating domain decomposition" << endl; + Log::global_log->info() << "Updating domain decomposition" << std::endl; if(getMemoryProfiler()) { getMemoryProfiler()->doOutput("without halo copies"); @@ -847,17 +844,17 @@ void Simulation::prepare_start() { vcp1clj_wr_cellProcessor->setDtInvm(dt_inv_m * 0.5); #endif /* ENABLE_REDUCED_MEMORY_MODE */ - global_log->info() << "Performing initial force calculation" << endl; + Log::global_log->info() << "Performing initial force calculation" << std::endl; global_simulation->timers()->start("SIMULATION_FORCE_CALCULATION"); _moleculeContainer->traverseCells(*_cellProcessor); global_simulation->timers()->stop("SIMULATION_FORCE_CALCULATION"); if (_longRangeCorrection != nullptr) { - global_log->info() << "Initializing LongRangeCorrection" << endl; + Log::global_log->info() << "Initializing LongRangeCorrection" << std::endl; _longRangeCorrection->init(); } else { - global_log->fatal() << "No _longRangeCorrection set!" << endl; + Log::global_log->fatal() << "No _longRangeCorrection set!" << std::endl; Simulation::exit(93742); } // longRangeCorrection is a site-wise force plugin, so we have to call it before updateForces() @@ -881,7 +878,7 @@ void Simulation::prepare_start() { ++_loopCompTimeSteps; if (_FMM != nullptr) { - global_log->info() << "Performing initial FMM force calculation" << endl; + Log::global_log->info() << "Performing initial FMM force calculation" << std::endl; _FMM->computeElectrostatics(_moleculeContainer); } @@ -891,21 +888,21 @@ void Simulation::prepare_start() { // initializing plugins and starting plugin timers for (auto& plugin : _plugins) { - global_log->info() << "Initializing plugin " << plugin->getPluginName() << endl; + Log::global_log->info() << "Initializing plugin " << plugin->getPluginName() << std::endl; plugin->init(_moleculeContainer, _domainDecomposition, _domain); - string timer_name = plugin->getPluginName(); + std::string timer_name = plugin->getPluginName(); // TODO: real timer - global_simulation->timers()->registerTimer(timer_name, vector{"SIMULATION_PER_STEP_IO"}, new Timer()); - string timer_plugin_string = string("Plugin ") + timer_name + string(" took:"); + global_simulation->timers()->registerTimer(timer_name, std::vector{"SIMULATION_PER_STEP_IO"}, new Timer()); + std::string timer_plugin_string = std::string("Plugin ") + timer_name + std::string(" took:"); global_simulation->timers()->setOutputString(timer_name, timer_plugin_string); } //afterForces Plugin Call - global_log->debug() << "[AFTER FORCES] Performing AfterForces plugin call" - << endl; + Log::global_log->debug() << "[AFTER FORCES] Performing AfterForces plugin call" + << std::endl; for (auto plugin : _plugins) { - global_log->debug() << "[AFTER FORCES] Plugin: " - << plugin->getPluginName() << endl; + Log::global_log->debug() << "[AFTER FORCES] Plugin: " + << plugin->getPluginName() << std::endl; global_simulation->timers()->start(plugin->getPluginName()); plugin->afterForces(_moleculeContainer, _domainDecomposition, _simstep); global_simulation->timers()->stop(plugin->getPluginName()); @@ -913,7 +910,7 @@ void Simulation::prepare_start() { #ifndef MARDYN_AUTOPAS // clear halo - global_log->info() << "Clearing halos" << endl; + Log::global_log->info() << "Clearing halos" << std::endl; _moleculeContainer->deleteOuterParticles(); #endif @@ -922,20 +919,20 @@ void Simulation::prepare_start() { // integrator->eventForcesCalculated should not be called, since otherwise the velocities would already be updated. //updateForces(); - global_log->info() << "Calculating global values" << endl; + Log::global_log->info() << "Calculating global values" << std::endl; _domain->calculateThermostatDirectedVelocity(_moleculeContainer); _domain->calculateVelocitySums(_moleculeContainer); _domain->calculateGlobalValues(_domainDecomposition, _moleculeContainer, true, 1.0); - global_log->debug() << "Calculating global values finished." << endl; + Log::global_log->debug() << "Calculating global values finished." << std::endl; _ensemble->prepare_start(); _simstep = _initSimulation = (unsigned long) round(_simulationTime / _integrator->getTimestepLength() ); - global_log->info() << "Set initial time step to start from to " << _initSimulation << endl; - global_log->info() << "System initialised with " << _domain->getglobalNumMolecules(true, _moleculeContainer, _domainDecomposition) << " molecules." << endl; + Log::global_log->info() << "Set initial time step to start from to " << _initSimulation << std::endl; + Log::global_log->info() << "System initialised with " << _domain->getglobalNumMolecules(true, _moleculeContainer, _domainDecomposition) << " molecules." << std::endl; } @@ -953,20 +950,20 @@ void Simulation::preSimLoopSteps() //sanity checks if(preSimLoopStepsDone || simulationDone || postSimLoopStepsDone) { - global_log->error() << "Unexpected call to preSimLoopSteps()! Status: (pre sim loop steps done:" << preSimLoopStepsDone << ", simulation done: " << simulationDone << + Log::global_log->error() << "Unexpected call to preSimLoopSteps()! Status: (pre sim loop steps done:" << preSimLoopStepsDone << ", simulation done: " << simulationDone << ", post sim loop steps done: " << postSimLoopStepsDone << std::endl; Simulation::exit(1); } - global_log->info() << "Started simulation" << endl; + Log::global_log->info() << "Started simulation" << std::endl; _ensemble->updateGlobalVariable(_moleculeContainer, NUM_PARTICLES); - global_log->debug() << "Number of particles in the Ensemble: " << _ensemble->N() << endl; + Log::global_log->debug() << "Number of particles in the Ensemble: " << _ensemble->N() << std::endl; // ensemble.updateGlobalVariable(ENERGY); -// global_log->debug() << "Kinetic energy in the Ensemble: " << ensemble.E() << endl; +// Log::global_log->debug() << "Kinetic energy in the Ensemble: " << ensemble.E() << std::endl; // ensemble.updateGlobalVariable(TEMPERATURE); -// global_log->debug() << "Temperature of the Ensemble: " << ensemble.T() << endl;*/ +// Log::global_log->debug() << "Temperature of the Ensemble: " << ensemble.T() << std::endl;*/ /***************************************************************************/ /* BEGIN MAIN LOOP */ @@ -1015,7 +1012,7 @@ void Simulation::simulateOneTimestep() //sanity checks if(!preSimLoopStepsDone || simulationDone || postSimLoopStepsDone) { - global_log->error() << "Unexpected call to simulateOneTimeStep()! Status: (pre sim loop steps done:" << preSimLoopStepsDone << ", simulation done: " << simulationDone << + Log::global_log->error() << "Unexpected call to simulateOneTimeStep()! Status: (pre sim loop steps done:" << preSimLoopStepsDone << ", simulation done: " << simulationDone << ", post sim loop steps done: " << postSimLoopStepsDone << std::endl; Simulation::exit(1); } @@ -1027,16 +1024,16 @@ void Simulation::simulateOneTimestep() global_simulation->timers()->start("SIMULATION_LOOP"); - global_log->debug() << "timestep: " << getSimulationStep() << endl; - global_log->debug() << "simulation time: " << getSimulationTime() << endl; + Log::global_log->debug() << "timestep: " << getSimulationStep() << std::endl; + Log::global_log->debug() << "simulation time: " << getSimulationTime() << std::endl; global_simulation->timers()->incrementTimerTimestepCounter(); global_simulation->timers()->start("SIMULATION_COMPUTATION"); // beforeEventNewTimestep Plugin Call - global_log -> debug() << "[BEFORE EVENT NEW TIMESTEP] Performing beforeEventNewTimestep plugin call" << endl; + Log::global_log -> debug() << "[BEFORE EVENT NEW TIMESTEP] Performing beforeEventNewTimestep plugin call" << std::endl; for (auto plugin : _plugins) { - global_log -> debug() << "[BEFORE EVENT NEW TIMESTEP] Plugin: " << plugin->getPluginName() << endl; + Log::global_log -> debug() << "[BEFORE EVENT NEW TIMESTEP] Plugin: " << plugin->getPluginName() << std::endl; global_simulation->timers()->start(plugin->getPluginName()); plugin->beforeEventNewTimestep(_moleculeContainer, _domainDecomposition, _simstep); global_simulation->timers()->stop(plugin->getPluginName()); @@ -1047,9 +1044,9 @@ void Simulation::simulateOneTimestep() _integrator->eventNewTimestep(_moleculeContainer, _domain); // beforeForces Plugin Call - global_log -> debug() << "[BEFORE FORCES] Performing BeforeForces plugin call" << endl; + Log::global_log -> debug() << "[BEFORE FORCES] Performing BeforeForces plugin call" << std::endl; for (auto plugin : _plugins) { - global_log -> debug() << "[BEFORE FORCES] Plugin: " << plugin->getPluginName() << endl; + Log::global_log -> debug() << "[BEFORE FORCES] Plugin: " << plugin->getPluginName() << std::endl; global_simulation->timers()->start(plugin->getPluginName()); plugin->beforeForces(_moleculeContainer, _domainDecomposition, _simstep); global_simulation->timers()->stop(plugin->getPluginName()); @@ -1075,7 +1072,7 @@ void Simulation::simulateOneTimestep() else { global_simulation->timers()->start("SIMULATION_DECOMPOSITION"); // ensure that all Particles are in the right cells and exchange Particles - global_log->debug() << "Updating container and decomposition" << endl; + Log::global_log->debug() << "Updating container and decomposition" << std::endl; double currentTime = _timerForLoad->get_etime(); updateParticleContainerAndDecomposition(currentTime - previousTimeForLoad, true); @@ -1084,7 +1081,7 @@ void Simulation::simulateOneTimestep() global_simulation->timers()->stop("SIMULATION_DECOMPOSITION"); // Force calculation and other pair interaction related computations - global_log->debug() << "Traversing pairs" << endl; + Log::global_log->debug() << "Traversing pairs" << std::endl; global_simulation->timers()->start("SIMULATION_COMPUTATION"); global_simulation->timers()->start("SIMULATION_FORCE_CALCULATION"); @@ -1093,9 +1090,9 @@ void Simulation::simulateOneTimestep() } // siteWiseForces Plugin Call - global_log -> debug() << "[SITEWISE FORCES] Performing siteWiseForces plugin call" << endl; + Log::global_log -> debug() << "[SITEWISE FORCES] Performing siteWiseForces plugin call" << std::endl; for (auto plugin : _plugins) { - global_log -> debug() << "[SITEWISE FORCES] Plugin: " << plugin->getPluginName() << endl; + Log::global_log -> debug() << "[SITEWISE FORCES] Plugin: " << plugin->getPluginName() << std::endl; global_simulation->timers()->start(plugin->getPluginName()); plugin->siteWiseForces(_moleculeContainer, _domainDecomposition, _simstep); global_simulation->timers()->stop(plugin->getPluginName()); @@ -1113,7 +1110,7 @@ void Simulation::simulateOneTimestep() global_simulation->timers()->start("SIMULATION_DECOMPOSITION"); // Exchange forces if it's required by the cell container. if(_moleculeContainer->requiresForceExchange()){ - global_log->debug() << "Exchanging Forces" << std::endl; + Log::global_log->debug() << "Exchanging Forces" << std::endl; _domainDecomposition->exchangeForces(_moleculeContainer, _domain); } global_simulation->timers()->stop("SIMULATION_DECOMPOSITION"); @@ -1124,14 +1121,14 @@ void Simulation::simulateOneTimestep() if (_FMM != nullptr) { - global_log->debug() << "Performing FMM calculation" << endl; + Log::global_log->debug() << "Performing FMM calculation" << std::endl; _FMM->computeElectrostatics(_moleculeContainer); } //afterForces Plugin Call - global_log -> debug() << "[AFTER FORCES] Performing AfterForces plugin call" << endl; + Log::global_log -> debug() << "[AFTER FORCES] Performing AfterForces plugin call" << std::endl; for (auto plugin : _plugins) { - global_log -> debug() << "[AFTER FORCES] Plugin: " << plugin->getPluginName() << endl; + Log::global_log -> debug() << "[AFTER FORCES] Plugin: " << plugin->getPluginName() << std::endl; global_simulation->timers()->start(plugin->getPluginName()); plugin->afterForces(_moleculeContainer, _domainDecomposition, _simstep); global_simulation->timers()->stop(plugin->getPluginName()); @@ -1140,7 +1137,7 @@ void Simulation::simulateOneTimestep() _ensemble->afterForces(_moleculeContainer, _domainDecomposition, _cellProcessor, _simstep); // TODO: test deletions and insertions - global_log->debug() << "Deleting outer particles / clearing halo." << endl; + Log::global_log->debug() << "Deleting outer particles / clearing halo." << std::endl; #ifndef MARDYN_AUTOPAS _moleculeContainer->deleteOuterParticles(); #endif @@ -1153,11 +1150,11 @@ void Simulation::simulateOneTimestep() _ensemble->beforeThermostat(_simstep, _initStatistics); - global_log->debug() << "Inform the integrator (forces calculated)" << endl; + Log::global_log->debug() << "Inform the integrator (forces calculated)" << std::endl; _integrator->eventForcesCalculated(_moleculeContainer, _domain); // calculate the global macroscopic values from the local values - global_log->debug() << "Calculate macroscopic values" << endl; + Log::global_log->debug() << "Calculate macroscopic values" << std::endl; _domain->calculateGlobalValues(_domainDecomposition, _moleculeContainer, (!(_simstep % _collectThermostatDirectedVelocity)), Tfactor(_simstep)); @@ -1165,16 +1162,16 @@ void Simulation::simulateOneTimestep() // TODO: integrate into Temperature Control if ( !_domain->NVE() && _temperatureControl == nullptr) { if (_thermostatType ==VELSCALE_THERMOSTAT) { - global_log->debug() << "Velocity scaling" << endl; + Log::global_log->debug() << "Velocity scaling" << std::endl; if (_domain->severalThermostats()) { _velocityScalingThermostat.enableComponentwise(); for(unsigned int cid = 0; cid < global_simulation->getEnsemble()->getComponents()->size(); cid++) { int thermostatId = _domain->getThermostat(cid); _velocityScalingThermostat.setBetaTrans(thermostatId, _domain->getGlobalBetaTrans(thermostatId)); _velocityScalingThermostat.setBetaRot(thermostatId, _domain->getGlobalBetaRot(thermostatId)); - global_log->debug() << "Thermostat for CID: " << cid << " thermID: " << thermostatId + Log::global_log->debug() << "Thermostat for CID: " << cid << " thermID: " << thermostatId << " B_trans: " << _velocityScalingThermostat.getBetaTrans(thermostatId) - << " B_rot: " << _velocityScalingThermostat.getBetaRot(thermostatId) << endl; + << " B_rot: " << _velocityScalingThermostat.getBetaRot(thermostatId) << std::endl; double v[3]; for(int d = 0; d < 3; d++) { v[d] = _domain->getThermostatDirectedVelocity(thermostatId, d); @@ -1208,12 +1205,12 @@ void Simulation::simulateOneTimestep() //! @todo the number of particles per component stored in components has to be //! updated here in case we insert/remove particles // _ensemble->updateGlobalVariable(NUM_PARTICLES); - // global_log->debug() << "Number of particles in the Ensemble: " << _ensemble->N() << endl; + // Log::global_log->debug() << "Number of particles in the Ensemble: " << _ensemble->N() << std::endl; /* ensemble.updateGlobalVariable(ENERGY); - global_log->debug() << "Kinetic energy in the Ensemble: " << ensemble.E() << endl; + Log::global_log->debug() << "Kinetic energy in the Ensemble: " << ensemble.E() << std::endl; ensemble.updateGlobalVariable(TEMPERATURE); - global_log->debug() << "Temperature of the Ensemble: " << ensemble.T() << endl; + Log::global_log->debug() << "Temperature of the Ensemble: " << ensemble.T() << std::endl; */ /* END PHYSICAL SECTION */ @@ -1226,8 +1223,8 @@ void Simulation::simulateOneTimestep() if( (_forced_checkpoint_time > 0) && (global_simulation->timers()->getTimer("SIMULATION_LOOP")->get_etime() >= _forced_checkpoint_time) ) { /* force checkpoint for specified time */ - string cpfile(_outputPrefix + ".timed.restart.dat"); - global_log->info() << "Writing timed, forced checkpoint to file '" << cpfile << "'" << endl; + std::string cpfile(_outputPrefix + ".timed.restart.dat"); + Log::global_log->info() << "Writing timed, forced checkpoint to file '" << cpfile << "'" << std::endl; _domain->writeCheckpoint(cpfile, _moleculeContainer, _domainDecomposition, _simulationTime); _forced_checkpoint_time = -1; /* disable for further timesteps */ } @@ -1246,7 +1243,7 @@ void Simulation::postSimLoopSteps() //sanity checks if(!preSimLoopStepsDone || !simulationDone || postSimLoopStepsDone) { - global_log->error() << "Unexpected call to postSimLoopSteps()! Status: (pre sim loop steps done:" << preSimLoopStepsDone << ", simulation done: " << simulationDone << + Log::global_log->error() << "Unexpected call to postSimLoopSteps()! Status: (pre sim loop steps done:" << preSimLoopStepsDone << ", simulation done: " << simulationDone << ", post sim loop steps done: " << postSimLoopStepsDone << std::endl; Simulation::exit(1); } @@ -1257,17 +1254,17 @@ void Simulation::postSimLoopSteps() /***************************************************************************/ - global_simulation->timers()->registerTimer("SIMULATION_FINAL_IO", vector{"SIMULATION_IO"}, new Timer()); + global_simulation->timers()->registerTimer("SIMULATION_FINAL_IO", std::vector{"SIMULATION_IO"}, new Timer()); global_simulation->timers()->setOutputString("SIMULATION_FINAL_IO", "Final IO took:"); global_simulation->timers()->getTimer("SIMULATION_FINAL_IO")->start(); if( _finalCheckpoint ) { /* write final checkpoint */ - string cpfile(_outputPrefix + ".restart.dat"); - global_log->info() << "Writing final checkpoint to file '" << cpfile << "'" << endl; + std::string cpfile(_outputPrefix + ".restart.dat"); + Log::global_log->info() << "Writing final checkpoint to file '" << cpfile << "'" << std::endl; _domain->writeCheckpoint(cpfile, _moleculeContainer, _domainDecomposition, _simulationTime, false); } - global_log->info() << "Finish plugins" << endl; + Log::global_log->info() << "Finish plugins" << std::endl; for (auto plugin : _plugins) { global_simulation->timers()->start(plugin->getPluginName()); plugin->finish(_moleculeContainer, _domainDecomposition, _domain); @@ -1275,18 +1272,18 @@ void Simulation::postSimLoopSteps() } global_simulation->timers()->getTimer("SIMULATION_FINAL_IO")->stop(); - global_log->info() << "Timing information:" << endl; + Log::global_log->info() << "Timing information:" << std::endl; global_simulation->timers()->printTimers(); global_simulation->timers()->resetTimers(); if(getMemoryProfiler()) { getMemoryProfiler()->doOutput(); } - global_log->info() << endl; + Log::global_log->info() << std::endl; #ifdef WITH_PAPI - global_log->info() << "PAPI counter values for loop timer:" << endl; + Log::global_log->info() << "PAPI counter values for loop timer:" << std::endl; for(int i = 0; i < global_simulation->timers()->getTimer("SIMULATION_LOOP")->get_papi_num_counters(); i++) { - global_log->info() << " " << papi_event_list[i] << ": " << global_simulation->timers()->getTimer("SIMULATION_LOOP")->get_global_papi_counter(i) << endl; + Log::global_log->info() << " " << papi_event_list[i] << ": " << global_simulation->timers()->getTimer("SIMULATION_LOOP")->get_global_papi_counter(i) << std::endl; } #endif /* WITH_PAPI */ postSimLoopStepsDone = true; @@ -1297,7 +1294,7 @@ void Simulation::pluginEndStepCall(unsigned long simstep) { std::list::iterator pluginIter; for (pluginIter = _plugins.begin(); pluginIter != _plugins.end(); pluginIter++) { PluginBase* plugin = (*pluginIter); - global_log->debug() << "Plugin end of step: " << plugin->getPluginName() << endl; + Log::global_log->debug() << "Plugin end of step: " << plugin->getPluginName() << std::endl; global_simulation->timers()->start(plugin->getPluginName()); plugin->endStep(_moleculeContainer, _domainDecomposition, _domain, simstep); global_simulation->timers()->stop(plugin->getPluginName()); @@ -1305,15 +1302,14 @@ void Simulation::pluginEndStepCall(unsigned long simstep) { if (_domain->thermostatWarning()) - global_log->warning() << "Thermostat!" << endl; + Log::global_log->warning() << "Thermostat!" << std::endl; /* TODO: thermostat */ - global_log->info() << "Simstep = " << simstep << "\tT = " + Log::global_log->info() << "Simstep = " << simstep << "\tT = " << _domain->getGlobalCurrentTemperature() << "\tU_pot = " << _domain->getGlobalUpot() << "\tp = " - << _domain->getGlobalPressure() << endl; - using std::isnan; - if (isnan(_domain->getGlobalCurrentTemperature()) || isnan(_domain->getGlobalUpot()) || isnan(_domain->getGlobalPressure())) { - global_log->error() << "NaN detected, exiting." << std::endl; + << _domain->getGlobalPressure() << std::endl; + if (std::isnan(_domain->getGlobalCurrentTemperature()) || std::isnan(_domain->getGlobalUpot()) || std::isnan(_domain->getGlobalPressure())) { + Log::global_log->error() << "NaN detected, exiting." << std::endl; Simulation::exit(1); } } @@ -1383,7 +1379,7 @@ void Simulation::performOverlappingDecompositionAndCellTraversalStep(double etim #ifdef ENABLE_MPI auto* dd = dynamic_cast(_domainDecomposition); if (not dd) { - global_log->fatal() << "DomainDecompMPIBase* required for overlapping comm, but dynamic_cast failed." << std::endl; + Log::global_log->fatal() << "DomainDecompMPIBase* required for overlapping comm, but dynamic_cast failed." << std::endl; Simulation::exit(873456); } NonBlockingMPIMultiStepHandler nonBlockingMPIHandler {dd, _moleculeContainer, _domain, _cellProcessor}; @@ -1392,7 +1388,7 @@ void Simulation::performOverlappingDecompositionAndCellTraversalStep(double etim nonBlockingMPIHandler.performOverlappingTasks(forceRebalancing, etime); #else - global_log->fatal() << "performOverlappingDecompositionAndCellTraversalStep() called with disabled MPI." << std::endl; + Log::global_log->fatal() << "performOverlappingDecompositionAndCellTraversalStep() called with disabled MPI." << std::endl; Simulation::exit(873457); #endif } @@ -1431,34 +1427,34 @@ void Simulation::initialize() { delete _domainDecomposition; #ifndef ENABLE_MPI - global_log->info() << "Creating alibi domain decomposition ... " << endl; + Log::global_log->info() << "Creating alibi domain decomposition ... " << std::endl; _domainDecomposition = new DomainDecompBase(); #else - global_log->info() << "Creating standard domain decomposition ... " << endl; + Log::global_log->info() << "Creating standard domain decomposition ... " << std::endl; _domainDecomposition = (DomainDecompBase*) new DomainDecomposition(); #endif _outputPrefix.append(gettimestring()); - global_log->info() << "Creating domain ..." << endl; + Log::global_log->info() << "Creating domain ..." << std::endl; _domain = new Domain(ownrank); - global_log->info() << "Creating ParticlePairs2PotForceAdapter ..." << endl; + Log::global_log->info() << "Creating ParticlePairs2PotForceAdapter ..." << std::endl; _particlePairsHandler = new ParticlePairs2PotForceAdapter(*_domain); - global_log->info() << "Initialization done" << endl; + Log::global_log->info() << "Initialization done" << std::endl; } bool Simulation::keepRunning() { // Simstep Criterion if (_simstep >= _numberOfTimesteps){ - global_log->info() << "Maximum Simstep reached: " << _simstep << std::endl; + Log::global_log->info() << "Maximum Simstep reached: " << _simstep << std::endl; simulationDone = true; return false; } // WallTime Criterion, elapsed time since Simulation constructor else if(_wallTimeEnabled && _timeFromStart.get_etime_running() > _maxWallTime){ - global_log->info() << "Maximum Walltime reached (s): " << _maxWallTime << std::endl; + Log::global_log->info() << "Maximum Walltime reached (s): " << _maxWallTime << std::endl; simulationDone = true; return false; } @@ -1511,9 +1507,9 @@ void Simulation::parseMiscOptions(XMLfileUnits& xmlconfig) { xmlconfig.getNodeValue(".", _miscOptions[strOptionName]); } // log what was parsed - global_log->info() << "Parsed " << optionNodes.card() << " misc options: \n" << std::boolalpha; + Log::global_log->info() << "Parsed " << optionNodes.card() << " misc options: \n" << std::boolalpha; for (const auto& [name, value] : _miscOptions) { - global_log->info() << " " << name << ": " << value << std::endl; + Log::global_log->info() << " " << name << ": " << value << std::endl; } xmlconfig.changecurrentnode(oldpath); } diff --git a/src/Simulation.h b/src/Simulation.h index 4d46f59ac6..93055edfd2 100644 --- a/src/Simulation.h +++ b/src/Simulation.h @@ -4,12 +4,14 @@ #include #include -#include "ensemble/CavityEnsemble.h" #include "io/TimerProfiler.h" #include "thermostats/VelocityScalingThermostat.h" #include "utils/FixedSizeQueue.h" #include "utils/FunctionWrapper.h" #include "utils/SysMon.h" +#include "utils/Random.h" + + // plugins #include "plugins/PluginFactory.h" @@ -234,7 +236,7 @@ class Simulation { unsigned long getSimulationStep() { return _simstep; } /** Set Loop Time Limit in seconds */ void setLoopAbortTime(double time) { - global_log->info() << "Max loop-abort-time set: " << time << "\n"; + Log::global_log->info() << "Max loop-abort-time set: " << time << "\n"; _wallTimeEnabled = true; _maxWallTime = time; } diff --git a/src/bhfmm/FastMultipoleMethod.cpp b/src/bhfmm/FastMultipoleMethod.cpp index 863efd505a..b8b251c9bd 100644 --- a/src/bhfmm/FastMultipoleMethod.cpp +++ b/src/bhfmm/FastMultipoleMethod.cpp @@ -14,9 +14,6 @@ #include "bhfmm/containers/AdaptivePseudoParticleContainer.h" #include "utils/xmlfileUnits.h" -using Log::global_log; -using std::endl; - namespace bhfmm { FastMultipoleMethod::~FastMultipoleMethod() { @@ -33,24 +30,24 @@ FastMultipoleMethod::~FastMultipoleMethod() { void FastMultipoleMethod::readXML(XMLfileUnits& xmlconfig) { xmlconfig.getNodeValue("orderOfExpansions", _order); - global_log->info() << "FastMultipoleMethod: orderOfExpansions: " << _order << endl; + Log::global_log->info() << "FastMultipoleMethod: orderOfExpansions: " << _order << std::endl; xmlconfig.getNodeValue("LJCellSubdivisionFactor", _LJCellSubdivisionFactor); - global_log->info() << "FastMultipoleMethod: LJCellSubdivisionFactor: " << _LJCellSubdivisionFactor << endl; + Log::global_log->info() << "FastMultipoleMethod: LJCellSubdivisionFactor: " << _LJCellSubdivisionFactor << std::endl; xmlconfig.getNodeValue("adaptiveContainer", _adaptive); if (_adaptive == 1) { - global_log->warning() << "FastMultipoleMethod: adaptiveContainer is not debugged yet and certainly delivers WRONG results!" << endl; - global_log->warning() << "Unless you are in the process of debugging this container, please stop the simulation and restart with the uniform one" << endl; + Log::global_log->warning() << "FastMultipoleMethod: adaptiveContainer is not debugged yet and certainly delivers WRONG results!" << std::endl; + Log::global_log->warning() << "Unless you are in the process of debugging this container, please stop the simulation and restart with the uniform one" << std::endl; } else { - global_log->info() << "FastMultipoleMethod: UniformPseudoParticleSelected " << endl; + Log::global_log->info() << "FastMultipoleMethod: UniformPseudoParticleSelected " << std::endl; } xmlconfig.getNodeValue("systemIsPeriodic", _periodic); if (_periodic == 0) { - global_log->warning() << "FastMultipoleMethod: periodicity is turned off!" << endl; + Log::global_log->warning() << "FastMultipoleMethod: periodicity is turned off!" << std::endl; } else { - global_log->info() << "FastMultipoleMethod: Periodicity is on." << endl; + Log::global_log->info() << "FastMultipoleMethod: Periodicity is on." << std::endl; } } @@ -69,15 +66,15 @@ void FastMultipoleMethod::init(double globalDomainLength[3], double bBoxMin[3], and _LJCellSubdivisionFactor != 2 and _LJCellSubdivisionFactor != 4 and _LJCellSubdivisionFactor != 8) { - global_log->error() << "Fast Multipole Method: bad subdivision factor:" - << _LJCellSubdivisionFactor << endl; - global_log->error() << "expected 1,2,4 or 8" << endl; + Log::global_log->error() << "Fast Multipole Method: bad subdivision factor:" + << _LJCellSubdivisionFactor << std::endl; + Log::global_log->error() << "expected 1,2,4 or 8" << std::endl; Simulation::exit(5); } - global_log->info() + Log::global_log->info() << "Fast Multipole Method: each LJ cell will be subdivided in " << pow(_LJCellSubdivisionFactor, 3) - << " cells for electrostatic calculations in FMM" << endl; + << " cells for electrostatic calculations in FMM" << std::endl; _P2PProcessor = new VectorizedChargeP2PCellProcessor( *(global_simulation->getDomain())); @@ -102,14 +99,14 @@ void FastMultipoleMethod::init(double globalDomainLength[3], double bBoxMin[3], #ifdef QUICKSCHED global_simulation->getTaskTimingProfiler()->init(_scheduler->count); #else - global_log->warning() << "Profiling tasks without Quicksched not implemented!" << endl; + Log::global_log->warning() << "Profiling tasks without Quicksched not implemented!" << std::endl; #endif #endif } else { // TODO: Debugging in Progress! #if defined(ENABLE_MPI) - global_log->error() << "MPI in combination with adaptive is not supported yet" << endl; + Log::global_log->error() << "MPI in combination with adaptive is not supported yet" << std::endl; Simulation::exit(-1); #endif //int threshold = 100; @@ -307,7 +304,7 @@ void FastMultipoleMethod::runner(int type, void *data) { break; } /* Dummy */ default: - global_log->error() << "Undefined Quicksched task type: " << type << std::endl; + Log::global_log->error() << "Undefined Quicksched task type: " << type << std::endl; } #ifdef TASKTIMINGPROFILE global_simulation->getTaskTimingProfiler()->stop(startTime, type); @@ -315,7 +312,7 @@ void FastMultipoleMethod::runner(int type, void *data) { #else #pragma omp critical { - global_log->error() << "Quicksched runner without FMM_FFT not implemented!" << std::endl; + Log::global_log->error() << "Quicksched runner without FMM_FFT not implemented!" << std::endl; Simulation::exit(1); } #endif /* FMM_FFT */ diff --git a/src/bhfmm/cellProcessors/L2PCellProcessor.cpp b/src/bhfmm/cellProcessors/L2PCellProcessor.cpp index 3b10746be8..59012336e5 100644 --- a/src/bhfmm/cellProcessors/L2PCellProcessor.cpp +++ b/src/bhfmm/cellProcessors/L2PCellProcessor.cpp @@ -30,11 +30,11 @@ void L2PCellProcessor::initTraversal() { // using std::cout; // using std::endl; // Domain* domain = global_simulation->getDomain(); -// cout << "L2P init: LocalUpot " << domain->getLocalUpot() << endl; -// cout << "L2P init: LocalVirial " << domain->getLocalVirial() << endl; -// cout << "L2P init: LocalP_xx " << domain->getLocalP_xx() << endl; -// cout << "L2P init: LocalP_yy " << domain->getLocalP_yy() << endl; -// cout << "L2P init: LocalP_zz " << domain->getLocalP_zz() << endl; +// std::cout << "L2P init: LocalUpot " << domain->getLocalUpot() << std::endl; +// std::cout << "L2P init: LocalVirial " << domain->getLocalVirial() << std::endl; +// std::cout << "L2P init: LocalP_xx " << domain->getLocalP_xx() << std::endl; +// std::cout << "L2P init: LocalP_yy " << domain->getLocalP_yy() << std::endl; +// std::cout << "L2P init: LocalP_zz " << domain->getLocalP_zz() << std::endl; global_simulation->timers()->start("L2P_CELL_PROCESSOR_L2P"); } diff --git a/src/bhfmm/cellProcessors/VectorizedChargeP2PCellProcessor.cpp b/src/bhfmm/cellProcessors/VectorizedChargeP2PCellProcessor.cpp index 0e04f12e50..b607f87841 100644 --- a/src/bhfmm/cellProcessors/VectorizedChargeP2PCellProcessor.cpp +++ b/src/bhfmm/cellProcessors/VectorizedChargeP2PCellProcessor.cpp @@ -13,8 +13,6 @@ #include "particleContainer/adapter/vectorization/MaskGatherChooser.h" #include "VectorizedChargeP2PCellProcessor.h" -using namespace Log; -using namespace std; namespace bhfmm { VectorizedChargeP2PCellProcessor::VectorizedChargeP2PCellProcessor(Domain & domain, double cutoffRadius, double LJcutoffRadius) : @@ -23,22 +21,22 @@ VectorizedChargeP2PCellProcessor::VectorizedChargeP2PCellProcessor(Domain & doma _upotXpoles(0.0), _virial(0.0){ #if VCP_VEC_TYPE==VCP_NOVEC - global_log->info() << "VectorizedChargeP2PCellProcessor: using no intrinsics." << std::endl; + Log::global_log->info() << "VectorizedChargeP2PCellProcessor: using no intrinsics." << std::endl; #elif VCP_VEC_TYPE==VCP_VEC_SSE3 - global_log->info() << "VectorizedChargeP2PCellProcessor: using SSE3 intrinsics." << std::endl; + Log::global_log->info() << "VectorizedChargeP2PCellProcessor: using SSE3 intrinsics." << std::endl; #elif VCP_VEC_TYPE==VCP_VEC_AVX - global_log->info() << "VectorizedChargeP2PCellProcessor: using AVX intrinsics." << std::endl; + Log::global_log->info() << "VectorizedChargeP2PCellProcessor: using AVX intrinsics." << std::endl; #elif VCP_VEC_TYPE==VCP_VEC_AVX2 - global_log->info() << "VectorizedChargeP2PCellProcessor: using AVX2 intrinsics." << std::endl; + Log::global_log->info() << "VectorizedChargeP2PCellProcessor: using AVX2 intrinsics." << std::endl; #elif (VCP_VEC_TYPE==VCP_VEC_KNL) || (VCP_VEC_TYPE==VCP_VEC_KNL_GATHER) - global_log->info() << "VectorizedChargeP2PCellProcessor: using KNL intrinsics." << std::endl; + Log::global_log->info() << "VectorizedChargeP2PCellProcessor: using KNL intrinsics." << std::endl; #elif (VCP_VEC_TYPE==VCP_VEC_AVX512F) || (VCP_VEC_TYPE==VCP_VEC_AVX512F_GATHER) - global_log->info() << "VectorizedChargeP2PCellProcessor: using SKX intrinsics." << std::endl; + Log::global_log->info() << "VectorizedChargeP2PCellProcessor: using SKX intrinsics." << std::endl; #endif // initialize thread data _numThreads = mardyn_get_max_threads(); - global_log->info() << "VectorizedChargeP2PCellProcessor: allocate data for " << _numThreads << " threads." << std::endl; + Log::global_log->info() << "VectorizedChargeP2PCellProcessor: allocate data for " << _numThreads << " threads." << std::endl; _threadData.resize(_numThreads); #if defined(_OPENMP) @@ -115,7 +113,7 @@ void VectorizedChargeP2PCellProcessor::endTraversal() { } void VectorizedChargeP2PCellProcessor::preprocessCell(ParticleCellPointers & c) { - // as pre new integration of Caches in SoAs, + // as pre new integration of Caches in SoAs, // this function work as before, as it builds secondary SoAs // Determine the total number of centers. @@ -126,7 +124,7 @@ void VectorizedChargeP2PCellProcessor::preprocessCell(ParticleCellPointers & c) size_t nCharges = 0; size_t nDipoles = 0; size_t nQuadrupoles = 0; - + for (size_t i = 0; i < numMolecules; ++i) { nCharges += c.moleculesAt(i).numCharges(); } @@ -192,7 +190,7 @@ void VectorizedChargeP2PCellProcessor::preprocessCell(ParticleCellPointers & c) } void VectorizedChargeP2PCellProcessor::postprocessCell(ParticleCellPointers & c) { - // as pre new integration of Caches in SoAs, + // as pre new integration of Caches in SoAs, // this function work as before, as it builds secondary SoAs using std::isnan; // C++11 required @@ -227,9 +225,9 @@ void VectorizedChargeP2PCellProcessor::postprocessCell(ParticleCellPointers & c) f[0] = static_cast(soa_charges_f_x[iCharges]); f[1] = static_cast(soa_charges_f_y[iCharges]); f[2] = static_cast(soa_charges_f_z[iCharges]); - mardyn_assert(!isnan(f[0])); - mardyn_assert(!isnan(f[1])); - mardyn_assert(!isnan(f[2])); + mardyn_assert(!std::isnan(f[0])); + mardyn_assert(!std::isnan(f[1])); + mardyn_assert(!std::isnan(f[2])); m.Fchargeadd(j, f); // Store the resulting virial in the molecule. @@ -237,9 +235,9 @@ void VectorizedChargeP2PCellProcessor::postprocessCell(ParticleCellPointers & c) V[0] = static_cast(soa_charges_V_x[iCharges]*0.5); V[1] = static_cast(soa_charges_V_y[iCharges]*0.5); V[2] = static_cast(soa_charges_V_z[iCharges]*0.5); - mardyn_assert(!isnan(V[0])); - mardyn_assert(!isnan(V[1])); - mardyn_assert(!isnan(V[2])); + mardyn_assert(!std::isnan(V[0])); + mardyn_assert(!std::isnan(V[1])); + mardyn_assert(!std::isnan(V[2])); m.Viadd(V); } } diff --git a/src/bhfmm/cellProcessors/VectorizedLJP2PCellProcessor.cpp b/src/bhfmm/cellProcessors/VectorizedLJP2PCellProcessor.cpp index 8804481f5e..a24eddd8cc 100644 --- a/src/bhfmm/cellProcessors/VectorizedLJP2PCellProcessor.cpp +++ b/src/bhfmm/cellProcessors/VectorizedLJP2PCellProcessor.cpp @@ -15,27 +15,25 @@ #include #include "particleContainer/adapter/vectorization/MaskGatherChooser.h" -using namespace Log; -using namespace std; namespace bhfmm { VectorizedLJP2PCellProcessor::VectorizedLJP2PCellProcessor(Domain & domain, double cutoffRadius, double LJcutoffRadius) : CellProcessor(cutoffRadius, LJcutoffRadius), _domain(domain), // maybe move the following to somewhere else: - _epsRFInvrc3(2. * (domain.getepsilonRF() - 1.) / ((cutoffRadius * cutoffRadius * cutoffRadius) * (2. * domain.getepsilonRF() + 1.))), + _epsRFInvrc3(2. * (domain.getepsilonRF() - 1.) / ((cutoffRadius * cutoffRadius * cutoffRadius) * (2. * domain.getepsilonRF() + 1.))), _eps_sig(), _shift6(), _upot6lj(0.0), _virial(0.0){ #if VCP_VEC_TYPE==VCP_NOVEC - global_log->info() << "VectorizedLJP2PCellProcessor: using no intrinsics." << std::endl; + Log::global_log->info() << "VectorizedLJP2PCellProcessor: using no intrinsics." << std::endl; #elif VCP_VEC_TYPE==VCP_VEC_SSE3 - global_log->info() << "VectorizedLJP2PCellProcessor: using SSE3 intrinsics." << std::endl; + Log::global_log->info() << "VectorizedLJP2PCellProcessor: using SSE3 intrinsics." << std::endl; #elif VCP_VEC_TYPE==VCP_VEC_AVX - global_log->info() << "VectorizedLJP2PCellProcessor: using AVX intrinsics." << std::endl; + Log::global_log->info() << "VectorizedLJP2PCellProcessor: using AVX intrinsics." << std::endl; #elif VCP_VEC_TYPE==VCP_VEC_AVX2 - global_log->info() << "VectorizedLJP2PCellProcessor: using AVX2 intrinsics." << std::endl; + Log::global_log->info() << "VectorizedLJP2PCellProcessor: using AVX2 intrinsics." << std::endl; #elif (VCP_VEC_TYPE==VCP_VEC_KNL) || (VCP_VEC_TYPE==VCP_VEC_KNL_GATHER) - global_log->info() << "VectorizedLJP2PCellProcessor: using KNL intrinsics." << std::endl; + Log::global_log->info() << "VectorizedLJP2PCellProcessor: using KNL intrinsics." << std::endl; #elif (VCP_VEC_TYPE==VCP_VEC_AVX512F) || (VCP_VEC_TYPE==VCP_VEC_AVX512F_GATHER) - global_log->info() << "VectorizedLJP2PCellProcessor: using SKX intrinsics." << std::endl; + Log::global_log->info() << "VectorizedLJP2PCellProcessor: using SKX intrinsics." << std::endl; #endif ComponentList components = *(_simulation.getEnsemble()->getComponents()); @@ -84,7 +82,7 @@ VectorizedLJP2PCellProcessor::VectorizedLJP2PCellProcessor(Domain & domain, doub // initialize thread data _numThreads = mardyn_get_max_threads(); - global_log->info() << "VectorizedLJP2PCellProcessor: allocate data for " << _numThreads << " threads." << std::endl; + Log::global_log->info() << "VectorizedLJP2PCellProcessor: allocate data for " << _numThreads << " threads." << std::endl; _threadData.resize(_numThreads); #if defined(_OPENMP) @@ -128,7 +126,7 @@ void VectorizedLJP2PCellProcessor::initTraversal() { _virial = 0.0; } // end pragma omp master - global_log->debug() << "VectorizedLJP2PCellProcessor::initTraversal()." << std::endl; + Log::global_log->debug() << "VectorizedLJP2PCellProcessor::initTraversal()." << std::endl; } void VectorizedLJP2PCellProcessor::endTraversal() { @@ -492,7 +490,7 @@ void VectorizedLJP2PCellProcessor::processCellPair(ParticleCell & c1, ParticleCe // is more efficient const bool calc_soa1_soa2 = (soa1.getMolNum() <= soa2.getMolNum()); - + if(sumAll) { // sumAll // if one cell is empty, skip if (soa1.getMolNum() == 0 or soa2.getMolNum() == 0) { diff --git a/src/bhfmm/cellProcessors/VectorizedLJP2PCellProcessor.h b/src/bhfmm/cellProcessors/VectorizedLJP2PCellProcessor.h index 247d58dde4..78fe8ba0f0 100644 --- a/src/bhfmm/cellProcessors/VectorizedLJP2PCellProcessor.h +++ b/src/bhfmm/cellProcessors/VectorizedLJP2PCellProcessor.h @@ -57,7 +57,7 @@ class VectorizedLJP2PCellProcessor : public CellProcessor { * \brief Calculate forces between pairs of Molecules in cell. */ void processCell(ParticleCell& cell); - + void processCellPair(ParticleCell& c1, ParticleCell& c2, bool sumAll = false); /** * \brief Free the LennardJonesSoA for cell. diff --git a/src/bhfmm/containers/DttNode.cpp b/src/bhfmm/containers/DttNode.cpp index 5ad9005601..de65c2efd0 100644 --- a/src/bhfmm/containers/DttNode.cpp +++ b/src/bhfmm/containers/DttNode.cpp @@ -223,7 +223,7 @@ void DttNode::p2p(std::vector leafParticlesFar, // _leafParticles.convertAoSToSoACharge(); v_c_p2p_c_p->preprocessCell(_leafParticles); for (unsigned int i = 0; i < leafParticlesFar.size(); i++) { - //TODO only convert once!! + //TODO only convert once!! // leafParticlesFar[i].convertAoSToSoACharge(_shift); v_c_p2p_c_p->preprocessCell(leafParticlesFar[i]); v_c_p2p_c_p->processCellPair(_leafParticles, leafParticlesFar[i]); @@ -265,14 +265,14 @@ int DttNode::getMaxDepth() const { if (_isLeafNode) { return 0; } else { - int max = 0; + int maxVal = 0; for (unsigned int i = 0; i < 8; i++) { if (_children[i]->isOccupied()) { - max = std::max(max, _children[i]->getMaxDepth()); + maxVal = std::max(maxVal, _children[i]->getMaxDepth()); } } - return max + 1; + return maxVal + 1; } } diff --git a/src/bhfmm/containers/LeafNodesContainer.cpp b/src/bhfmm/containers/LeafNodesContainer.cpp index 08c2a3dc78..3bae47bc95 100644 --- a/src/bhfmm/containers/LeafNodesContainer.cpp +++ b/src/bhfmm/containers/LeafNodesContainer.cpp @@ -15,9 +15,6 @@ #include #include -using namespace std; -using Log::global_log; - namespace bhfmm { LeafNodesContainer::LeafNodesContainer(double bBoxMin[3], @@ -143,7 +140,7 @@ void LeafNodesContainer::initializeCells() { } void LeafNodesContainer::calculateNeighbourIndices() { - global_log->debug() << "Setting up cell neighbour index lists." << endl; + Log::global_log->debug() << "Setting up cell neighbour index lists." << std::endl; _forwardNeighbourOffsets.clear(); _backwardNeighbourOffsets.clear(); _maxNeighbourOffset = 0; @@ -168,8 +165,8 @@ void LeafNodesContainer::calculateNeighbourIndices() { } } - global_log->info() << "Neighbour offsets are bounded by " - << _minNeighbourOffset << ", " << _maxNeighbourOffset << endl; + Log::global_log->info() << "Neighbour offsets are bounded by " + << _minNeighbourOffset << ", " << _maxNeighbourOffset << std::endl; } long int LeafNodesContainer::cellIndexOf3DIndex(int xIndex, int yIndex, int zIndex) const { @@ -227,8 +224,8 @@ void LeafNodesContainer::traverseCells(SimpleCellProcessor& cellProcessor){ void LeafNodesContainer::traverseCellPairs(VectorizedChargeP2PCellProcessor& cellProcessor) { #ifndef NDEBUG - global_log->debug() << "LeafNodesContainer::traverseCells: Processing pairs." << endl; - global_log->debug() << "_minNeighbourOffset=" << _minNeighbourOffset << "; _maxNeighbourOffset=" << _maxNeighbourOffset<< endl; + Log::global_log->debug() << "LeafNodesContainer::traverseCells: Processing pairs." << std::endl; + Log::global_log->debug() << "_minNeighbourOffset=" << _minNeighbourOffset << "; _maxNeighbourOffset=" << _maxNeighbourOffset<< std::endl; #endif #if defined(_OPENMP) @@ -238,7 +235,7 @@ void LeafNodesContainer::traverseCellPairs(VectorizedChargeP2PCellProcessor& cel #endif } -void LeafNodesContainer::traverseCellPairsOrig(VectorizedChargeP2PCellProcessor& cellProcessor) { vector::iterator neighbourOffsetsIter; +void LeafNodesContainer::traverseCellPairsOrig(VectorizedChargeP2PCellProcessor& cellProcessor) { std::vector::iterator neighbourOffsetsIter; cellProcessor.initTraversal(); // preprocess all cells @@ -341,7 +338,7 @@ void LeafNodesContainer::traverseCellPairsC08(VectorizedChargeP2PCellProcessor& void LeafNodesContainer::c08Step(long int baseIndex, VectorizedChargeP2PCellProcessor &cellProcessor) { const int num_pairs = _cellPairOffsets.size(); for(int j = 0; j < num_pairs; ++j) { - pair current_pair = _cellPairOffsets[j]; + std::pair current_pair = _cellPairOffsets[j]; long int offset1 = current_pair.first; long int cellIndex1 = baseIndex + offset1; @@ -392,33 +389,33 @@ void LeafNodesContainer::calculateCellPairOffsets() { // minimize number of cells simultaneously in memory: - _cellPairOffsets.push_back(make_pair(o, xyz)); + _cellPairOffsets.push_back(std::make_pair(o, xyz)); // evict xyz - _cellPairOffsets.push_back(make_pair(o, yz )); - _cellPairOffsets.push_back(make_pair(x, yz )); + _cellPairOffsets.push_back(std::make_pair(o, yz )); + _cellPairOffsets.push_back(std::make_pair(x, yz )); // evict yz - _cellPairOffsets.push_back(make_pair(o, x )); + _cellPairOffsets.push_back(std::make_pair(o, x )); - _cellPairOffsets.push_back(make_pair(o, xy )); - _cellPairOffsets.push_back(make_pair(xy, z )); + _cellPairOffsets.push_back(std::make_pair(o, xy )); + _cellPairOffsets.push_back(std::make_pair(xy, z )); // evict xy - _cellPairOffsets.push_back(make_pair(o, z )); - _cellPairOffsets.push_back(make_pair(x, z )); - _cellPairOffsets.push_back(make_pair(y, z )); + _cellPairOffsets.push_back(std::make_pair(o, z )); + _cellPairOffsets.push_back(std::make_pair(x, z )); + _cellPairOffsets.push_back(std::make_pair(y, z )); // evict z - _cellPairOffsets.push_back(make_pair(o, y )); - _cellPairOffsets.push_back(make_pair(x, y )); + _cellPairOffsets.push_back(std::make_pair(o, y )); + _cellPairOffsets.push_back(std::make_pair(x, y )); // evict x - _cellPairOffsets.push_back(make_pair(o, xz )); - _cellPairOffsets.push_back(make_pair(y, xz )); + _cellPairOffsets.push_back(std::make_pair(o, xz )); + _cellPairOffsets.push_back(std::make_pair(y, xz )); // evict xz - _cellPairOffsets.push_back(make_pair(o, o )); + _cellPairOffsets.push_back(std::make_pair(o, o )); } void LeafNodesContainer::threeDIndexOfCellIndex(int ind, int r[3], int dim[3]) const { @@ -431,7 +428,7 @@ void LeafNodesContainer::threeDIndexOfCellIndex(int ind, int r[3], int dim[3]) c return _numCellsPerDimension; } - vector & LeafNodesContainer::getCells() { + std::vector & LeafNodesContainer::getCells() { return _cells; } diff --git a/src/bhfmm/containers/ParticleCellPointers.cpp b/src/bhfmm/containers/ParticleCellPointers.cpp index cf5ad2750d..5889b7b8bd 100644 --- a/src/bhfmm/containers/ParticleCellPointers.cpp +++ b/src/bhfmm/containers/ParticleCellPointers.cpp @@ -12,8 +12,6 @@ #include "utils/mardyn_assert.h" #include -using namespace std; - namespace bhfmm { ParticleCellPointers::ParticleCellPointers() : diff --git a/src/bhfmm/containers/PseudoParticleContainer.h b/src/bhfmm/containers/PseudoParticleContainer.h index a35ba48b87..73bad5c439 100644 --- a/src/bhfmm/containers/PseudoParticleContainer.h +++ b/src/bhfmm/containers/PseudoParticleContainer.h @@ -50,7 +50,7 @@ class PseudoParticleContainer { } virtual ~PseudoParticleContainer() { } - + virtual void build(ParticleContainer* pc) = 0; virtual void upwardPass(P2MCellProcessor * cp) = 0; virtual void horizontalPass(VectorizedChargeP2PCellProcessor * cp) = 0; diff --git a/src/bhfmm/containers/UniformPseudoParticleContainer.cpp b/src/bhfmm/containers/UniformPseudoParticleContainer.cpp index 9e65985ae5..1476d3ce6a 100644 --- a/src/bhfmm/containers/UniformPseudoParticleContainer.cpp +++ b/src/bhfmm/containers/UniformPseudoParticleContainer.cpp @@ -110,7 +110,7 @@ UniformPseudoParticleContainer::UniformPseudoParticleContainer( _comm = domainDecomp.getCommunicator(); #endif #if WIGNER == 1 - //global_log->error() << "not supported yet" << endl; + //global_log->error() << "not supported yet" << std::endl; Simulation::exit(-1); #endif #ifdef ENABLE_MPI @@ -1040,7 +1040,7 @@ void UniformPseudoParticleContainer::generateP2PTasks(qsched *scheduler) { payload.leafNodesContainer = _leafContainer; - global_log->info() << "Generating P2P task ids" << std::endl; + Log::global_log->info() << "Generating P2P task ids" << std::endl; for (auto z = 0; z < cellsPerDim; ++z) { for (auto y = 0; y < cellsPerDim; ++y) { for (auto x = 0; x < cellsPerDim; ++x) { @@ -1092,7 +1092,7 @@ void UniformPseudoParticleContainer::generateP2PTasks(qsched *scheduler) { } /* end for-z */ // set dependencies - global_log->info() << "Setting P2P task dependencies" << std::endl; + Log::global_log->info() << "Setting P2P task dependencies" << std::endl; for (auto z = 0; z < cellsPerDim - 1; z += payload.taskBlockSize[2] - 1) { for (auto y = 0; y < cellsPerDim - 1; y += payload.taskBlockSize[1] - 1) { for (auto x = 0; x < cellsPerDim - 1; x += payload.taskBlockSize[0] - 1) { @@ -2635,19 +2635,19 @@ void UniformPseudoParticleContainer::M2LCompleteCell(int targetId, int level, in cellSize); // cout << "Level: " << level -// << " | Target: " << setw(5) << targetId -// << " (" << setw(2) << targetCoords[0] -// << ", " << setw(2) << targetCoords[1] -// << ", " << setw(2) << targetCoords[2] -// << ") | Source: " << setw(5) << sourceId -// << " (" << setw(2) << sourceCoords[0] -// << ", " << setw(2) << sourceCoords[1] -// << ", " << setw(2) << sourceCoords[2] +// << " | Target: " << std::setw(5) << targetId +// << " (" << std::setw(2) << targetCoords[0] +// << ", " << std::setw(2) << targetCoords[1] +// << ", " << std::setw(2) << targetCoords[2] +// << ") | Source: " << std::setw(5) << sourceId +// << " (" << std::setw(2) << sourceCoords[0] +// << ", " << std::setw(2) << sourceCoords[1] +// << ", " << std::setw(2) << sourceCoords[2] // << ") | tf: " -// << "(" << setw(2) << sourceRootCoords[0] + x - targetCoords[0] -// << ", " << setw(2) << sourceRootCoords[1] + y - targetCoords[1] -// << ", " << setw(2) << sourceRootCoords[2] + z - targetCoords[2] -// << ")" << endl; +// << "(" << std::setw(2) << sourceRootCoords[0] + x - targetCoords[0] +// << ", " << std::setw(2) << sourceRootCoords[1] + y - targetCoords[1] +// << ", " << std::setw(2) << sourceRootCoords[2] + z - targetCoords[2] +// << ")" << std::endl; // calculate single M2L if(FFTSettings::USE_ORDER_REDUCTION){ @@ -4406,7 +4406,7 @@ void UniformPseudoParticleContainer::printTimers() { #endif } -vector> &UniformPseudoParticleContainer::getMpCellGlobalTop() { +std::vector> &UniformPseudoParticleContainer::getMpCellGlobalTop() { return _mpCellGlobalTop; } diff --git a/src/bhfmm/containers/UniformPseudoParticleContainer_old_Wigner_cpp.txt b/src/bhfmm/containers/UniformPseudoParticleContainer_old_Wigner_cpp.txt index 4b090adbd2..b4ec6dc762 100644 --- a/src/bhfmm/containers/UniformPseudoParticleContainer_old_Wigner_cpp.txt +++ b/src/bhfmm/containers/UniformPseudoParticleContainer_old_Wigner_cpp.txt @@ -44,7 +44,7 @@ UniformPseudoParticleContainer::UniformPseudoParticleContainer( _comm = domainDecomp.getCommunicator(); #endif #if WIGNER == 1 - //global_log->error() << "not supported yet" << endl; + //global_log->error() << "not supported yet" << std::endl; Simulation::exit(-1); #endif #ifdef ENABLE_MPI diff --git a/src/bhfmm/containers/tests/DttNodeTest.cpp b/src/bhfmm/containers/tests/DttNodeTest.cpp index 13b2c311be..1b37e1173e 100644 --- a/src/bhfmm/containers/tests/DttNodeTest.cpp +++ b/src/bhfmm/containers/tests/DttNodeTest.cpp @@ -24,7 +24,7 @@ DttNodeTest::DttNodeTest() { DttNodeTest::~DttNodeTest() { // TODO Auto-generated destructor stub } - + void DttNodeTest::testUpwardDownwardWithNoInteraction(){ /* double globalDomainLength[3] = {8., 8., 8.}; double ctr[3] = {4., 4., 4.}; @@ -40,24 +40,24 @@ void DttNodeTest::testUpwardDownwardWithNoInteraction(){ Molecule * it; for(it = container->begin(); it != container->end(); it = container->next()) { root.addParticle(it); - + if(check){ p_pos[0] = it->r(0); p_pos[1] = it->r(1); p_pos[2] = it->r(2); check = false; - } + } } int depth = log2((globalDomainLength[0] / 1.0)); - + bhfmm::DttNode dummy(root, 0,ctr,globalDomainLength,globalDomainLength,orderOfExpansions,depth); - + dummy.upwardPass(); // dummy._mp_cell.local = dummy._mp_cell.multipole; dummy.downwardPass(); dummy.getLeafParticleCell(); - + ASSERT_DOUBLES_EQUAL_MSG("P(1) wrong x coordinate",p_pos[0],m.r(0), 1e-12); ASSERT_DOUBLES_EQUAL_MSG("P(1) wrong y coordinate",p_pos[1],m.r(1), 1e-12); ASSERT_DOUBLES_EQUAL_MSG("P(1) wrong z coordinate",p_pos[2],m.r(2), 1e-12); @@ -133,13 +133,13 @@ void DttNodeTest::testDepth(double cutoffRadius){ for(auto it = container->iterator(ParticleIterator::ONLY_INNER_AND_BOUNDARY); it.isValid(); ++it) { particles.push_back(&(*it)); } - + int depth = log2((globalDomainLength[0] / cutoffRadius)); - + bhfmm::DttNode dummy(particles, 0,ctr,globalDomainLength,orderOfExpansions,depth); ASSERT_EQUAL_MSG("WRONG DEPTH!",dummy.getMaxDepth(),depth); - + delete container; } diff --git a/src/bhfmm/containers/tests/DttNodeTest.h b/src/bhfmm/containers/tests/DttNodeTest.h index fbb0aa3b30..48e11046ad 100644 --- a/src/bhfmm/containers/tests/DttNodeTest.h +++ b/src/bhfmm/containers/tests/DttNodeTest.h @@ -31,9 +31,9 @@ class DttNodeTest : public utils::TestWithSimulationSetup { DttNodeTest(); virtual ~DttNodeTest(); - void testDepthAtRadius1(); - void testDepthAtRadius2(); - void testDepthAtRadius4(); + void testDepthAtRadius1(); + void testDepthAtRadius2(); + void testDepthAtRadius4(); void testDivideParticles(); diff --git a/src/bhfmm/expansions/SolidHarmonicsExpansion.cpp b/src/bhfmm/expansions/SolidHarmonicsExpansion.cpp index 2cc6025851..02071626a2 100644 --- a/src/bhfmm/expansions/SolidHarmonicsExpansion.cpp +++ b/src/bhfmm/expansions/SolidHarmonicsExpansion.cpp @@ -9,8 +9,6 @@ #include #include -using namespace std; - namespace bhfmm { // CONSTRUCTORS // @@ -410,16 +408,16 @@ void SolidHarmonicsExpansion::rotatePhi(const double* CosSinPhi, int negate) { const double val_M_c = acc_C(l, m); const double val_M_s = acc_S(l, m); - mardyn_assert(!isnan(val_M_c)); - mardyn_assert(!isnan(val_M_s)); - mardyn_assert(!isnan(this->acc_C(l, m))); - mardyn_assert(!isnan(this->acc_S(l, m))); + mardyn_assert(!std::isnan(val_M_c)); + mardyn_assert(!std::isnan(val_M_s)); + mardyn_assert(!std::isnan(this->acc_C(l, m))); + mardyn_assert(!std::isnan(this->acc_S(l, m))); acc_C(l, m) = (CosSinPhi[2*m]*val_M_c + negate*CosSinPhi[2*m+1]*val_M_s); acc_S(l, m) = (CosSinPhi[2*m]*val_M_s - negate*CosSinPhi[2*m+1]*val_M_c); - mardyn_assert(!isnan(this->acc_C(l, m))); - mardyn_assert(!isnan(this->acc_S(l, m))); + mardyn_assert(!std::isnan(this->acc_C(l, m))); + mardyn_assert(!std::isnan(this->acc_S(l, m))); } } } @@ -641,22 +639,21 @@ Vector3 forceLAndGradM(const SolidHarmonicsExpansion & LE, const SolidHa void SolidHarmonicsExpansion::print() const { - using namespace std; - int precisionSetting = cout.precision( ); - ios::fmtflags flagSettings = cout.flags(); + int precisionSetting = std::cout.precision( ); + std::ios::fmtflags flagSettings = std::cout.flags(); - cout.setf(ios::dec | ios::showpos | ios::showpoint); - cout.precision(5); + std::cout.setf(std::ios::dec | std::ios::showpos | std::ios::showpoint); + std::cout.precision(5); for (int l = 0; l <= _order; ++l) { for (int m = 0; m <= l; ++m) { - std::cout << "(" < /** - * Interface of the expansion used by the FFTAcceleration, + * Interface of the expansion used by the FFTAcceleration, * Expansions have to inherit it - * - * Requires accessor to the expansion's values and set a FFTDataContainer + * + * Requires accessor to the expansion's values and set a FFTDataContainer * storage (abstract class by itself) * Delete the storage by itself in its virtual destructor. */ diff --git a/src/bhfmm/fft/FFTAccelerationAPI.h b/src/bhfmm/fft/FFTAccelerationAPI.h index 4867e9da59..398190cced 100644 --- a/src/bhfmm/fft/FFTAccelerationAPI.h +++ b/src/bhfmm/fft/FFTAccelerationAPI.h @@ -13,9 +13,9 @@ #include "bhfmm/fft/FFTAccelerableExpansion.h" /** - * Abstract class defining the interface of a class handling the M2L's + * Abstract class defining the interface of a class handling the M2L's * FFT acceleration - * + * * Various implementations will offer various schemes and can be choosed * at runtime using a factory and strategy pattern (see FFTSetting and FFTFactory) */ diff --git a/src/bhfmm/fft/FFTAccelerationImplementations/FFTAcceleration_2wayM2L.h b/src/bhfmm/fft/FFTAccelerationImplementations/FFTAcceleration_2wayM2L.h index 978435c1fc..2e1993d66b 100644 --- a/src/bhfmm/fft/FFTAccelerationImplementations/FFTAcceleration_2wayM2L.h +++ b/src/bhfmm/fft/FFTAccelerationImplementations/FFTAcceleration_2wayM2L.h @@ -14,11 +14,11 @@ /** * Abstract class with common code for basic fft and fftw implementation - * + * * Use FFTDataContainer_arrays as Data container (2 arrays) - * + * * Don't define FFT_M2L and FFT_M2L_vec, but define FFT_M2L_2way - * the code using the acceleration should downcast its FFTAcceleration + * the code using the acceleration should downcast its FFTAcceleration * to the FFTAcceleration_2Way class and use FFT_M2L_2way instead of FFT_M2L */ class FFTAcceleration_2wayM2L: public FFTAccelerationAPI_2Way { diff --git a/src/bhfmm/fft/FFTAccelerationImplementations/FFTAcceleration_2wayM2L_fftw.h b/src/bhfmm/fft/FFTAccelerationImplementations/FFTAcceleration_2wayM2L_fftw.h index 091db5b0ff..9f3ac9b171 100644 --- a/src/bhfmm/fft/FFTAccelerationImplementations/FFTAcceleration_2wayM2L_fftw.h +++ b/src/bhfmm/fft/FFTAccelerationImplementations/FFTAcceleration_2wayM2L_fftw.h @@ -14,7 +14,7 @@ /* * Basic implemtation using the FFTW library - * + * * Use FFTDataContainer_arrays as Data container (2 arrays, here aligned) * initialize_target, M2L and protected function to get the DataContainer defined in abstract FFTAcceleration_2wayM2L */ diff --git a/src/bhfmm/fft/FFTAccelerationImplementations/FFTAcceleration_2wayM2L_optFFT.h b/src/bhfmm/fft/FFTAccelerationImplementations/FFTAcceleration_2wayM2L_optFFT.h index 237322a3ab..fc595b56a9 100644 --- a/src/bhfmm/fft/FFTAccelerationImplementations/FFTAcceleration_2wayM2L_optFFT.h +++ b/src/bhfmm/fft/FFTAccelerationImplementations/FFTAcceleration_2wayM2L_optFFT.h @@ -14,7 +14,7 @@ /* * Basic implemtation using optimized FFT - * + * * Use FFTDataContainer_matrices as Data container (2 matrices) * initialize_target, M2L and protected function to get the DataContainer * defined in parent class diff --git a/src/bhfmm/fft/FFTAccelerationImplementations/FFTAcceleration_matrices.h b/src/bhfmm/fft/FFTAccelerationImplementations/FFTAcceleration_matrices.h index b33eaef3c5..64cf637d70 100644 --- a/src/bhfmm/fft/FFTAccelerationImplementations/FFTAcceleration_matrices.h +++ b/src/bhfmm/fft/FFTAccelerationImplementations/FFTAcceleration_matrices.h @@ -14,7 +14,7 @@ /** * Abstract class with common code for basic fft and fftw implementation - * + * * Use FFTDataContainer_matrices as Data container (2 matrices) */ class FFTAcceleration_matrices: public FFTAccelerationAPI { diff --git a/src/bhfmm/fft/FFTAccelerationImplementations/FFTAcceleration_matrices_fftw.cpp b/src/bhfmm/fft/FFTAccelerationImplementations/FFTAcceleration_matrices_fftw.cpp index c0ee24bc0c..f3c7502fff 100644 --- a/src/bhfmm/fft/FFTAccelerationImplementations/FFTAcceleration_matrices_fftw.cpp +++ b/src/bhfmm/fft/FFTAccelerationImplementations/FFTAcceleration_matrices_fftw.cpp @@ -47,7 +47,7 @@ void FFTAcceleration_matrices_fftw::FFT_initialize_TransferFunction( fftwf_complex* out = _fftw_h->TransferFunction2FFT(Expansion); #else fftw_complex* out = _fftw_h->TransferFunction2FFT(Expansion); -#endif +#endif for (n = 0; n < _fft_nx; n++) for (m = 0; m < _fft_ny; m++) { diff --git a/src/bhfmm/fft/FFTAccelerationImplementations/FFTAcceleration_matrices_fftw.h b/src/bhfmm/fft/FFTAccelerationImplementations/FFTAcceleration_matrices_fftw.h index 0798402253..6126142f36 100644 --- a/src/bhfmm/fft/FFTAccelerationImplementations/FFTAcceleration_matrices_fftw.h +++ b/src/bhfmm/fft/FFTAccelerationImplementations/FFTAcceleration_matrices_fftw.h @@ -13,7 +13,7 @@ /* * Basic implemtation using the FFTW library - * + * * Use FFTDataContainer_matrices as Data container (2 matrices) * initialize_target, M2L and protected function to get the DataContainer defined in abstract FFTAcceleration_matrices */ diff --git a/src/bhfmm/fft/FFTAccelerationImplementations/FFTAcceleration_matrices_optFFT.h b/src/bhfmm/fft/FFTAccelerationImplementations/FFTAcceleration_matrices_optFFT.h index f37b813d41..7baa4c7f84 100644 --- a/src/bhfmm/fft/FFTAccelerationImplementations/FFTAcceleration_matrices_optFFT.h +++ b/src/bhfmm/fft/FFTAccelerationImplementations/FFTAcceleration_matrices_optFFT.h @@ -13,7 +13,7 @@ /* * Basic implemtation using Kurzak's optimized FFT - * + * * Use FFTDataContainer_matrices as Data container (2 matrices) * initialize_target, M2L and protected function to get the DataContainer defined in abstract FFTAcceleration_matrices */ diff --git a/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTAcceleration_blocks.cpp b/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTAcceleration_blocks.cpp index 9ff1e674d5..5a72e09992 100644 --- a/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTAcceleration_blocks.cpp +++ b/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTAcceleration_blocks.cpp @@ -295,7 +295,7 @@ void FFTAcceleration_blocks::FFT_M2L_2way_ORed_vec( FFT_precision * tr_re; FFT_precision * tr_im; - + for(currentBlock=0;currentBlock<=lastBlock;currentBlock++) { t_re = &(T_Re[currentBlock][0][0]); t_im = &(T_Im[currentBlock][0][0]); diff --git a/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTAcceleration_blocks.h b/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTAcceleration_blocks.h index 63cba41900..ab523f5dd3 100644 --- a/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTAcceleration_blocks.h +++ b/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTAcceleration_blocks.h @@ -14,7 +14,7 @@ /* * Abstract class with common code for basic fft and fftw implementation - * + * * Use FFTDataContainer_blocks as Data container (2 arrays of matrices) */ class FFTAcceleration_blocks: public FFTAccelerationAPI_full { diff --git a/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTAcceleration_blocks_fftw.cpp b/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTAcceleration_blocks_fftw.cpp index 97a1e1777d..ffa6325b5d 100644 --- a/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTAcceleration_blocks_fftw.cpp +++ b/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTAcceleration_blocks_fftw.cpp @@ -39,7 +39,7 @@ void FFTAcceleration_blocks_fftw::FFT_initialize_Source( #else fftw_complex* in = _fftw_api->getIn_Forward(); fftw_complex* out; -#endif +#endif for (b = 0; b < _nbBlocks; b++) { minus_one_power_i = 1.0; @@ -114,7 +114,7 @@ void FFTAcceleration_blocks_fftw::FFT_initialize_TransferFunction( #else fftw_complex* in = _fftw_api->getIn_Forward(); fftw_complex* out; -#endif +#endif for (b = 0; b < _nbBlocks; b++) { @@ -180,7 +180,7 @@ void FFTAcceleration_blocks_fftw::FFT_finalize_Target( #else fftw_complex* in = _fftw_api->getIn_Backward(); fftw_complex* out; -#endif +#endif for (b = 0; b < _nbBlocks; b++) { for (i = 0; i < _fft_nx; i++) diff --git a/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTAcceleration_blocks_fftw.h b/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTAcceleration_blocks_fftw.h index 11d31db07c..af884cee1a 100644 --- a/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTAcceleration_blocks_fftw.h +++ b/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTAcceleration_blocks_fftw.h @@ -14,7 +14,7 @@ /* * Basic implementation using the FFTW library - * + * * Use FFTDataContainer_blocks as Data container (2 matrices) * initialize_target, M2L and protected function to get the DataContainer defined in abstract FFTAcceleration_blocks */ diff --git a/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTAcceleration_blocks_optFFT.h b/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTAcceleration_blocks_optFFT.h index d883d94942..ab4ad22f56 100644 --- a/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTAcceleration_blocks_optFFT.h +++ b/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTAcceleration_blocks_optFFT.h @@ -15,7 +15,7 @@ /* * Basic implementation using the optFFT - * + * * Use FFTDataContainer_blocks as Data container (2 matrices) * initialize_target, M2L and protected function to get the DataContainer defined in abstract FFTAcceleration_blocks */ diff --git a/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTAcceleration_scalBlocks_optFFT.h b/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTAcceleration_scalBlocks_optFFT.h index 29ce6f84df..fbb6dd265e 100644 --- a/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTAcceleration_scalBlocks_optFFT.h +++ b/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTAcceleration_scalBlocks_optFFT.h @@ -13,7 +13,7 @@ #include "bhfmm/fft/FFTSettings.h" #include "bhfmm/fft/tools/optimizedFFT/optFFT_API_Factory.h" -/* +/* * Use FFTDataContainer_scalBlocks as Data container (2 arrays of matrices) */ class FFTAcceleration_scalBlocks_optFFT: public FFTAccelerationAPI_full { diff --git a/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTAcceleration_scalBlocks_v0.h b/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTAcceleration_scalBlocks_v0.h index 1697552957..ba1423f3dd 100644 --- a/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTAcceleration_scalBlocks_v0.h +++ b/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTAcceleration_scalBlocks_v0.h @@ -15,7 +15,7 @@ /* * v0 version of scaling block - * + * * Use FFTDataContainer_scalBlocks_v0 as Data container (2 arrays of matrices) */ class FFTAcceleration_scalBlocks_v0: public FFTAccelerationAPI { diff --git a/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTDataContainer_blocks.h b/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTDataContainer_blocks.h index 3319e4868e..698c1f940a 100644 --- a/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTDataContainer_blocks.h +++ b/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTDataContainer_blocks.h @@ -10,14 +10,14 @@ #include "bhfmm/fft/FFTSettings_preprocessor.h" //tmp include for the typedef FFT_precision #include "bhfmm/fft/FFTDataContainer.h" #include "bhfmm/fft/tools/fft_utils.h" -#include +#include /* * Storage for blocks, can be used with scaling Blocks (scalBlock) - * + * * blocks[i] is a matrix reprensenting the ith block * Convention: block 0 contain the terms of lowest order - * => source matrix in ascending block (block 0 is the top of the matrix), + * => source matrix in ascending block (block 0 is the top of the matrix), * tf and target matrices in descending blocks (block 0 is the lower part of the matrix) */ class FFTDataContainer_blocks: public FFTDataContainer { diff --git a/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTDataContainer_scalBlocks.h b/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTDataContainer_scalBlocks.h index fba81ddd45..c3a06f1928 100644 --- a/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTDataContainer_scalBlocks.h +++ b/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTDataContainer_scalBlocks.h @@ -10,14 +10,14 @@ #include "bhfmm/fft/FFTSettings_preprocessor.h" //tmp include for the typedef FFT_precision #include "bhfmm/fft/FFTDataContainer.h" #include "bhfmm/fft/tools/fft_utils.h" -#include +#include /* * Storage for blocks, can be used with scaling Blocks (scalBlock) - * + * * blocks[i] is an array reprensenting the ith block * Convention: block 0 contain the terms of lowest order - * => source matrix in ascending block (block 0 is the top of the matrix), + * => source matrix in ascending block (block 0 is the top of the matrix), * tf and target matrices in descending blocks (block 0 is the lower part of the matrix) */ class FFTDataContainer_scalBlocks: public FFTDataContainer { diff --git a/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTDataContainer_scalBlocks_v0.h b/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTDataContainer_scalBlocks_v0.h index b7a2852bce..0fc04826ed 100644 --- a/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTDataContainer_scalBlocks_v0.h +++ b/src/bhfmm/fft/FFTAccelerationImplementations/block/FFTDataContainer_scalBlocks_v0.h @@ -10,14 +10,14 @@ #include "bhfmm/fft/FFTSettings_preprocessor.h" //tmp include for the typedef FFT_precision #include "bhfmm/fft/FFTDataContainer.h" #include "bhfmm/fft/tools/fft_utils.h" -#include +#include /* * Storage for blocks, can be used with scaling Blocks (scalBlock) - * + * * blocks[i] is a matrix reprensenting the ith block * Convention: block 0 contain the terms of lowest order - * => source matrix in ascending block (block 0 is the top of the matrix), + * => source matrix in ascending block (block 0 is the top of the matrix), * tf and target matrices in descending blocks (block 0 is the lower part of the matrix) */ class FFTDataContainer_scalBlocks_v0: public FFTDataContainer { diff --git a/src/bhfmm/fft/FFTFactory.h b/src/bhfmm/fft/FFTFactory.h index aa02ae61f5..33451eaed0 100644 --- a/src/bhfmm/fft/FFTFactory.h +++ b/src/bhfmm/fft/FFTFactory.h @@ -23,7 +23,7 @@ #include /** - * Factory static class to get an FFTAcceleration and a TransferFunctionManager + * Factory static class to get an FFTAcceleration and a TransferFunctionManager * based on the current settings defined in the static class FFTSettings */ class FFTFactory { diff --git a/src/bhfmm/fft/FFTOrderReduction.h b/src/bhfmm/fft/FFTOrderReduction.h index 8498487255..82f2f20991 100644 --- a/src/bhfmm/fft/FFTOrderReduction.h +++ b/src/bhfmm/fft/FFTOrderReduction.h @@ -7,7 +7,7 @@ #ifndef FFTORDERRED_H_ #define FFTORDERRED_H_ -#include +#include #include #include diff --git a/src/bhfmm/fft/FFTSettings.cpp b/src/bhfmm/fft/FFTSettings.cpp index dac669a277..45e681ebdb 100644 --- a/src/bhfmm/fft/FFTSettings.cpp +++ b/src/bhfmm/fft/FFTSettings.cpp @@ -13,14 +13,14 @@ bool FFTSettings::USE_FFTW = false; //set to use fftw instead of optFFT bool FFTSettings::USE_TFMANAGER_UNIFORMGRID = true; //set to use memoized transfer function (require uniform grid) bool FFTSettings::TFMANAGER_VERBOSE = true; bool FFTSettings::USE_VECTORIZATION = false; //set to use vectorized FFT -bool FFTSettings::USE_2WAY_M2L = false; //set to use a 2way M2L (best on non uniform grid, requires vectorization) +bool FFTSettings::USE_2WAY_M2L = false; //set to use a 2way M2L (best on non uniform grid, requires vectorization) bool FFTSettings::USE_BLOCK = false; bool FFTSettings::USE_ADVBLOCK = false; bool FFTSettings::USE_ORDER_REDUCTION = false; /* * Default settings: - * + * bool FFTSettings::USE_FFT = true; // set to use FFT acceleration bool FFTSettings::USE_FFTW = false; //set to use fftw instead of optFFT bool FFTSettings::USE_TFMANAGER_UNIFORMGRID = true; //set to use memoized transfer function (require uniform grid) @@ -53,7 +53,7 @@ void FFTSettings::autoSetting(int order) { } } -void FFTSettings::setOptions(string option) { +void FFTSettings::setOptions(std::string option) { if (option == "off") { FFTSettings::USE_FFT = false; } else if (option == "fft") { @@ -93,8 +93,8 @@ void FFTSettings::setOptions(string option) { } } -vector FFTSettings::getAvailableOptions() { - vector options; +std::vector FFTSettings::getAvailableOptions() { + std::vector options; options.push_back("off: disable fft acceleration"); options.push_back("fft: use opt. fft acceleration"); options.push_back("fftw: use FFTW acceleration"); diff --git a/src/bhfmm/fft/FFTSettings.h b/src/bhfmm/fft/FFTSettings.h index 123babedae..1960c44128 100644 --- a/src/bhfmm/fft/FFTSettings.h +++ b/src/bhfmm/fft/FFTSettings.h @@ -12,11 +12,9 @@ #include #include "bhfmm/fft/FFTSettings_preprocessor.h" -using namespace std; - /** * Static class containing all the FFT Acceleration's settings - * + * * All settings are public and can be changed dynamically, the FFTFactory * take them into account to provide the right FFTAcceleration and the FMM * algorithm should also take them into account @@ -53,8 +51,8 @@ class FFTSettings { } //Used in the bhfmm code for command line interface - static void setOptions(string option); - static vector getAvailableOptions(); + static void setOptions(std::string option); + static std::vector getAvailableOptions(); static void printCurrentOptions(); }; diff --git a/src/bhfmm/fft/FFTSettings_preprocessor.h b/src/bhfmm/fft/FFTSettings_preprocessor.h index 12cfc8f279..74987e8133 100644 --- a/src/bhfmm/fft/FFTSettings_preprocessor.h +++ b/src/bhfmm/fft/FFTSettings_preprocessor.h @@ -14,6 +14,6 @@ typedef double FFT_precision; //#define __TEST_FAKE_VECTORIZATION__ //To fake vectorization on a computer not supporting it (replace _mm_malloc with malloc and _mm_free with free) //!Vectorization settings are defined at compile time //Intel SSE = 16, AVX = 32, AVX-512 = 64 (https://software.intel.com/en-us/articles/fdiag15126) -#define __FFT_MATRIX_ALIGNMENT__ 32 +#define __FFT_MATRIX_ALIGNMENT__ 32 #endif diff --git a/src/bhfmm/fft/tools/FFTW_API.h b/src/bhfmm/fft/tools/FFTW_API.h index 982b7e85fd..4cb8feaf32 100644 --- a/src/bhfmm/fft/tools/FFTW_API.h +++ b/src/bhfmm/fft/tools/FFTW_API.h @@ -14,10 +14,10 @@ /** * Basic API to perform 2d FFT and IFFT using the fftw lib - * + * * Can perform 1d FFT * Uses double or single precision depending on FFTSettings_preprocessor - * + * * getIn_Forward() to get the input matrices to fill with the value * FFTAndGetOutput_Forward() to perform the FFT and get the output * Backward for IFFT @@ -81,7 +81,7 @@ class FFTW_API { #endif } -#if defined(__SINGLE_PRECISION_FFT__) +#if defined(__SINGLE_PRECISION_FFT__) fftwf_complex* getIn_Forward() {return _f_in;} fftwf_complex* getIn_Backward() {return _b_in;} @@ -103,13 +103,13 @@ class FFTW_API { fftw_execute(_backward); return _b_out; } -#endif +#endif private: int _nx; int _ny; -#if defined(__SINGLE_PRECISION_FFT__) +#if defined(__SINGLE_PRECISION_FFT__) fftwf_plan _forward; fftwf_complex* _f_in; fftwf_complex* _f_out; diff --git a/src/bhfmm/fft/tools/FFTW_Helper.cpp b/src/bhfmm/fft/tools/FFTW_Helper.cpp index 5ea72eb0b8..d28f2bf354 100644 --- a/src/bhfmm/fft/tools/FFTW_Helper.cpp +++ b/src/bhfmm/fft/tools/FFTW_Helper.cpp @@ -7,7 +7,7 @@ #include "FFTW_Helper.h" -#if defined(__SINGLE_PRECISION_FFT__) +#if defined(__SINGLE_PRECISION_FFT__) FFTW_Helper::FFTW_Helper(const int p, const int nx, const int ny) : _p(p),_nx(nx), _ny(ny) { S2FFT_in = (fftwf_complex*)fftwf_malloc(sizeof(fftwf_complex)*nx*ny); @@ -74,7 +74,7 @@ FFTW_Helper::~FFTW_Helper() { #endif -#if defined(__SINGLE_PRECISION_FFT__) +#if defined(__SINGLE_PRECISION_FFT__) fftwf_complex* FFTW_Helper::Source2FFT(FFTAccelerableExpansion & Expansion, double radius) #else fftw_complex* FFTW_Helper::Source2FFT(FFTAccelerableExpansion & Expansion, @@ -116,7 +116,7 @@ fftw_complex* FFTW_Helper::Source2FFT(FFTAccelerableExpansion & Expansion, return S2FFT_out; } -#if defined(__SINGLE_PRECISION_FFT__) +#if defined(__SINGLE_PRECISION_FFT__) fftwf_complex* FFTW_Helper::TransferFunction2FFT(FFTAccelerableExpansion & Expansion) #else fftw_complex* FFTW_Helper::TransferFunction2FFT( diff --git a/src/bhfmm/fft/tools/FFTW_Helper.h b/src/bhfmm/fft/tools/FFTW_Helper.h index a0972294d5..e544aa1149 100644 --- a/src/bhfmm/fft/tools/FFTW_Helper.h +++ b/src/bhfmm/fft/tools/FFTW_Helper.h @@ -24,7 +24,7 @@ class FFTW_Helper { void FFT2Local(FFTAccelerableExpansion & Expansion, double radius); inline void execute_S2FFT() { -#if defined(__SINGLE_PRECISION_FFT__) +#if defined(__SINGLE_PRECISION_FFT__) fftwf_execute(S2FFT); #else fftw_execute(S2FFT); @@ -32,7 +32,7 @@ class FFTW_Helper { } inline void execute_T2FFT() { -#if defined(__SINGLE_PRECISION_FFT__) +#if defined(__SINGLE_PRECISION_FFT__) fftwf_execute(T2FFT); #else fftw_execute(T2FFT); @@ -40,14 +40,14 @@ class FFTW_Helper { } inline void execute_FFT2L() { -#if defined(__SINGLE_PRECISION_FFT__) +#if defined(__SINGLE_PRECISION_FFT__) fftwf_execute(FFT2L); #else fftw_execute(FFT2L); #endif } -#if defined(__SINGLE_PRECISION_FFT__) +#if defined(__SINGLE_PRECISION_FFT__) fftwf_complex* Source2FFT(FFTAccelerableExpansion & Expansion, double radius); fftwf_complex* TransferFunction2FFT(FFTAccelerableExpansion & Expansion); diff --git a/src/bhfmm/fft/tools/fft_utils.cpp b/src/bhfmm/fft/tools/fft_utils.cpp index 3df20ba5e6..033b6b03d2 100644 --- a/src/bhfmm/fft/tools/fft_utils.cpp +++ b/src/bhfmm/fft/tools/fft_utils.cpp @@ -8,7 +8,7 @@ /* * Allocate a contiguous matrix - * This way if a = &Mat[x][y]; + * This way if a = &Mat[x][y]; * a[z] <=> Mat[x+(y+z)/x][(y+z) mod x] * In particular a[x] = Mat[x+1][y] (easy column manipulation for UHFFT) */ diff --git a/src/bhfmm/fft/tools/optimizedFFT/FakedOptFFT.cpp b/src/bhfmm/fft/tools/optimizedFFT/FakedOptFFT.cpp index 403c485040..09dff0d694 100644 --- a/src/bhfmm/fft/tools/optimizedFFT/FakedOptFFT.cpp +++ b/src/bhfmm/fft/tools/optimizedFFT/FakedOptFFT.cpp @@ -139,7 +139,7 @@ void FakedOptFFT::optimizedIFFT(FFT_precision** & Real, FFT_precision** & Imag, fftwf_complex* in, *out; #else fftw_complex* in, *out; -#endif +#endif int i, j; const int size_y_fft = size_y * 2; diff --git a/src/bhfmm/fft/tools/optimizedFFT/FakedOptFFT.h b/src/bhfmm/fft/tools/optimizedFFT/FakedOptFFT.h index 2ac9f02370..f3ac6eb4b5 100644 --- a/src/bhfmm/fft/tools/optimizedFFT/FakedOptFFT.h +++ b/src/bhfmm/fft/tools/optimizedFFT/FakedOptFFT.h @@ -17,8 +17,6 @@ #include #include -using namespace std; - //struct storing a int[2] for the map struct pos { int x, y; @@ -32,7 +30,7 @@ struct pos_comp { }; /** - * Implementation of the scheme of the optimized FFT that reconstruct the whole matrix + * Implementation of the scheme of the optimized FFT that reconstruct the whole matrix * and use FFTW to perform the FFT/IFFT * Use a map to store the various FFTW_API needed to perform the optimized FFT */ @@ -60,7 +58,7 @@ class FakedOptFFT: public optFFT_API { const int size_x, const int size_y); private: - map _fftw_api_map; //storage of the various FFTW_API required + std::map _fftw_api_map; //storage of the various FFTW_API required FFTW_API* getFFTW_API(const int size_x, const int size_y); //memoized function using the map }; diff --git a/src/bhfmm/fft/tools/optimizedFFT/optFFT_API.h b/src/bhfmm/fft/tools/optimizedFFT/optFFT_API.h index 926d735fe5..1507081bf0 100644 --- a/src/bhfmm/fft/tools/optimizedFFT/optFFT_API.h +++ b/src/bhfmm/fft/tools/optimizedFFT/optFFT_API.h @@ -12,7 +12,7 @@ /** * API of the optimized FFT - * + * * Perform all operations in place */ class optFFT_API { diff --git a/src/bhfmm/fft/transferFunctionManager/DummyExpansion.h b/src/bhfmm/fft/transferFunctionManager/DummyExpansion.h index 0d65a8ccb9..1366c1595c 100644 --- a/src/bhfmm/fft/transferFunctionManager/DummyExpansion.h +++ b/src/bhfmm/fft/transferFunctionManager/DummyExpansion.h @@ -12,7 +12,7 @@ /* * Dummy SH_Expansion used to compute the transfer function from the vector - * + * * Use a DummyStorage (truncated version of SH_Storage) */ @@ -54,7 +54,7 @@ class DummyStorage { /** * Truncated version of SH_Expansion used by to compute the transferfunction * from the vector - * + * * Extend FFTAccelerableExpansion so it can be used by a FFTAcceleration * evaluate_M_at_r(double X, double Y, double Z) convert the DummyExpansion to a Transferfunction * expansion of vector [X,Y,Z] (carthesian coordinates) diff --git a/src/bhfmm/fft/transferFunctionManager/TransferFunctionManager.h b/src/bhfmm/fft/transferFunctionManager/TransferFunctionManager.h index bdd7d63475..3824f9f176 100644 --- a/src/bhfmm/fft/transferFunctionManager/TransferFunctionManager.h +++ b/src/bhfmm/fft/transferFunctionManager/TransferFunctionManager.h @@ -19,8 +19,8 @@ * Class managing the TransferFunction * To use in the main M2L loop to get the FFTDataContainer* transferfunction * required by the FFTAcceleration's M2L - * - * Delegate FFT conversions and handling of the true implementation of + * + * Delegate FFT conversions and handling of the true implementation of * the abstract FFTDataContainer to a FFTAcceleration */ class TransferFunctionManager: public TransferFunctionManagerAPI { diff --git a/src/bhfmm/utils/WignerMatrix.cpp b/src/bhfmm/utils/WignerMatrix.cpp index a029ca5c13..eaae4e5e3e 100644 --- a/src/bhfmm/utils/WignerMatrix.cpp +++ b/src/bhfmm/utils/WignerMatrix.cpp @@ -12,7 +12,7 @@ #include #include "WignerMatrix.h" #include "utils/Logger.h" -using Log::global_log; + namespace bhfmm { @@ -148,24 +148,23 @@ void WignerMatrix::apply_minus_one_pow() { void WignerMatrix::print(int maxl) { - using namespace std; - int precisionSetting = cout.precision( ); - ios::fmtflags flagSettings = cout.flags(); + int precisionSetting = std::cout.precision( ); + std::ios::fmtflags flagSettings = std::cout.flags(); - cout.setf(ios::fixed | ios::showpos | ios::showpoint); - cout.precision(5); + std::cout.setf(std::ios::fixed | std::ios::showpos | std::ios::showpoint); + std::cout.precision(5); for(int l = 0; l <= maxl; ++l) { for(int m = 0; m <= l; ++m) { for (int k = -l; k <= l; ++k) { - cout << left << setw(10) << this->acc_c(l,m,k); + std::cout << std::left << std::setw(10) << this->acc_c(l,m,k); } - cout << endl; + std::cout << std::endl; } - cout << endl; + std::cout << std::endl; } - cout.precision(precisionSetting); - cout.flags(flagSettings); + std::cout.precision(precisionSetting); + std::cout.flags(flagSettings); } void WignerMatrix::initializeSqrtLookUp() { @@ -218,7 +217,7 @@ void WignerMatrix::scale() { } } } else { - global_log->error() << "type must be either L or M" << std::endl; + Log::global_log->error() << "type must be either L or M" << std::endl; } } diff --git a/src/ensemble/BoxDomain.cpp b/src/ensemble/BoxDomain.cpp index ad3174233a..77185622ac 100644 --- a/src/ensemble/BoxDomain.cpp +++ b/src/ensemble/BoxDomain.cpp @@ -3,8 +3,7 @@ #include "utils/Logger.h" #include "utils/xmlfileUnits.h" -using namespace std; -using Log::global_log; + BoxDomain::BoxDomain() { for( int d = 0; d < 3; d++) @@ -15,8 +14,8 @@ void BoxDomain::readXML(XMLfileUnits& xmlconfig) { xmlconfig.getNodeValueReduced("lx",_rmax[0]); xmlconfig.getNodeValueReduced("ly",_rmax[1]); xmlconfig.getNodeValueReduced("lz",_rmax[2]); - global_log->info() << "Box lower corner (x,y,z): " << _rmin[0] << "," << _rmin[1] << "," << _rmin[2] << endl; - global_log->info() << "Box upper corner (x,y,z): " << _rmax[0] << "," << _rmax[1] << "," << _rmax[2] << endl; + Log::global_log->info() << "Box lower corner (x,y,z): " << _rmin[0] << "," << _rmin[1] << "," << _rmin[2] << std::endl; + Log::global_log->info() << "Box upper corner (x,y,z): " << _rmax[0] << "," << _rmax[1] << "," << _rmax[2] << std::endl; } double BoxDomain::V() { diff --git a/src/ensemble/CanonicalEnsemble.cpp b/src/ensemble/CanonicalEnsemble.cpp index 80c67255fa..82c61fb963 100644 --- a/src/ensemble/CanonicalEnsemble.cpp +++ b/src/ensemble/CanonicalEnsemble.cpp @@ -19,9 +19,6 @@ #include "utils/xmlfileUnits.h" -using namespace std; -using Log::global_log; - CanonicalEnsemble::CanonicalEnsemble() : _N(0), _V(0), _T(0), _mu(0), _p(0), _E(0), _E_trans(0), _E_rot(0) { _type = NVT; @@ -36,7 +33,7 @@ void CanonicalEnsemble::updateGlobalVariable(ParticleContainer* particleContaine /* "fixed" variables of this ensemble */ if((variable & NUM_PARTICLES) | (variable & TEMPERATURE)) { - global_log->debug() << "Updating particle counts" << endl; + Log::global_log->debug() << "Updating particle counts" << std::endl; /* initializes the number of molecules present in each component! */ std::vector numMolecules(numComponents, 0ul); @@ -72,7 +69,7 @@ void CanonicalEnsemble::updateGlobalVariable(ParticleContainer* particleContaine #ifdef ENABLE_MPI numMolecules[cid] = _simulation.domainDecomposition().collCommGetUnsLong(); #endif - global_log->debug() << "Number of molecules in component " << cid << ": " << numMolecules[cid] << endl; + Log::global_log->debug() << "Number of molecules in component " << cid << ": " << numMolecules[cid] << std::endl; _N += numMolecules[cid]; _components[cid].setNumMolecules(numMolecules[cid]); } @@ -82,22 +79,22 @@ void CanonicalEnsemble::updateGlobalVariable(ParticleContainer* particleContaine } if(variable & VOLUME) { - global_log->debug() << "Updating volume" << endl; + Log::global_log->debug() << "Updating volume" << std::endl; /* TODO: calculate actual volume or return specified volume as * the canonical ensemble should have a fixed volume? */ } /* variable variables of this ensemble */ if(variable & CHEMICAL_POTENTIAL) { - global_log->debug() << "Updating chemical potential" << endl; + Log::global_log->debug() << "Updating chemical potential" << std::endl; } if(variable & PRESSURE) { - global_log->info() << "Updating pressure" << endl; + Log::global_log->info() << "Updating pressure" << std::endl; } if((variable & ENERGY) | (variable & TEMPERATURE)) { - global_log->debug() << "Updating energy" << endl; + Log::global_log->debug() << "Updating energy" << std::endl; std::vector E_trans(numComponents, 0.); std::vector E_rot(numComponents, 0.); @@ -142,8 +139,8 @@ void CanonicalEnsemble::updateGlobalVariable(ParticleContainer* particleContaine E_trans[cid] = _simulation.domainDecomposition().collCommGetDouble(); E_rot[cid] = _simulation.domainDecomposition().collCommGetDouble(); #endif - global_log->debug() << "Kinetic energy in component " << cid << ": " << - "E_trans = " << E_trans[cid] << ", E_rot = " << E_rot[cid] << endl; + Log::global_log->debug() << "Kinetic energy in component " << cid << ": " << + "E_trans = " << E_trans[cid] << ", E_rot = " << E_rot[cid] << std::endl; _components[cid].setE_trans(E_trans[cid]); _components[cid].setE_rot(E_rot[cid]); _E_trans += E_trans[cid]; @@ -153,14 +150,14 @@ void CanonicalEnsemble::updateGlobalVariable(ParticleContainer* particleContaine _simulation.domainDecomposition().collCommFinalize(); #endif - global_log->debug() << "Total Kinetic energy: 2*E_trans = " << _E_trans - << ", 2*E_rot = " << _E_rot << endl; + Log::global_log->debug() << "Total Kinetic energy: 2*E_trans = " << _E_trans + << ", 2*E_rot = " << _E_rot << std::endl; _E = _E_trans + _E_rot; } if(variable & TEMPERATURE) { - global_log->debug() << "Updating temperature" << endl; - /* TODO: calculate actual temperature or return specified temperature as + Log::global_log->debug() << "Updating temperature" << std::endl; + /* TODO: calculate actual temperature or return specified temperature as * the canonical ensemble should have a fixed temperature? */ long long totalDegreesOfFreedom = 0; for(int cid = 0; cid < numComponents; cid++) { @@ -171,8 +168,8 @@ void CanonicalEnsemble::updateGlobalVariable(ParticleContainer* particleContaine double E_kin = _components[cid].E(); double T = E_kin / degreesOfFreedom; - global_log->debug() << "Temperature of component " << cid << ": " << - "T = " << T << endl; + Log::global_log->debug() << "Temperature of component " << cid << ": " << + "T = " << T << std::endl; _components[cid].setT(T); } _T = _E / totalDegreesOfFreedom; @@ -190,22 +187,22 @@ void CanonicalEnsemble::readXML(XMLfileUnits& xmlconfig) { Ensemble::readXML(xmlconfig); xmlconfig.getNodeValueReduced("temperature", _T); - global_log->info() << "Temperature: " << _T << endl; - string domaintype; + Log::global_log->info() << "Temperature: " << _T << std::endl; + std::string domaintype; xmlconfig.getNodeValue("domain@type", domaintype); - global_log->info() << "Domain type: " << domaintype << endl; + Log::global_log->info() << "Domain type: " << domaintype << std::endl; if("box" == domaintype) { _domain = new BoxDomain(); } else { - global_log->error() << "Volume type not supported." << endl; + Log::global_log->error() << "Volume type not supported." << std::endl; Simulation::exit(1); } xmlconfig.changecurrentnode("domain"); _domain->readXML(xmlconfig); xmlconfig.changecurrentnode(".."); _V = _domain->V(); - global_log->info() << "Volume: " << _V << endl; - global_log->warning() << "Box dimensions not set yet in domain class" << endl; + Log::global_log->info() << "Volume: " << _V << std::endl; + Log::global_log->warning() << "Box dimensions not set yet in domain class" << std::endl; } void CanonicalEnsemble::beforeThermostat(unsigned long simstep, unsigned long initStatistics) { diff --git a/src/ensemble/CanonicalEnsemble.h b/src/ensemble/CanonicalEnsemble.h index cf278e546a..02e82e2d21 100644 --- a/src/ensemble/CanonicalEnsemble.h +++ b/src/ensemble/CanonicalEnsemble.h @@ -6,9 +6,9 @@ #include "ensemble/EnsembleBase.h" #include "particleContainer/ParticleContainer.h" -/** @brief Canonical ensemble (NVT) +/** @brief Canonical ensemble (NVT) * @author Christoph Niethammer - * + * * This class provides access to all global variables of the canonical ensemble (NVT). **/ class Component; diff --git a/src/ensemble/CavityEnsemble.cpp b/src/ensemble/CavityEnsemble.cpp index 5311123d84..f561e1ad8e 100644 --- a/src/ensemble/CavityEnsemble.cpp +++ b/src/ensemble/CavityEnsemble.cpp @@ -9,8 +9,6 @@ #define COMMUNICATION_THRESHOLD 3 -using Log::global_log; - CavityEnsemble::CavityEnsemble() { this->ownrank = -1; this->initialized = false; @@ -37,8 +35,8 @@ CavityEnsemble::CavityEnsemble() { control_top[1] = 1.0; control_top[2] = 1.0; - this->active = set(); - this->reservoir = map(); + this->active = std::set(); + this->reservoir = std::map(); this->globalActive = 0; this->boundarySpecified = false; @@ -95,7 +93,7 @@ void CavityEnsemble::setSubdomain(int rank, double x0, double x1, double y0, dou void CavityEnsemble::setControlVolume(double x0, double y0, double z0, double x1, double y1, double z1) { if ((x0 >= x1) || (y0 >= y1) || (z0 >= z1)) { - global_log->error() << "\nInvalid control volume (" << x0 << " / " << y0 + Log::global_log->error() << "\nInvalid control volume (" << x0 << " / " << y0 << " / " << z0 << ") to (" << x1 << " / " << y1 << " / " << z1 << ")." << std::endl; Simulation::exit(711); @@ -113,19 +111,19 @@ void CavityEnsemble::setControlVolume(double x0, double y0, double z0, double x1 void CavityEnsemble::init(Component *component, unsigned Nx, unsigned Ny, unsigned Nz) { if (this->ownrank < 0) { - global_log->error() << "\nInvalid rank " << ownrank << ".\n"; + Log::global_log->error() << "\nInvalid rank " << ownrank << ".\n"; Simulation::exit(712); } if (this->initialized) { - global_log->error() << "\nCavity ensemble initialized twice.\n"; + Log::global_log->error() << "\nCavity ensemble initialized twice.\n"; Simulation::exit(713); } if (0.0 >= this->T) { - global_log->error() << "\nInvalid temperature T = " << T << ".\n"; + Log::global_log->error() << "\nInvalid temperature T = " << T << ".\n"; Simulation::exit(714); } if (0.0 >= this->globalV) { - global_log->error() << "\nInvalid control volume V_ctrl = " << globalV << ".\n"; + Log::global_log->error() << "\nInvalid control volume V_ctrl = " << globalV << ".\n"; Simulation::exit(715); } @@ -232,7 +230,7 @@ void CavityEnsemble::preprocessStep() { if (this->rotated) return; if (this->reservoir.size() == 0) return; - map::iterator resit = this->reservoir.begin(); + std::map::iterator resit = this->reservoir.begin(); double qtr[4]; Component *tc = resit->second->component(); @@ -268,9 +266,9 @@ bool CavityEnsemble::decideActivity(double /*uPotTilde*/, unsigned long tmid) { return false; } -map CavityEnsemble::activeParticleContainer() { - map retv; - set::iterator resit; +std::map CavityEnsemble::activeParticleContainer() { + std::map retv; + std::set::iterator resit; for (resit = this->active.begin(); resit != active.end(); resit++) { retv[*resit] = this->reservoir[*resit]; } @@ -290,18 +288,18 @@ unsigned CavityEnsemble::countNeighbours(ParticleContainer *container, Molecule lo[d] = std::max(0.0, m1->r(d) - R); hi[d] = std::min(system[d], m1->r(d) + R); } - //global_log->info() << "[CavityWriter] post_lo_hi" << endl; + //global_log->info() << "[CavityWriter] post_lo_hi" << std::endl; - //global_log->info() << "[CavityWriter] post region iterator" << endl; + //global_log->info() << "[CavityWriter] post region iterator" << std::endl; for (auto m2 = container->regionIterator(lo, hi, ParticleIterator::ALL_CELLS); m2.isValid(); ++m2) { if (m2->getID() == m1->getID()) { - //global_log->info() << "[CavityWriter] same ID" << endl; + //global_log->info() << "[CavityWriter] same ID" << std::endl; continue; } double distanceVectorDummy[3] = {0.0, 0.0, 0.0}; double dd = m2->dist2(*m1, distanceVectorDummy); - //global_log->info() << "[CavityWriter] post distance" << endl; + //global_log->info() << "[CavityWriter] post distance" << std::endl; if (dd < RR) { ++m1neigh; } @@ -313,18 +311,18 @@ unsigned CavityEnsemble::countNeighbours(ParticleContainer *container, Molecule void CavityEnsemble::cavityStep(ParticleContainer *globalMoleculeContainer) { // don't confuse with the other ParticleContainer, the base-class of LinkedCells! - map *pc = this->particleContainer(); + std::map *pc = this->particleContainer(); for (auto pcit = pc->begin(); pcit != pc->end(); pcit++) { mardyn_assert(pcit->second != NULL); Molecule *m1 = pcit->second; - //global_log->info() << "[CavityWriter] pre-neighbors" << endl; + //global_log->info() << "[CavityWriter] pre-neighbors" << std::endl; unsigned neigh = this->countNeighbours(globalMoleculeContainer, m1); - //global_log->info() << "[CavityWriter] post-neighbors" << endl; + //global_log->info() << "[CavityWriter] post-neighbors" << std::endl; unsigned long m1id = pcit->first; mardyn_assert(m1id == m1->getID()); this->decideActivity(neigh, m1id); - //global_log->info() << "[CavityWriter] post-activity" << endl; + //global_log->info() << "[CavityWriter] post-activity" << std::endl; } } diff --git a/src/ensemble/CavityEnsemble.h b/src/ensemble/CavityEnsemble.h index 1e080eb48c..ec1d0297a0 100644 --- a/src/ensemble/CavityEnsemble.h +++ b/src/ensemble/CavityEnsemble.h @@ -7,7 +7,6 @@ #include "utils/Random.h" -using namespace std; class DomainDecompBase; @@ -54,9 +53,9 @@ class CavityEnsemble { unsigned long numCavities() { return this->globalActive; } - map *particleContainer() { return &(this->reservoir); } + std::map *particleContainer() { return &(this->reservoir); } - map activeParticleContainer(); + std::map activeParticleContainer(); void determineBoundary(); @@ -88,8 +87,8 @@ class CavityEnsemble { double control_top[3]; unsigned long idoffset; - set active; - map reservoir; + std::set active; + std::map reservoir; unsigned long globalActive; bool boundarySpecified; diff --git a/src/ensemble/ChemicalPotential.cpp b/src/ensemble/ChemicalPotential.cpp index b2c2d80ee4..744906dab2 100644 --- a/src/ensemble/ChemicalPotential.cpp +++ b/src/ensemble/ChemicalPotential.cpp @@ -5,8 +5,6 @@ #include "particleContainer/adapter/ParticlePairs2PotForceAdapter.h" #include "utils/Logger.h" -using namespace std; -using Log::global_log; ChemicalPotential::ChemicalPotential() { @@ -27,11 +25,11 @@ ChemicalPotential::ChemicalPotential() _globalV = 1.0; _restrictedControlVolume = false; - _remainingDeletions = list(); + _remainingDeletions = std::list(); for (int d = 0; d < 3; d++) - _remainingInsertions[d] = list(); - _remainingInsertionIDs = list(); - _remainingDecisions = list(); + _remainingInsertions[d] = std::list(); + _remainingInsertionIDs = std::list(); + _remainingDecisions = std::list(); _reservoir = NULL; _id_increment = 1; _lambda = 1.0; @@ -117,7 +115,7 @@ void ChemicalPotential::prepareTimestep(ParticleContainer* moleculeContainer, float maxrnd = 1.0; _globalN = comm->Ndistribution(localN, &minrnd, &maxrnd); #ifndef NDEBUG - global_log->debug() << " believes N(" << _componentid << ")=" << _globalN + Log::global_log->debug() << " believes N(" << _componentid << ")=" << _globalN << ", rho=" << _globalN / _globalV << ", the decisive density quotient equals " << (float) _globalN / _globalReducedVolume << "\n"; @@ -148,7 +146,7 @@ void ChemicalPotential::prepareTimestep(ParticleContainer* moleculeContainer, int insertions = _instances; #ifndef NDEBUG - global_log->debug() << "Number of insertions: " << insertions << ".\n"; + Log::global_log->debug() << "Number of insertions: " << insertions << ".\n"; #endif // construct insertions @@ -253,7 +251,7 @@ ParticleIterator ChemicalPotential::getDeletion(ParticleContainer* moleculeConta } #ifndef NDEBUG - global_log->debug() << "ID " << m->getID() << " selected for deletion (index " << idx << ")." << std::endl; + Log::global_log->debug() << "ID " << m->getID() << " selected for deletion (index " << idx << ")." << std::endl; #endif mardyn_assert(m->getID() < _nextid); @@ -282,11 +280,11 @@ bool ChemicalPotential::decideDeletion(double deltaUTilde) if (_remainingDecisions.empty()) { if (_widom) { - global_log->error() + Log::global_log->error() << "SEVERE WARNING: The Widom method is (erroneously) trying to carry out test deletions.\n"; return false; } - global_log->error() << "No decision is possible." << std::endl; + Log::global_log->error() << "No decision is possible." << std::endl; Simulation::exit(1); } float dec = *_remainingDecisions.begin(); @@ -315,11 +313,11 @@ bool ChemicalPotential::decideInsertion(double deltaUTilde) { if (_remainingDecisions.empty()) { if (_widom) { - global_log->error() << "!!! SEVERE WARNING on rank " << _ownrank + Log::global_log->error() << "!!! SEVERE WARNING on rank " << _ownrank << ": no decision is possible !!!\n"; return false; } - global_log->error() << "No decision is possible." << std::endl; + Log::global_log->error() << "No decision is possible." << std::endl; Simulation::exit(1); } double acc = _globalReducedVolume * exp(_muTilde - deltaUTilde) @@ -362,9 +360,9 @@ void ChemicalPotential::submitTemperature(double T_in) #endif if (doOutput >= 0.01) return; - cout << "rank " << _ownrank << " sets mu~ <- " << _muTilde; - cout << ", T <- " << _T << ", lambda <- " << _lambda; - cout << ", and Vred <- " << _globalReducedVolume << "\n"; + std::cout << "rank " << _ownrank << " sets mu~ <- " << _muTilde; + std::cout << ", T <- " << _T << ", lambda <- " << _lambda; + std::cout << ", and Vred <- " << _globalReducedVolume << "\n"; } void ChemicalPotential::assertSynchronization(DomainDecompBase* comm) { @@ -375,7 +373,7 @@ void ChemicalPotential::setControlVolume(double x0, double y0, double z0, double x1, double y1, double z1) { if ((x0 >= x1) || (y0 >= y1) || (z0 >= z1)) { - global_log->error() << "\nInvalid control volume (" << x0 << " / " << y0 + Log::global_log->error() << "\nInvalid control volume (" << x0 << " / " << y0 << " / " << z0 << ") to (" << x1 << " / " << y1 << " / " << z1 << ")." << std::endl; Simulation::exit(611); @@ -480,13 +478,13 @@ void ChemicalPotential::grandcanonicalStep( accept = this->decideDeletion(DeltaUpot / T); #ifndef NDEBUG if (accept) { - cout << "r" << this->rank() << "d" << m->getID() << " with energy " << DeltaUpot << endl; - cout.flush(); + std::cout << "r" << this->rank() << "d" << m->getID() << " with energy " << DeltaUpot << std::endl; + std::cout.flush(); } /* else cout << " (r" << this->rank() << "-d" << m->getID() - << ")" << endl; + << ")" << std::endl; */ #endif if (accept) { @@ -548,7 +546,7 @@ void ChemicalPotential::grandcanonicalStep( /* cout << "rank " << this->rank() << ": insert " << m->getID() << " at the reduced position (" << ins[0] << "/" - << ins[1] << "/" << ins[2] << ")? " << endl; + << ins[1] << "/" << ins[2] << ")? " << std::endl; */ #endif @@ -561,14 +559,14 @@ void ChemicalPotential::grandcanonicalStep( #ifndef NDEBUG if (accept) { - cout << "r" << this->rank() << "i" << mit->getID() - << " with energy " << DeltaUpot << endl; - cout.flush(); + std::cout << "r" << this->rank() << "i" << mit->getID() + << " with energy " << DeltaUpot << std::endl; + std::cout.flush(); } /* else cout << " (r" << this->rank() << "-i" - << mit->getID() << ")" << endl; + << mit->getID() << ")" << std::endl; */ #endif if (accept) { diff --git a/src/ensemble/EnsembleBase.cpp b/src/ensemble/EnsembleBase.cpp index 9ed13c9cba..f9f99e586f 100644 --- a/src/ensemble/EnsembleBase.cpp +++ b/src/ensemble/EnsembleBase.cpp @@ -9,8 +9,6 @@ #include -using namespace std; -using Log::global_log; Ensemble::~Ensemble() { delete _domain; @@ -23,21 +21,21 @@ void Ensemble::readXML(XMLfileUnits& xmlconfig) { long numComponents = 0; XMLfile::Query query = xmlconfig.query("components/moleculetype"); numComponents = query.card(); - global_log->info() << "Number of components: " << numComponents << endl; + Log::global_log->info() << "Number of components: " << numComponents << std::endl; if (numComponents == 0) { - global_log->fatal() << "No components found. Please verify that you have input them correctly." << std::endl; + Log::global_log->fatal() << "No components found. Please verify that you have input them correctly." << std::endl; Simulation::exit(96123); } _components.resize(numComponents); XMLfile::Query::const_iterator componentIter; - string oldpath = xmlconfig.getcurrentnodepath(); + std::string oldpath = xmlconfig.getcurrentnodepath(); for(componentIter = query.begin(); componentIter; componentIter++) { xmlconfig.changecurrentnode(componentIter); unsigned int cid = 0; xmlconfig.getNodeValue("@id", cid); _components[cid - 1].readXML(xmlconfig); _componentnamesToIds[_components[cid - 1].getName()] = cid - 1; - global_log->debug() << _components[cid - 1].getName() << " --> " << cid - 1 << endl; + Log::global_log->debug() << _components[cid - 1].getName() << " --> " << cid - 1 << std::endl; } xmlconfig.changecurrentnode(oldpath); @@ -46,7 +44,7 @@ void Ensemble::readXML(XMLfileUnits& xmlconfig) { XMLfile::Query::const_iterator mixingruletIter; uint32_t numMixingrules = 0; numMixingrules = query.card(); - global_log->info() << "Found " << numMixingrules << " mixing rules." << endl; + Log::global_log->info() << "Found " << numMixingrules << " mixing rules." << std::endl; _mixingrules.resize(numMixingrules); // data structure for mixing coefficients of domain class (still in use!!!) @@ -56,15 +54,15 @@ void Ensemble::readXML(XMLfileUnits& xmlconfig) { for(mixingruletIter = query.begin(); mixingruletIter; mixingruletIter++) { xmlconfig.changecurrentnode(mixingruletIter); MixingRuleBase* mixingrule = nullptr; - string mixingruletype; + std::string mixingruletype; xmlconfig.getNodeValue("@type", mixingruletype); - global_log->info() << "Mixing rule type: " << mixingruletype << endl; + Log::global_log->info() << "Mixing rule type: " << mixingruletype << std::endl; if("LB" == mixingruletype) { mixingrule = new LorentzBerthelotMixingRule(); } else { - global_log->error() << "Unknown mixing rule " << mixingruletype << endl; + Log::global_log->error() << "Unknown mixing rule " << mixingruletype << std::endl; Simulation::exit(1); } mixingrule->readXML(xmlconfig); diff --git a/src/ensemble/EnsembleBase.h b/src/ensemble/EnsembleBase.h index 5a0f7b55fe..51074af6cd 100644 --- a/src/ensemble/EnsembleBase.h +++ b/src/ensemble/EnsembleBase.h @@ -41,8 +41,8 @@ class XMLfileUnits; //! @brief Base class for ensembles //! @author Christoph Niethammer -//! -//! Each ensemble should provide access to extensive (NVE) and intensive +//! +//! Each ensemble should provide access to extensive (NVE) and intensive //! (\mu p t) variables as well as a function to update global variables. class Ensemble { public: diff --git a/src/ensemble/GrandCanonicalEnsemble.cpp b/src/ensemble/GrandCanonicalEnsemble.cpp index c7b32346b9..0ef49b1817 100644 --- a/src/ensemble/GrandCanonicalEnsemble.cpp +++ b/src/ensemble/GrandCanonicalEnsemble.cpp @@ -64,7 +64,7 @@ void GrandCanonicalEnsemble::prepare_start() { if((Tcur < 0.85 * Ttar) || (Tcur > 1.15 * Ttar)) Tcur = Ttar; - list::iterator cpit; + std::list::iterator cpit; if(global_simulation->getH() == 0.0) global_simulation->setH(sqrt(6.2831853 * Ttar)); for(cpit = _lmu.begin(); cpit != _lmu.end(); cpit++) { @@ -80,7 +80,7 @@ void GrandCanonicalEnsemble::beforeEventNewTimestep(ParticleContainer* moleculeC /** @todo What is this good for? Where come the numbers from? Needs documentation */ if(simstep >= _initGrandCanonical) { unsigned j = 0; - list::iterator cpit; + std::list::iterator cpit; for(cpit = _lmu.begin(); cpit != _lmu.end(); cpit++) { if(!((simstep + 2 * j + 3) % cpit->getInterval())) { cpit->prepareTimestep(moleculeContainer, domainDecomposition); @@ -96,11 +96,11 @@ void GrandCanonicalEnsemble::afterForces(ParticleContainer* moleculeContainer, D if(simstep >= _initGrandCanonical) { unsigned j = 0; - list::iterator cpit; + std::list::iterator cpit; for(cpit = _lmu.begin(); cpit != _lmu.end(); cpit++) { if(!((simstep + 2 * j + 3) % cpit->getInterval())) { - global_log->debug() << "Grand canonical ensemble(" << j << "): test deletions and insertions" - << endl; + Log::global_log->debug() << "Grand canonical ensemble(" << j << "): test deletions and insertions" + << std::endl; this->_simulationDomain->setLambda(cpit->getLambda()); this->_simulationDomain->setDensityCoefficient(cpit->getDensityCoefficient()); double localUpotBackup = _simulationDomain->getLocalUpot(); @@ -118,9 +118,9 @@ void GrandCanonicalEnsemble::afterForces(ParticleContainer* moleculeContainer, D int localBalance = cpit->getLocalGrandcanonicalBalance(); int balance = cpit->grandcanonicalBalance(domainDecomposition); - global_log->debug() << " b[" << ((balance > 0) ? "+" : "") << balance << "(" + Log::global_log->debug() << " b[" << ((balance > 0) ? "+" : "") << balance << "(" << ((localBalance > 0) ? "+" : "") << localBalance << ")" << " / c = " - << cpit->getComponentID() << "] " << endl; + << cpit->getComponentID() << "] " << std::endl; _simulationDomain->Nadd(cpit->getComponentID(), balance, localBalance); } @@ -143,4 +143,4 @@ void GrandCanonicalEnsemble::storeSample(Molecule* m, uint32_t componentid) { cpit->storeMolecule(*m); } } -} \ No newline at end of file +} diff --git a/src/ensemble/GrandCanonicalEnsemble.h b/src/ensemble/GrandCanonicalEnsemble.h index 4b85080943..5aba8da61f 100644 --- a/src/ensemble/GrandCanonicalEnsemble.h +++ b/src/ensemble/GrandCanonicalEnsemble.h @@ -40,7 +40,7 @@ class GrandCanonicalEnsemble : public Ensemble { // TODO: Implement STUB void readXML(XMLfileUnits& xmlconfig) override { - global_log->info() << "[GrandCanonicalEnsemble] readXML not implemented!" << std::endl; + Log::global_log->info() << "[GrandCanonicalEnsemble] readXML not implemented!" << std::endl; Simulation::exit(-1); }; @@ -70,7 +70,7 @@ class GrandCanonicalEnsemble : public Ensemble { // TODO: Implement void updateGlobalVariable(ParticleContainer* particleContainer, GlobalVariable variable) override { - global_log->info() << "[GrandCanonicalEnsemble] updateGlobalVariable not implemented!" << std::endl; + Log::global_log->info() << "[GrandCanonicalEnsemble] updateGlobalVariable not implemented!" << std::endl; Simulation::exit(-1); }; diff --git a/src/ensemble/PressureGradient.cpp b/src/ensemble/PressureGradient.cpp index 126f549404..a8fe7e0df7 100644 --- a/src/ensemble/PressureGradient.cpp +++ b/src/ensemble/PressureGradient.cpp @@ -9,15 +9,13 @@ #include "utils/Logger.h" #include "Simulation.h" -using namespace Log; -using namespace std; PressureGradient::PressureGradient(int rank) { this->_localRank = rank; this->_universalConstantAccelerationTimesteps = 0; if(!rank) for(unsigned short int d=0; d < 3; d++) - this->_globalVelocitySum[d] = map(); + this->_globalVelocitySum[d] = std::map(); this->_universalConstantTau = true; this->_universalZetaFlow = 0.0; this->_universalTauPrime = 0.0; @@ -45,8 +43,8 @@ void PressureGradient::specifyComponentSet(unsigned int cosetid, double v[3], do sqrt(this->_universalTau[cosetid] / (timestep*this->_universalConstantAccelerationTimesteps)) : this->_universalTauPrime / (timestep*this->_universalConstantAccelerationTimesteps) ); - cout << "coset " << cosetid << " will receive " - << _globalVelocityQueuelength[cosetid] << " velocity queue entries." << endl; + std::cout << "coset " << cosetid << " will receive " + << _globalVelocityQueuelength[cosetid] << " velocity queue entries." << std::endl; } } @@ -98,14 +96,14 @@ void PressureGradient::determineAdditionalAcceleration } domainDecomp->collCommFinalize(); - map::iterator gVSit; + std::map::iterator gVSit; if(!this->_localRank) { for(gVSit = _globalVelocitySum[0].begin(); gVSit != _globalVelocitySum[0].end(); gVSit++) { #ifndef NDEBUG - global_log->debug() << "required entries in velocity queue: " << _globalVelocityQueuelength[gVSit->first] << endl; - global_log->debug() << "entries in velocity queue: " << _globalPriorVelocitySums[0][gVSit->first].size() << endl; + Log::global_log->debug() << "required entries in velocity queue: " << _globalVelocityQueuelength[gVSit->first] << std::endl; + Log::global_log->debug() << "entries in velocity queue: " << _globalPriorVelocitySums[0][gVSit->first].size() << std::endl; #endif for(unsigned short int d = 0; d < 3; d++) { @@ -134,9 +132,9 @@ void PressureGradient::determineAdditionalAcceleration + previousVelocity[d] ); } #ifndef NDEBUG - global_log->debug() << "accelerator no. " << gVSit->first - << "previous vz: " << previousVelocity[2] - << "current vz: " << _globalVelocitySum[2][gVSit->first]*invgN << endl; + Log::global_log->debug() << "accelerator no. " << gVSit->first + << "previous vz: " << previousVelocity[2] + << "current vz: " << _globalVelocitySum[2][gVSit->first]*invgN << std::endl; #endif } } @@ -176,7 +174,7 @@ void PressureGradient::determineAdditionalAcceleration double PressureGradient::getDirectedVelocity(unsigned int cosetid, unsigned short int d) { - if(!this->_localRank) + if(!this->_localRank) return this->_globalVelocitySum[d][cosetid] / this->_globalN[cosetid]; else return 0.0; } @@ -221,15 +219,15 @@ void PressureGradient::specifyTauPrime(double tauPrime, double dt) if(this->_localRank != 0) return; if(this->_universalConstantAccelerationTimesteps == 0) { - global_log->error() << "SEVERE ERROR: unknown UCAT!\n"; + Log::global_log->error() << "SEVERE ERROR: unknown UCAT!\n"; Simulation::exit(78); } unsigned int vql = (unsigned int)ceil(tauPrime / (dt*this->_universalConstantAccelerationTimesteps)); - map::iterator vqlit; + std::map::iterator vqlit; for(vqlit = _globalVelocityQueuelength.begin(); vqlit != _globalVelocityQueuelength.end(); vqlit++) { vqlit->second = vql; - cout << "coset " << vqlit->first << " will receive " + std::cout << "coset " << vqlit->first << " will receive " << vqlit->second << " velocity queue entries.\n"; } } @@ -239,7 +237,7 @@ void PressureGradient::specifyTauPrime(double tauPrime, double dt) */ void PressureGradient::adjustTau(double dt) { if(this->_universalConstantTau) return; - map::iterator tauit; + std::map::iterator tauit; double increment; for(tauit = _universalTau.begin(); tauit != _universalTau.end(); tauit++) { diff --git a/src/ensemble/PressureGradient.h b/src/ensemble/PressureGradient.h index ac79206667..c1175318e6 100644 --- a/src/ensemble/PressureGradient.h +++ b/src/ensemble/PressureGradient.h @@ -119,17 +119,17 @@ class PressureGradient { ####### REMOVED PG FROM DOMAIN CONSTRUCTOR -> REMOVED UNIVERSALPG -> REMOVED FORWARD DECL IN .H AND INCLUDE IN .CPP this->_universalPG = pg; - // after: checkpointfilestream << _epsilonRF << endl; - map componentSets = this->_universalPG->getComponentSets(); - for( map::const_iterator uCSIDit = componentSets.begin(); + // after: checkpointfilestream << _epsilonRF << std::endl; + std::map componentSets = this->_universalPG->getComponentSets(); + for( std::map::const_iterator uCSIDit = componentSets.begin(); uCSIDit != componentSets.end(); uCSIDit++ ) { if(uCSIDit->first > 100) continue; checkpointfilestream << " S\t" << 1+uCSIDit->first << "\t" << uCSIDit->second << "\n"; } - map tau = this->_universalPG->getTau(); - for( map::const_iterator gTit = tau.begin(); + std::map tau = this->_universalPG->getTau(); + for( std::map::const_iterator gTit = tau.begin(); gTit != tau.end(); gTit++ ) { @@ -152,13 +152,13 @@ class PressureGradient { PressureGradient* _pressureGradient; //after: _longRangeCorrection->calculateLongRange(); in ####### if (_pressureGradient->isAcceleratingUniformly()) { - global_log->info() << "Initialising uniform acceleration." << endl; + Log::global_log->info() << "Initialising uniform acceleration." << std::endl; unsigned long uCAT = _pressureGradient->getUCAT(); - global_log->info() << "uCAT: " << uCAT << " steps." << endl; + Log::global_log->info() << "uCAT: " << uCAT << " steps." << std::endl; _pressureGradient->determineAdditionalAcceleration( _domainDecomposition, _moleculeContainer, uCAT * _integrator->getTimestepLength()); - global_log->info() << "Uniform acceleration initialised." << endl; + Log::global_log->info() << "Uniform acceleration initialised." << std::endl; } // first in simulate() @@ -168,18 +168,18 @@ class PressureGradient { // after: _domain->calculateThermostatDirectedVelocity(_moleculeContainer); in simulate() if (_pressureGradient->isAcceleratingUniformly()) { if (!(_simstep % uCAT)) { - global_log->debug() << "Determine the additional acceleration" << endl; + Log::global_log->debug() << "Determine the additional acceleration" << std::endl; _pressureGradient->determineAdditionalAcceleration( _domainDecomposition, _moleculeContainer, uCAT * _integrator->getTimestepLength()); } - global_log->debug() << "Process the uniform acceleration" << endl; + Log::global_log->debug() << "Process the uniform acceleration" << std::endl; _integrator->accelerateUniformly(_moleculeContainer, _domain); _pressureGradient->adjustTau(this->_integrator->getTimestepLength()); } // in initialize() before Domain() - global_log->info() << "Creating PressureGradient ... " << endl; + Log::global_log->info() << "Creating PressureGradient ... " << std::endl; _pressureGradient = new PressureGradient(ownrank); ####### REMOVED FUNCTION ONLY CALLED BY PG FROM INTEGRATOR, LEAPFROG AND LEAPFROGRMM @@ -218,10 +218,10 @@ class PressureGradient { ); void Leapfrog::accelerateUniformly(ParticleContainer* molCont, Domain* domain) { - map* additionalAcceleration = domain->getPG()->getUAA(); - vector comp = *(_simulation.getEnsemble()->getComponents()); - vector::iterator compit; - map componentwiseVelocityDelta[3]; + std::map* additionalAcceleration = domain->getPG()->getUAA(); + std::vector comp = *(_simulation.getEnsemble()->getComponents()); + std::vector::iterator compit; + std::map componentwiseVelocityDelta[3]; for (compit = comp.begin(); compit != comp.end(); compit++) { unsigned cosetid = domain->getPG()->getComponentSet(compit->ID()); if (cosetid != 0) @@ -247,9 +247,9 @@ class PressureGradient { } void Leapfrog::accelerateInstantaneously(ParticleContainer* molCont, Domain* domain) { - vector comp = *(_simulation.getEnsemble()->getComponents()); - vector::iterator compit; - map componentwiseVelocityDelta[3]; + std::vector comp = *(_simulation.getEnsemble()->getComponents()); + std::vector::iterator compit; + std::map componentwiseVelocityDelta[3]; for (compit = comp.begin(); compit != comp.end(); compit++) { unsigned cosetid = domain->getPG()->getComponentSet(compit->ID()); if (cosetid != 0) diff --git a/src/ensemble/tests/CanonicalEnsembleTest.cpp b/src/ensemble/tests/CanonicalEnsembleTest.cpp index 3f4a789ef4..16848904fe 100644 --- a/src/ensemble/tests/CanonicalEnsembleTest.cpp +++ b/src/ensemble/tests/CanonicalEnsembleTest.cpp @@ -13,8 +13,6 @@ #include -using namespace std; - TEST_SUITE_REGISTRATION(CanonicalEnsembleTest); CanonicalEnsembleTest::CanonicalEnsembleTest() { } diff --git a/src/integrators/Leapfrog.cpp b/src/integrators/Leapfrog.cpp index c39e5587bd..6e53e26bed 100644 --- a/src/integrators/Leapfrog.cpp +++ b/src/integrators/Leapfrog.cpp @@ -11,9 +11,6 @@ #include "utils/xmlfileUnits.h" -using namespace std; -using Log::global_log; - Leapfrog::Leapfrog(double timestepLength) : Integrator(timestepLength) { init(); } @@ -28,7 +25,7 @@ Leapfrog::~Leapfrog() {} void Leapfrog::readXML(XMLfileUnits& xmlconfig) { _timestepLength = 0; xmlconfig.getNodeValueReduced("timestep", _timestepLength); - global_log->info() << "Timestep: " << _timestepLength << endl; + Log::global_log->info() << "Timestep: " << _timestepLength << std::endl; mardyn_assert(_timestepLength > 0); } @@ -47,7 +44,7 @@ void Leapfrog::eventNewTimestep(ParticleContainer* molCont, Domain* domain) { void Leapfrog::transition1to2(ParticleContainer* molCont, Domain* /*domain*/) { if (this->_state != STATE_NEW_TIMESTEP) { - global_log->error() << "Leapfrog::transition1to2(...): Wrong state for state transition" << endl; + Log::global_log->error() << "Leapfrog::transition1to2(...): Wrong state for state transition" << std::endl; return; } @@ -65,7 +62,7 @@ void Leapfrog::transition1to2(ParticleContainer* molCont, Domain* /*domain*/) { void Leapfrog::transition2to3(ParticleContainer* molCont, Domain* domain) { if (this->_state != STATE_PRE_FORCE_CALCULATION) { - global_log->error() << "Leapfrog::transition2to3(...): Wrong state for state transition" << endl; + Log::global_log->error() << "Leapfrog::transition2to3(...): Wrong state for state transition" << std::endl; } /* TODO introduce @@ -77,20 +74,20 @@ void Leapfrog::transition2to3(ParticleContainer* molCont, Domain* domain) { * (here and in class Domain) is a nightmare. */ - map N; - map rotDOF; - map summv2; - map sumIw2; + std::map N; + std::map rotDOF; + std::map summv2; + std::map sumIw2; double dt_half = 0.5 * this->_timestepLength; if (domain->severalThermostats()) { #if defined(_OPENMP) #pragma omp parallel #endif { - map N_l; - map rotDOF_l; - map summv2_l; - map sumIw2_l; + std::map N_l; + std::map rotDOF_l; + std::map summv2_l; + std::map sumIw2_l; for (auto tM = molCont->iterator(ParticleIterator::ONLY_INNER_AND_BOUNDARY); tM.isValid(); ++tM) { int cid = tM->componentid(); @@ -154,6 +151,6 @@ void Leapfrog::transition3to1(ParticleContainer* /*molCont*/, Domain* /*domain*/ this->_state = STATE_NEW_TIMESTEP; } else { - global_log->error() << "Leapfrog::transition3to1(...): Wrong state for state transition" << endl; + Log::global_log->error() << "Leapfrog::transition3to1(...): Wrong state for state transition" << std::endl; } -} \ No newline at end of file +} diff --git a/src/integrators/LeapfrogRMM.cpp b/src/integrators/LeapfrogRMM.cpp index 98cc38cd85..60105284a9 100644 --- a/src/integrators/LeapfrogRMM.cpp +++ b/src/integrators/LeapfrogRMM.cpp @@ -13,8 +13,6 @@ #include "PositionCellProcessorRMM.h" #include "VelocityCellProcessorRMM.h" -using namespace std; -using Log::global_log; LeapfrogRMM::LeapfrogRMM() { _velocityCellProcessor = nullptr; @@ -34,7 +32,7 @@ LeapfrogRMM::LeapfrogRMM(double timestepLength) : void LeapfrogRMM::readXML(XMLfileUnits & xmlconfig) { _timestepLength = 0; xmlconfig.getNodeValueReduced("timestep", _timestepLength); - global_log->info() << "Timestep: " << _timestepLength << endl; + Log::global_log->info() << "Timestep: " << _timestepLength << std::endl; mardyn_assert(_timestepLength > 0); mardyn_assert(_velocityCellProcessor == nullptr); @@ -65,10 +63,10 @@ void LeapfrogRMM::computeVelocities(ParticleContainer* molCont, Domain* dom) { // leaving old functionality for debugging purposes // TODO: Thermostat functionality is duplicated X times and needs to be rewritten! - map N; - map rotDOF; - map summv2; - map sumIw2; + std::map N; + std::map rotDOF; + std::map summv2; + std::map sumIw2; { unsigned long red_N = 0; unsigned long red_rotDOF = 0; @@ -92,7 +90,7 @@ void LeapfrogRMM::computeVelocities(ParticleContainer* molCont, Domain* dom) { summv2[0] += red_summv2; sumIw2[0] += red_sumIw2; } - for (map::iterator thermit = summv2.begin(); thermit != summv2.end(); thermit++) { + for (std::map::iterator thermit = summv2.begin(); thermit != summv2.end(); thermit++) { dom->setLocalSummv2(thermit->second, thermit->first); dom->setLocalSumIw2(sumIw2[thermit->first], thermit->first); dom->setLocalNrotDOF(thermit->first, N[thermit->first], rotDOF[thermit->first]); diff --git a/src/integrators/LeapfrogRMM.h b/src/integrators/LeapfrogRMM.h index bacc62b7c9..cb29c4f25d 100644 --- a/src/integrators/LeapfrogRMM.h +++ b/src/integrators/LeapfrogRMM.h @@ -24,7 +24,7 @@ class LeapfrogRMM : public Integrator { } private: - + void computePositions(ParticleContainer* molCont, Domain* dom); void computeVelocities(ParticleContainer* molCont, Domain* dom); diff --git a/src/integrators/VelocityCellProcessorRMM.h b/src/integrators/VelocityCellProcessorRMM.h index 934d768bed..61d0e48c77 100644 --- a/src/integrators/VelocityCellProcessorRMM.h +++ b/src/integrators/VelocityCellProcessorRMM.h @@ -58,7 +58,7 @@ class VelocityCellProcessorRMM: public CellProcessor { _summv2 = 0.0; } // end pragma omp master - global_log->debug() << "VelocityCellProcessorRMM::initTraversal()." << std::endl; + Log::global_log->debug() << "VelocityCellProcessorRMM::initTraversal()." << std::endl; } void endTraversal() { diff --git a/src/io/ASCIIReader.cpp b/src/io/ASCIIReader.cpp index 7eaaf910c0..c0d1a6a76a 100644 --- a/src/io/ASCIIReader.cpp +++ b/src/io/ASCIIReader.cpp @@ -21,59 +21,57 @@ #include "particleContainer/ParticleContainer.h" #include "utils/Logger.h" -using Log::global_log; - ASCIIReader::ASCIIReader() {} -void ASCIIReader::setPhaseSpaceFile(string filename) { +void ASCIIReader::setPhaseSpaceFile(std::string filename) { _phaseSpaceFile = filename; } -void ASCIIReader::setPhaseSpaceHeaderFile(string filename) { +void ASCIIReader::setPhaseSpaceHeaderFile(std::string filename) { _phaseSpaceHeaderFile = filename; } void ASCIIReader::readXML(XMLfileUnits& xmlconfig) { - string pspfile; + std::string pspfile; if(xmlconfig.getNodeValue(".", pspfile)) { pspfile = string_utils::trim(pspfile); // only prefix xml dir if path is not absolute if (pspfile[0] != '/') { pspfile.insert(0, xmlconfig.getDir()); } - global_log->info() << "phasespacepoint description file:\t" << pspfile << std::endl; + Log::global_log->info() << "phasespacepoint description file:\t" << pspfile << std::endl; } setPhaseSpaceFile(pspfile); } void ASCIIReader::readPhaseSpaceHeader(Domain* domain, double timestep) { - string token; + std::string token; - global_log->info() << "Opening phase space header file " << _phaseSpaceHeaderFile << std::endl; + Log::global_log->info() << "Opening phase space header file " << _phaseSpaceHeaderFile << std::endl; _phaseSpaceHeaderFileStream.open(_phaseSpaceHeaderFile.c_str()); _phaseSpaceHeaderFileStream >> token; if(token != "mardyn") { - global_log->error() << _phaseSpaceHeaderFile << " not a valid mardyn input file." << std::endl; + Log::global_log->error() << _phaseSpaceHeaderFile << " not a valid mardyn input file." << std::endl; Simulation::exit(1); } - string inputversion; + std::string inputversion; _phaseSpaceHeaderFileStream >> token >> inputversion; // FIXME: remove tag trunk from file specification? if(token != "trunk") { - global_log->error() << "Wrong input file specifier (\'" << token << "\' instead of \'trunk\')." << std::endl; + Log::global_log->error() << "Wrong input file specifier (\'" << token << "\' instead of \'trunk\')." << std::endl; Simulation::exit(1); } if(std::stoi(inputversion) < 20080701) { - global_log->error() << "Input version too old (" << inputversion << ")" << std::endl; + Log::global_log->error() << "Input version too old (" << inputversion << ")" << std::endl; Simulation::exit(1); } - global_log->info() << "Reading phase space header from file " << _phaseSpaceHeaderFile << std::endl; + Log::global_log->info() << "Reading phase space header from file " << _phaseSpaceHeaderFile << std::endl; - vector& dcomponents = *(_simulation.getEnsemble()->getComponents()); + std::vector& dcomponents = *(_simulation.getEnsemble()->getComponents()); bool header = true; // When the last header element is reached, "header" is set to false while(header) { @@ -88,7 +86,7 @@ void ASCIIReader::readPhaseSpaceHeader(Domain* domain, double timestep) { token.clear(); _phaseSpaceHeaderFileStream >> token; - global_log->info() << "{{" << token << "}}" << std::endl; + Log::global_log->info() << "{{" << token << "}}" << std::endl; if((token == "currentTime") || (token == "t")) { // set current simulation time @@ -106,7 +104,7 @@ void ASCIIReader::readPhaseSpaceHeader(Domain* domain, double timestep) { double targetT; _phaseSpaceHeaderFileStream >> thermostat_id; _phaseSpaceHeaderFileStream >> targetT; - global_log->info() << "Thermostat number " << thermostat_id << " has T = " << targetT << ".\n"; + Log::global_log->info() << "Thermostat number " << thermostat_id << " has T = " << targetT << ".\n"; domain->setTargetTemperature(thermostat_id, targetT); } else if((token == "ComponentThermostat") || (token == "CT") || (token == "o")) { // specify a thermostat for a component @@ -115,7 +113,7 @@ void ASCIIReader::readPhaseSpaceHeader(Domain* domain, double timestep) { int component_id; int thermostat_id; _phaseSpaceHeaderFileStream >> component_id >> thermostat_id; - global_log->info() << "Component " << component_id << " (internally: " << component_id - 1 + Log::global_log->info() << "Component " << component_id << " (internally: " << component_id - 1 << ") is regulated by thermostat number " << thermostat_id << ".\n"; component_id--; // FIXME thermostat IDs start with 0 in the program but not in the config file?! if(thermostat_id < 0) // thermostat IDs start with 0 @@ -148,10 +146,10 @@ void ASCIIReader::readPhaseSpaceHeader(Domain* domain, double timestep) { // components: unsigned int numcomponents = 0; _phaseSpaceHeaderFileStream >> numcomponents; - global_log->info() << "Reading " << numcomponents << " components" << std::endl; + Log::global_log->info() << "Reading " << numcomponents << " components" << std::endl; dcomponents.resize(numcomponents); for(unsigned int i = 0; i < numcomponents; i++) { - global_log->info() << "comp. i = " << i << ": " << std::endl; + Log::global_log->info() << "comp. i = " << i << ": " << std::endl; dcomponents[i].setID(i); unsigned int numljcenters = 0; unsigned int numcharges = 0; @@ -161,7 +159,7 @@ void ASCIIReader::readPhaseSpaceHeader(Domain* domain, double timestep) { _phaseSpaceHeaderFileStream >> numljcenters >> numcharges >> numdipoles >> numquadrupoles >> numtersoff; if(numtersoff != 0) { - global_log->error() << "tersoff no longer supported." + Log::global_log->error() << "tersoff no longer supported." << std::endl; Simulation::exit(-1); } @@ -170,27 +168,27 @@ void ASCIIReader::readPhaseSpaceHeader(Domain* domain, double timestep) { double eps, sigma, tcutoff, do_shift; _phaseSpaceHeaderFileStream >> x >> y >> z >> m >> eps >> sigma >> tcutoff >> do_shift; dcomponents[i].addLJcenter(x, y, z, m, eps, sigma, tcutoff, (do_shift != 0)); - global_log->info() << "LJ at [" << x << " " << y << " " << z << "], mass: " << m << ", epsilon: " + Log::global_log->info() << "LJ at [" << x << " " << y << " " << z << "], mass: " << m << ", epsilon: " << eps << ", sigma: " << sigma << std::endl; } for(unsigned int j = 0; j < numcharges; j++) { double q; _phaseSpaceHeaderFileStream >> x >> y >> z >> m >> q; dcomponents[i].addCharge(x, y, z, m, q); - global_log->info() << "charge at [" << x << " " << y << " " << z << "], mass: " << m << ", q: " << q + Log::global_log->info() << "charge at [" << x << " " << y << " " << z << "], mass: " << m << ", q: " << q << std::endl; } for(unsigned int j = 0; j < numdipoles; j++) { double eMyx, eMyy, eMyz, absMy; _phaseSpaceHeaderFileStream >> x >> y >> z >> eMyx >> eMyy >> eMyz >> absMy; dcomponents[i].addDipole(x, y, z, eMyx, eMyy, eMyz, absMy); - global_log->info() << "dipole at [" << x << " " << y << " " << z << "] " << std::endl; + Log::global_log->info() << "dipole at [" << x << " " << y << " " << z << "] " << std::endl; } for(unsigned int j = 0; j < numquadrupoles; j++) { double eQx, eQy, eQz, absQ; _phaseSpaceHeaderFileStream >> x >> y >> z >> eQx >> eQy >> eQz >> absQ; dcomponents[i].addQuadrupole(x, y, z, eQx, eQy, eQz, absQ); - global_log->info() << "quad at [" << x << " " << y << " " << z << "] " << std::endl; + Log::global_log->info() << "quad at [" << x << " " << y << " " << z << "] " << std::endl; } double IDummy1, IDummy2, IDummy3; // FIXME! Was soll das hier? Was ist mit der Initialisierung im Fall I <= 0. @@ -199,18 +197,18 @@ void ASCIIReader::readPhaseSpaceHeader(Domain* domain, double timestep) { if(IDummy2 > 0.) dcomponents[i].setI22(IDummy2); if(IDummy3 > 0.) dcomponents[i].setI33(IDummy3); domain->setProfiledComponentMass(dcomponents[i].m()); - global_log->info() << std::endl; + Log::global_log->info() << std::endl; } #ifndef NDEBUG for(unsigned int i = 0; i < numcomponents; i++) { - global_log->debug() << "Component " << (i + 1) << " of " << numcomponents << std::endl; - global_log->debug() << dcomponents[i] << std::endl; + Log::global_log->debug() << "Component " << (i + 1) << " of " << numcomponents << std::endl; + Log::global_log->debug() << dcomponents[i] << std::endl; } #endif // Mixing coefficients - vector& dmixcoeff = domain->getmixcoeff(); + std::vector& dmixcoeff = domain->getmixcoeff(); dmixcoeff.clear(); for(unsigned int i = 1; i < numcomponents; i++) { for(unsigned int j = i + 1; j <= numcomponents; j++) { @@ -230,19 +228,19 @@ void ASCIIReader::readPhaseSpaceHeader(Domain* domain, double timestep) { // find out the actual position, because the phase space definition will follow // FIXME: is there a more elegant way? fpos = _phaseSpaceHeaderFileStream.tellg(); - _phaseSpaceFileStream.seekg(fpos, ios::beg); + _phaseSpaceFileStream.seekg(fpos, std::ios::beg); } // FIXME: Is there a better solution than skipping the rest of the file? header = false; } else if((token == "NumberOfMolecules") || (token == "N")) { - // set number of Molecules + // set number of Molecules // FIXME: Is this part called in any case as the token is handled in the readPhaseSpace method? _phaseSpaceHeaderFileStream >> token; domain->setglobalNumMolecules( strtoul(token.c_str(),NULL,0) ); } // LOCATION OF OLD PRESSURE GRADIENT TOKENS else { - global_log->error() << "Invalid token \'" << token << "\' found. Skipping rest of the header." << std::endl; + Log::global_log->error() << "Invalid token \'" << token << "\' found. Skipping rest of the header." << std::endl; header = false; } } @@ -261,23 +259,23 @@ ASCIIReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domain if (domainDecomp->getRank() == 0) { // Rank 0 only #endif - global_log->info() << "Opening phase space file " << _phaseSpaceFile << std::endl; + Log::global_log->info() << "Opening phase space file " << _phaseSpaceFile << std::endl; _phaseSpaceFileStream.open(_phaseSpaceFile.c_str()); if(!_phaseSpaceFileStream.is_open()) { - global_log->error() << "Could not open phaseSpaceFile " << _phaseSpaceFile << std::endl; + Log::global_log->error() << "Could not open phaseSpaceFile " << _phaseSpaceFile << std::endl; Simulation::exit(1); } - global_log->info() << "Reading phase space file " << _phaseSpaceFile << std::endl; + Log::global_log->info() << "Reading phase space file " << _phaseSpaceFile << std::endl; #ifdef ENABLE_MPI } // Rank 0 only #endif - string token; - vector& dcomponents = *(_simulation.getEnsemble()->getComponents()); + std::string token; + std::vector& dcomponents = *(_simulation.getEnsemble()->getComponents()); unsigned int numcomponents = dcomponents.size(); unsigned long nummolecules = 0; unsigned long maxid = 0; // stores the highest molecule ID found in the phase space file - string ntypestring("ICRVQD"); + std::string ntypestring("ICRVQD"); enum class Ndatatype { ICRVQDV, ICRVQD, IRV, ICRV } ntype = Ndatatype::ICRVQD; @@ -290,7 +288,7 @@ ASCIIReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domain _phaseSpaceFileStream >> token; } if((token != "NumberOfMolecules") && (token != "N")) { - global_log->error() << "Expected the token 'NumberOfMolecules (N)' instead of '" << token << "'" << std::endl; + Log::global_log->error() << "Expected the token 'NumberOfMolecules (N)' instead of '" << token << "'" << std::endl; Simulation::exit(1); } _phaseSpaceFileStream >> nummolecules; @@ -299,14 +297,14 @@ ASCIIReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domain // TODO: Better do the following in setGlobalNumMolecules?! MPI_Bcast(&nummolecules, 1, MPI_UNSIGNED_LONG, 0, MPI_COMM_WORLD); #endif - global_log->info() << " number of molecules: " << nummolecules << std::endl; + Log::global_log->info() << " number of molecules: " << nummolecules << std::endl; #ifdef ENABLE_MPI if (domainDecomp->getRank() == 0) { // Rank 0 only #endif - streampos spos = _phaseSpaceFileStream.tellg(); + std::streampos spos = _phaseSpaceFileStream.tellg(); _phaseSpaceFileStream >> token; if((token == "MoleculeFormat") || (token == "M")) { _phaseSpaceFileStream >> ntypestring; @@ -317,15 +315,15 @@ ASCIIReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domain else if(ntypestring == "ICRV") ntype = Ndatatype::ICRV; else if(ntypestring == "IRV") ntype = Ndatatype::IRV; else { - global_log->error() << "Unknown molecule format '" << ntypestring << "'" << std::endl; + Log::global_log->error() << "Unknown molecule format '" << ntypestring << "'" << std::endl; Simulation::exit(1); } } else { _phaseSpaceFileStream.seekg(spos); } - global_log->info() << " molecule format: " << ntypestring << std::endl; + Log::global_log->info() << " molecule format: " << ntypestring << std::endl; if(numcomponents < 1) { - global_log->warning() << "No components defined! Setting up single one-centered LJ" << std::endl; + Log::global_log->warning() << "No components defined! Setting up single one-centered LJ" << std::endl; numcomponents = 1; dcomponents.resize(numcomponents); dcomponents[0].setID(0); @@ -345,7 +343,7 @@ ASCIIReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domain int size; MPI_CHECK(MPI_Type_size(mpi_Particle, &size)); - global_log->debug() << "size of custom datatype is " << size << std::endl; + Log::global_log->debug() << "size of custom datatype is " << size << std::endl; #endif @@ -378,17 +376,17 @@ ASCIIReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domain componentid = 1; break; default: - global_log->error() << "[ASCIIReader.cpp] Unknown ntype" << std::endl; + Log::global_log->error() << "[ASCIIReader.cpp] Unknown ntype" << std::endl; Simulation::exit(1); } if((x < 0.0 || x >= domain->getGlobalLength(0)) || (y < 0.0 || y >= domain->getGlobalLength(1)) || (z < 0.0 || z >= domain->getGlobalLength(2))) { - global_log->warning() << "Molecule " << id << " out of box: " << x << ";" << y << ";" << z << std::endl; + Log::global_log->warning() << "Molecule " << id << " out of box: " << x << ";" << y << ";" << z << std::endl; } if(componentid > numcomponents) { - global_log->error() << "Molecule id " << id + Log::global_log->error() << "Molecule id " << id << " has a component ID greater than the existing number of components: " << componentid << ">" @@ -409,7 +407,7 @@ ASCIIReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domain particle_buff_pos++; if ((particle_buff_pos >= PARTICLE_BUFFER_SIZE) || (i == nummolecules - 1)) { //MPI_Bcast(&particle_buff_pos, 1, MPI_INT, 0, MPI_COMM_WORLD); - global_log->debug() << "broadcasting(sending/receiving) particles with buffer_position " << particle_buff_pos << std::endl; + Log::global_log->debug() << "broadcasting(sending/receiving) particles with buffer_position " << particle_buff_pos << std::endl; MPI_Bcast(particle_buff, PARTICLE_BUFFER_SIZE, mpi_Particle, 0, MPI_COMM_WORLD); // TODO: MPI_COMM_WORLD for (int j = 0; j < particle_buff_pos; j++) { Molecule m; @@ -428,7 +426,7 @@ ASCIIReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domain // Only called inside GrandCanonical global_simulation->getEnsemble()->storeSample(&m, componentid); } - global_log->debug() << "broadcasting(sending/receiving) complete" << particle_buff_pos << std::endl; + Log::global_log->debug() << "broadcasting(sending/receiving) complete" << particle_buff_pos << std::endl; particle_buff_pos = 0; } #else @@ -448,7 +446,7 @@ ASCIIReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domain #endif } - global_log->info() << "Reading Molecules done" << std::endl; + Log::global_log->info() << "Reading Molecules done" << std::endl; #ifdef ENABLE_MPI diff --git a/src/io/Adios2Reader.cpp b/src/io/Adios2Reader.cpp index f71ba79958..643fc4ba19 100644 --- a/src/io/Adios2Reader.cpp +++ b/src/io/Adios2Reader.cpp @@ -18,8 +18,6 @@ #endif #include "utils/xmlfile.h" -using Log::global_log; - void Adios2Reader::init(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, Domain* domain) { }; @@ -27,16 +25,16 @@ void Adios2Reader::init(ParticleContainer* particleContainer, void Adios2Reader::readXML(XMLfileUnits& xmlconfig) { _mode = "rootOnly"; xmlconfig.getNodeValue("mode", _mode); - global_log->info() << "[Adios2Reader] Input mode: " << _mode << endl; + Log::global_log->info() << "[Adios2Reader] Input mode: " << _mode << std::endl; _inputfile = "mardyn.bp"; xmlconfig.getNodeValue("filename", _inputfile); - global_log->info() << "[Adios2Reader] Inputfile: " << _inputfile << endl; + Log::global_log->info() << "[Adios2Reader] Inputfile: " << _inputfile << std::endl; _adios2enginetype = "BP4"; xmlconfig.getNodeValue("adios2enginetype", _adios2enginetype); - global_log->info() << "[Adios2Reader] Adios2 engine type: " << _adios2enginetype << endl; + Log::global_log->info() << "[Adios2Reader] Adios2 engine type: " << _adios2enginetype << std::endl; _step = -1; xmlconfig.getNodeValue("adios2Step", _step); - global_log->info() << "[Adios2Reader] step to load from input file: " << _step << endl; + Log::global_log->info() << "[Adios2Reader] step to load from input file: " << _step << std::endl; if (!mainInstance) initAdios2(); }; @@ -44,13 +42,13 @@ void Adios2Reader::readXML(XMLfileUnits& xmlconfig) { void Adios2Reader::testInit(std::string infile, int step, std::string adios2enginetype, std::string mode) { using std::endl; _inputfile = infile; - global_log->info() << "[Adios2Reader] Inputfile: " << _inputfile << endl; + Log::global_log->info() << "[Adios2Reader] Inputfile: " << _inputfile << std::endl; _adios2enginetype = adios2enginetype; - global_log->info() << "[Adios2Reader] Adios2 engine type: " << _adios2enginetype << endl; + Log::global_log->info() << "[Adios2Reader] Adios2 engine type: " << _adios2enginetype << std::endl; _step = step; - global_log->info() << "[Adios2Reader] step to load from input file: " << _step << endl; + Log::global_log->info() << "[Adios2Reader] step to load from input file: " << _step << std::endl; _mode = mode; - global_log->info() << "[Adios2Reader] Input mode: " << _mode << endl; + Log::global_log->info() << "[Adios2Reader] Input mode: " << _mode << std::endl; if (!mainInstance) initAdios2(); } @@ -65,19 +63,19 @@ unsigned long Adios2Reader::readPhaseSpace(ParticleContainer* particleContainer, auto variables = io->AvailableVariables(); auto total_steps = std::stoi(variables["simulationtime"]["AvailableStepsCount"]); - global_log->info() << "[Adios2Reader] Total Steps in adios file " << total_steps << std::endl; + Log::global_log->info() << "[Adios2Reader] Total Steps in adios file " << total_steps << std::endl; if (_step == -1) { _step = total_steps - 1; } if (_step > total_steps) { - global_log->error() << "[Adios2Reader] Specified step is out of scope" << std::endl; + Log::global_log->error() << "[Adios2Reader] Specified step is out of scope" << std::endl; } if (_step < 0) { _step = total_steps + (_step + 1); } particle_count = std::stoi(variables["rx"]["Shape"]); - global_log->info() << "[Adios2Reader] Particle count: " << particle_count << std::endl; + Log::global_log->info() << "[Adios2Reader] Particle count: " << particle_count << std::endl; Timer inputTimer; inputTimer.start(); @@ -90,25 +88,25 @@ unsigned long Adios2Reader::readPhaseSpace(ParticleContainer* particleContainer, } else if (_mode == "parallelRead") { parallelRead(particleContainer, domain, domainDecomp); } else { - global_log->error() << "[Adios2Reader] Unknown _mode '" << _mode << "'" << std::endl; + Log::global_log->error() << "[Adios2Reader] Unknown _mode '" << _mode << "'" << std::endl; } _simulation.setSimulationTime(_simtime); - global_log->info() << "[Adios2Reader] simulation time is: " << _simtime << std::endl; + Log::global_log->info() << "[Adios2Reader] simulation time is: " << _simtime << std::endl; - global_log->info() << "[Adios2Reader] Finished reading molecules: 100%" << std::endl; - global_log->info() << "[Adios2Reader] Reading Molecules done" << std::endl; + Log::global_log->info() << "[Adios2Reader] Finished reading molecules: 100%" << std::endl; + Log::global_log->info() << "[Adios2Reader] Reading Molecules done" << std::endl; inputTimer.stop(); - global_log->info() << "[Adios2Reader] Initial IO took: " << inputTimer.get_etime() << " sec" << std::endl; + Log::global_log->info() << "[Adios2Reader] Initial IO took: " << inputTimer.get_etime() << " sec" << std::endl; if (domain->getglobalRho() == 0.) { domain->setglobalRho(domain->getglobalNumMolecules(true, particleContainer, domainDecomp) / domain->getGlobalVolume()); - global_log->info() << "[Adios2Reader] Calculated Rho_global = " << domain->getglobalRho() << endl; + Log::global_log->info() << "[Adios2Reader] Calculated Rho_global = " << domain->getglobalRho() << std::endl; } engine->Close(); - global_log->info() << "[Adios2Reader] finish." << std::endl; + Log::global_log->info() << "[Adios2Reader] finish." << std::endl; return particle_count; }; @@ -127,14 +125,14 @@ void Adios2Reader::rootOnlyRead(ParticleContainer* particleContainer, Domain* do auto num_reads = particle_count / bufferSize; if (particle_count % bufferSize != 0) num_reads += 1; - global_log->info() << "[Adios2Reader] Input is divided into " << num_reads << " sequential reads." << endl; + Log::global_log->info() << "[Adios2Reader] Input is divided into " << num_reads << " sequential reads." << std::endl; auto variables = io->AvailableVariables(); for (const auto &var : variables) { if (var.first == "rx") { if (var.second.at("Type") != "double") { - global_log->info() << "[Adios2Reader] Detected single precision" << endl; + Log::global_log->info() << "[Adios2Reader] Detected single precision" << std::endl; _single_precision = true; rx = std::vector(); ry = std::vector(); @@ -150,7 +148,7 @@ void Adios2Reader::rootOnlyRead(ParticleContainer* particleContainer, Domain* do Ly = std::vector(); Lz = std::vector(); } else { - global_log->info() << "[Adios2Reader] Detected double precision" << endl; + Log::global_log->info() << "[Adios2Reader] Detected double precision" << std::endl; rx = std::vector(); ry = std::vector(); rz = std::vector(); @@ -169,7 +167,7 @@ void Adios2Reader::rootOnlyRead(ParticleContainer* particleContainer, Domain* do } for (int read = 0; read < num_reads; read++) { - global_log->info() << "[Adios2Reader] Performing read " << read << endl; + Log::global_log->info() << "[Adios2Reader] Performing read " << read << std::endl; const uint64_t offset = read * bufferSize; if (read == num_reads - 1) bufferSize = particle_count % bufferSize; if (domainDecomp->getRank() == 0) { @@ -193,7 +191,7 @@ void Adios2Reader::rootOnlyRead(ParticleContainer* particleContainer, Domain* do } engine->PerformGets(); - global_log->info() << "[Adios2Reader] Read " << read << " done." << endl; + Log::global_log->info() << "[Adios2Reader] Read " << read << " done." << std::endl; if (_simulation.getEnsemble()->getComponents()->empty()) { auto attributes = io->AvailableAttributes(); @@ -226,7 +224,7 @@ void Adios2Reader::rootOnlyRead(ParticleContainer* particleContainer, Domain* do } else { _dcomponents = *(_simulation.getEnsemble()->getComponents()); } - global_log->info() << "[Adios2Reader] Gathered components." << std::endl; + Log::global_log->info() << "[Adios2Reader] Gathered components." << std::endl; #ifdef ENABLE_MPI std::vector particle_buff(bufferSize); @@ -273,7 +271,7 @@ void Adios2Reader::rootOnlyRead(ParticleContainer* particleContainer, Domain* do } #else for (int i = 0; i < bufferSize; i++) { - global_log->debug() << "[Adios2Reader] Processing particle " << offset + i << std::endl; + Log::global_log->debug() << "[Adios2Reader] Processing particle " << offset + i << std::endl; Molecule m; if (_single_precision) { m = fillMolecule(i, mol_id, comp_id, std::get>(rx), std::get>(ry), @@ -307,7 +305,7 @@ void Adios2Reader::rootOnlyRead(ParticleContainer* particleContainer, Domain* do // Print status message unsigned long iph = num_reads / 100; if (iph != 0 && (read % iph) == 0) - global_log->info() << "[Adios2Read] Finished reading molecules: " << read / iph << "%\r" << std::flush; + Log::global_log->info() << "[Adios2Read] Finished reading molecules: " << read / iph << "%\r" << std::flush; } } @@ -322,7 +320,7 @@ void Adios2Reader::parallelRead(ParticleContainer* particleContainer, Domain* do for (const auto &var : variables) { if (var.first == "rx") { if (var.second.at("Type") != "double") { - global_log->info() << "[Adios2Reader] Detected single precision" << endl; + Log::global_log->info() << "[Adios2Reader] Detected single precision" << std::endl; _single_precision = true; rx = std::vector(); ry = std::vector(); @@ -338,7 +336,7 @@ void Adios2Reader::parallelRead(ParticleContainer* particleContainer, Domain* do Ly = std::vector(); Lz = std::vector(); } else { - global_log->info() << "[Adios2Reader] Detected double precision" << endl; + Log::global_log->info() << "[Adios2Reader] Detected double precision" << std::endl; rx = std::vector(); ry = std::vector(); rz = std::vector(); @@ -378,7 +376,7 @@ void Adios2Reader::parallelRead(ParticleContainer* particleContainer, Domain* do } engine->PerformGets(); - global_log->debug() << "[Adios2Reader] Processed gets." << endl; + Log::global_log->debug() << "[Adios2Reader] Processed gets." << std::endl; std::vector global_component_ids{}; #ifdef ENABLE_MPI @@ -404,7 +402,7 @@ void Adios2Reader::parallelRead(ParticleContainer* particleContainer, Domain* do #endif if (_simulation.getEnsemble()->getComponents()->empty()) { - global_log->debug() << "[Adios2Reader] getComponents is empty. Reading components from Adios file ..." << std::endl; + Log::global_log->debug() << "[Adios2Reader] getComponents is empty. Reading components from Adios file ..." << std::endl; auto attributes = io->AvailableAttributes(); auto comp_id_copy = global_component_ids.empty() ? comp_id : global_component_ids; std::sort(comp_id_copy.begin(), comp_id_copy.end()); @@ -435,7 +433,7 @@ void Adios2Reader::parallelRead(ParticleContainer* particleContainer, Domain* do } else { _dcomponents = *(_simulation.getEnsemble()->getComponents()); } - global_log->debug() << "[Adios2Reader] Gathered components." << std::endl; + Log::global_log->debug() << "[Adios2Reader] Gathered components." << std::endl; #ifdef ENABLE_MPI @@ -460,7 +458,7 @@ void Adios2Reader::parallelRead(ParticleContainer* particleContainer, Domain* do ParticleData::MoleculeToParticleData(particle_buff[i + offset], m1); } - global_log->debug() << "[Adios2Reader] performing allgather" << std::endl; + Log::global_log->debug() << "[Adios2Reader] performing allgather" << std::endl; MPI_Allgatherv(&particle_buff[offset], bufferSize, mpi_Particle, particle_buff.data(), counts_array.data(), displacements_array.data(), mpi_Particle, @@ -529,30 +527,30 @@ void Adios2Reader::initAdios2() { io->SetEngine(_adios2enginetype); if (!engine) { - global_log->info() << "[Adios2Reader] Opening File for reading: " << _inputfile.c_str() << std::endl; + Log::global_log->info() << "[Adios2Reader] Opening File for reading: " << _inputfile.c_str() << std::endl; engine = std::make_shared(io->Open(_inputfile, adios2::Mode::Read)); } } catch (std::invalid_argument& e) { - global_log->fatal() + Log::global_log->fatal() << "[Adios2Reader] Invalid argument exception, STOPPING PROGRAM from rank" << domainDecomp.getRank() << ": " << e.what() << std::endl; mardyn_exit(1); } catch (std::ios_base::failure& e) { - global_log->fatal() + Log::global_log->fatal() << "[Adios2Reader] IO System base failure exception, STOPPING PROGRAM from rank " << domainDecomp.getRank() << ": " << e.what() << std::endl; mardyn_exit(1); } catch (std::exception& e) { - global_log->fatal() + Log::global_log->fatal() << "[Adios2Reader] Exception, STOPPING PROGRAM from rank" << domainDecomp.getRank() << ": " << e.what() << std::endl; mardyn_exit(1); } - global_log->info() << "[Adios2Reader] Init complete." << std::endl; + Log::global_log->info() << "[Adios2Reader] Init complete." << std::endl; }; #endif // ENABLE_ADIOS2 diff --git a/src/io/Adios2Reader.h b/src/io/Adios2Reader.h index 807db7ec63..e8528690fd 100644 --- a/src/io/Adios2Reader.h +++ b/src/io/Adios2Reader.h @@ -157,7 +157,7 @@ class Adios2Reader : public InputBase { if (var.second["Type"] == "double" || var.second["Type"] == "float") { doTheRead(var.first, rx, buffer, offset); } else { - global_log->error() << "[Adios2Reader] Positions should be doubles or floats (for now)." + Log::global_log->error() << "[Adios2Reader] Positions should be doubles or floats (for now)." << std::endl; } } @@ -165,7 +165,7 @@ class Adios2Reader : public InputBase { if (var.second["Type"] == "double" || var.second["Type"] == "float") { doTheRead(var.first, ry, buffer, offset); } else { - global_log->error() << "[Adios2Reader] Positions should be doubles or floats (for now)." + Log::global_log->error() << "[Adios2Reader] Positions should be doubles or floats (for now)." << std::endl; } } @@ -173,7 +173,7 @@ class Adios2Reader : public InputBase { if (var.second["Type"] == "double" || var.second["Type"] == "float") { doTheRead(var.first, rz, buffer, offset); } else { - global_log->error() << "[Adios2Reader] Positions should be doubles or floats (for now)." + Log::global_log->error() << "[Adios2Reader] Positions should be doubles or floats (for now)." << std::endl; } } @@ -181,7 +181,7 @@ class Adios2Reader : public InputBase { if (var.second["Type"] == "double" || var.second["Type"] == "float") { doTheRead(var.first, vx, buffer, offset); } else { - global_log->error() << "[Adios2Reader] Velocities should be doubles or floats (for now)." + Log::global_log->error() << "[Adios2Reader] Velocities should be doubles or floats (for now)." << std::endl; } } @@ -189,7 +189,7 @@ class Adios2Reader : public InputBase { if (var.second["Type"] == "double" || var.second["Type"] == "float") { doTheRead(var.first, vy, buffer, offset); } else { - global_log->error() << "[Adios2Reader] Velocities should be doubles or floats (for now)." + Log::global_log->error() << "[Adios2Reader] Velocities should be doubles or floats (for now)." << std::endl; } } @@ -197,7 +197,7 @@ class Adios2Reader : public InputBase { if (var.second["Type"] == "double" || var.second["Type"] == "float") { doTheRead(var.first, vz, buffer, offset); } else { - global_log->error() << "[Adios2Reader] Velocities should be doubles or floats (for now)." + Log::global_log->error() << "[Adios2Reader] Velocities should be doubles or floats (for now)." << std::endl; } } @@ -205,7 +205,7 @@ class Adios2Reader : public InputBase { if (var.second["Type"] == "double" || var.second["Type"] == "float") { doTheRead(var.first, qw, buffer, offset); } else { - global_log->error() << "[Adios2Reader] Quaternions should be doubles or floats (for now)." + Log::global_log->error() << "[Adios2Reader] Quaternions should be doubles or floats (for now)." << std::endl; } } @@ -213,7 +213,7 @@ class Adios2Reader : public InputBase { if (var.second["Type"] == "double" || var.second["Type"] == "float") { doTheRead(var.first, qx, buffer, offset); } else { - global_log->error() << "[Adios2Reader] Quaternions should be doubles or floats (for now)." + Log::global_log->error() << "[Adios2Reader] Quaternions should be doubles or floats (for now)." << std::endl; } } @@ -221,7 +221,7 @@ class Adios2Reader : public InputBase { if (var.second["Type"] == "double" || var.second["Type"] == "float") { doTheRead(var.first, qy, buffer, offset); } else { - global_log->error() << "[Adios2Reader] Quaternions should be doubles or floats (for now)." + Log::global_log->error() << "[Adios2Reader] Quaternions should be doubles or floats (for now)." << std::endl; } } @@ -229,7 +229,7 @@ class Adios2Reader : public InputBase { if (var.second["Type"] == "double" || var.second["Type"] == "float") { doTheRead(var.first, qz, buffer, offset); } else { - global_log->error() << "[Adios2Reader] Quaternions should be doubles or floats (for now)." + Log::global_log->error() << "[Adios2Reader] Quaternions should be doubles or floats (for now)." << std::endl; } } @@ -237,7 +237,7 @@ class Adios2Reader : public InputBase { if (var.second["Type"] == "double" || var.second["Type"] == "float") { doTheRead(var.first, Lx, buffer, offset); } else { - global_log->error() << "[Adios2Reader] Angular momentum should be doubles or floats (for now)." + Log::global_log->error() << "[Adios2Reader] Angular momentum should be doubles or floats (for now)." << std::endl; } } @@ -245,7 +245,7 @@ class Adios2Reader : public InputBase { if (var.second["Type"] == "double" || var.second["Type"] == "float") { doTheRead(var.first, Ly, buffer, offset); } else { - global_log->error() << "[Adios2Reader] Angular momentum should be doubles or floats (for now)." + Log::global_log->error() << "[Adios2Reader] Angular momentum should be doubles or floats (for now)." << std::endl; } } @@ -253,7 +253,7 @@ class Adios2Reader : public InputBase { if (var.second["Type"] == "double" || var.second["Type"] == "float") { doTheRead(var.first, Lz, buffer, offset); } else { - global_log->error() << "[Adios2Reader] Angular momentum should be doubles or floats (for now)." + Log::global_log->error() << "[Adios2Reader] Angular momentum should be doubles or floats (for now)." << std::endl; } } @@ -261,21 +261,21 @@ class Adios2Reader : public InputBase { if (var.second["Type"] == "uint64_t") { doTheRead(var.first, comp_id, buffer, offset); } else { - global_log->error() << "[Adios2Reader] Component ids should be uint64_t (for now)." << std::endl; + Log::global_log->error() << "[Adios2Reader] Component ids should be uint64_t (for now)." << std::endl; } } if (var.first == "molecule_id") { if (var.second["Type"] == "uint64_t") { doTheRead(var.first, mol_id, buffer, offset); } else { - global_log->error() << "[Adios2Reader] Molecule ids should be uint64_t (for now)." << std::endl; + Log::global_log->error() << "[Adios2Reader] Molecule ids should be uint64_t (for now)." << std::endl; } } if (var.first == "simulationtime") { if (var.second["Type"] == "double" || var.second["Type"] == "float") { doTheRead(var.first, _simtime); } else { - global_log->error() << "[Adios2Reader] Simulation time should be double or float (for now)." + Log::global_log->error() << "[Adios2Reader] Simulation time should be double or float (for now)." << std::endl; } } diff --git a/src/io/Adios2Writer.cpp b/src/io/Adios2Writer.cpp index 3c429ce563..12cad27dca 100644 --- a/src/io/Adios2Writer.cpp +++ b/src/io/Adios2Writer.cpp @@ -16,8 +16,6 @@ #include "utils/mardyn_assert.h" #include "utils/xmlfile.h" -using Log::global_log; - constexpr char const* mol_id_name = "molecule_id"; constexpr char const* comp_id_name = "component_id"; constexpr char const* rx_name = "rx"; @@ -71,11 +69,11 @@ void Adios2Writer::clearContainers() { void Adios2Writer::defineVariables(const uint64_t global, const uint64_t offset, const uint64_t local, const int numProcs, const int rank) { for (auto& [variableName, variableContainer] : _vars) { - global_log->info() << "[Adios2Writer] Defining Variable " << variableName << std::endl; + Log::global_log->info() << "[Adios2Writer] Defining Variable " << variableName << std::endl; if (std::holds_alternative>(variableContainer)) { auto advar_prec = _io->DefineVariable(variableName, {global}, {offset}, {local}, adios2::ConstantDims); - + if (!_compressionOperator.Type().empty()) { if (_compression == "SZ" || _compression == "sz") { #ifdef ADIOS2_HAVE_SZ @@ -109,14 +107,14 @@ void Adios2Writer::defineVariables(const uint64_t global, const uint64_t offset, } } - global_log->info() << "[Adios2Writer] Defining Variable " << gbox_name << std::endl; + Log::global_log->info() << "[Adios2Writer] Defining Variable " << gbox_name << std::endl; _io->DefineVariable(gbox_name, {6}, {0}, {6}, adios2::ConstantDims); - global_log->info() << "[Adios2Writer] Defining Variable " << lbox_name << std::endl; + Log::global_log->info() << "[Adios2Writer] Defining Variable " << lbox_name << std::endl; _io->DefineVariable(lbox_name, {}, {}, {6}, adios2::ConstantDims); - global_log->info() << "[Adios2Writer] Defining Variable " << offsets_name << std::endl; + Log::global_log->info() << "[Adios2Writer] Defining Variable " << offsets_name << std::endl; _io->DefineVariable(offsets_name, {static_cast(numProcs)}, {static_cast(rank)}, {1}, adios2::ConstantDims); - global_log->info() << "[Adios2Writer] Defining Variable " << simtime_name << std::endl; + Log::global_log->info() << "[Adios2Writer] Defining Variable " << simtime_name << std::endl; _io->DefineVariable(simtime_name); } @@ -128,30 +126,30 @@ void Adios2Writer::readXML(XMLfileUnits& xmlconfig) { using std::endl; _outputfile = "mardyn.bp"; xmlconfig.getNodeValue("outputfile", _outputfile); - global_log->info() << "[Adios2Writer] Outputfile: " << _outputfile << endl; + Log::global_log->info() << "[Adios2Writer] Outputfile: " << _outputfile << std::endl; _adios2enginetype = "BP4"; xmlconfig.getNodeValue("adios2enginetype", _adios2enginetype); - global_log->info() << "[Adios2Writer] Adios2 engine type: " << _adios2enginetype << endl; + Log::global_log->info() << "[Adios2Writer] Adios2 engine type: " << _adios2enginetype << std::endl; _writefrequency = 50000; xmlconfig.getNodeValue("writefrequency", _writefrequency); - global_log->info() << "[Adios2Writer] write frequency: " << _writefrequency << endl; + Log::global_log->info() << "[Adios2Writer] write frequency: " << _writefrequency << std::endl; _append_mode = "OFF"; xmlconfig.getNodeValue("appendmode", _append_mode); - global_log->info() << "[Adios2Writer] Append mode: " << _append_mode << endl; + Log::global_log->info() << "[Adios2Writer] Append mode: " << _append_mode << std::endl; _compression = "none"; xmlconfig.getNodeValue("compression", _compression); - global_log->info() << "[Adios2Writer] compression type: " << _compression << endl; + Log::global_log->info() << "[Adios2Writer] compression type: " << _compression << std::endl; _compression_accuracy = "0.00001"; xmlconfig.getNodeValue("compressionaccuracy", _compression_accuracy); - global_log->info() << "[Adios2Writer] compression accuracy (SZ): " << _compression_accuracy << endl; + Log::global_log->info() << "[Adios2Writer] compression accuracy (SZ): " << _compression_accuracy << std::endl; _compression_rate = "8"; xmlconfig.getNodeValue("compressionrate", _compression_rate); - global_log->info() << "[Adios2Writer] compression rate (ZFP): " << _compression_rate << endl; + Log::global_log->info() << "[Adios2Writer] compression rate (ZFP): " << _compression_rate << std::endl; _num_files = -1; xmlconfig.getNodeValue("numfiles", _num_files); - global_log->info() << "[Adios2Writer] Number of files: " << _num_files << endl; - - + Log::global_log->info() << "[Adios2Writer] Number of files: " << _num_files << std::endl; + + xmlconfig.changecurrentnode("/"); xmlconfig.printXML(_xmlstream); @@ -163,19 +161,19 @@ void Adios2Writer::testInit(std::vector& comps, const std::string out const std::string compression_rate) { using std::endl; _outputfile = outfile; - global_log->info() << "[Adios2Writer] Outputfile: " << _outputfile << endl; + Log::global_log->info() << "[Adios2Writer] Outputfile: " << _outputfile << std::endl; _adios2enginetype = adios2enginetype; - global_log->info() << "[Adios2Writer] Adios2 engine type: " << _adios2enginetype << endl; + Log::global_log->info() << "[Adios2Writer] Adios2 engine type: " << _adios2enginetype << std::endl; _writefrequency = writefrequency; - global_log->info() << "[Adios2Writer] write frequency: " << _writefrequency << endl; + Log::global_log->info() << "[Adios2Writer] write frequency: " << _writefrequency << std::endl; _compression = compression; - global_log->info() << "[Adios2Writer] compression type: " << _compression << endl; + Log::global_log->info() << "[Adios2Writer] compression type: " << _compression << std::endl; _compression_accuracy = compression_accuracy; - global_log->info() << "[Adios2Writer] compression accuracy (SZ): " << _compression_accuracy << endl; + Log::global_log->info() << "[Adios2Writer] compression accuracy (SZ): " << _compression_accuracy << std::endl; _compression_rate = compression_rate; - global_log->info() << "[Adios2Writer] compression rate (ZFP): " << _compression_rate << endl; + Log::global_log->info() << "[Adios2Writer] compression rate (ZFP): " << _compression_rate << std::endl; _comps = comps; - + if (!_inst) initAdios2(); } @@ -196,7 +194,7 @@ void Adios2Writer::initAdios2() { _io->SetEngine(_adios2enginetype); if (!_engine) { - global_log->info() << "[Adios2Writer] Opening File for writing." << _outputfile.c_str() << std::endl; + Log::global_log->info() << "[Adios2Writer] Opening File for writing." << _outputfile.c_str() << std::endl; if (_append_mode == "ON" || _append_mode == "on" || _append_mode == "TRUE" || _append_mode == "true") { _engine = std::make_shared(_io->Open(_outputfile, adios2::Mode::Append)); } else { @@ -214,7 +212,7 @@ void Adios2Writer::initAdios2() { _compressionOperator = _inst->DefineOperator("ZFPCompressor", adios2::ops::LossyZFP); #endif } - + // Write information about this simulation using ADIOS2 attributes _io->DefineAttribute("config", _xmlstream.str()); auto& domainDecomp = _simulation.domainDecomposition(); @@ -238,7 +236,7 @@ void Adios2Writer::initAdios2() { for (auto& site : sites) { component_elements_vec.emplace_back(site.getName()); } - string component_elements = + std::string component_elements = std::accumulate(component_elements_vec.begin(), component_elements_vec.end(), std::string(), [](std::string& ss, std::string& s) { return ss.empty() ? s : ss + "," + s; }); @@ -266,32 +264,32 @@ void Adios2Writer::initAdios2() { } resetContainers(); } catch (std::invalid_argument& e) { - global_log->fatal() << "Invalid argument exception, STOPPING PROGRAM from rank: " << e.what() << std::endl; + Log::global_log->fatal() << "Invalid argument exception, STOPPING PROGRAM from rank: " << e.what() << std::endl; mardyn_exit(1); } catch (std::ios_base::failure& e) { - global_log->fatal() << "IO System base failure exception, STOPPING PROGRAM from rank: " << e.what() << std::endl; + Log::global_log->fatal() << "IO System base failure exception, STOPPING PROGRAM from rank: " << e.what() << std::endl; mardyn_exit(1); } catch (std::exception& e) { - global_log->fatal() << "Exception, STOPPING PROGRAM from rank: " << e.what() + Log::global_log->fatal() << "Exception, STOPPING PROGRAM from rank: " << e.what() << std::endl; mardyn_exit(1); } - global_log->info() << "[Adios2Writer] Init complete." << std::endl; + Log::global_log->info() << "[Adios2Writer] Init complete." << std::endl; } void Adios2Writer::beforeEventNewTimestep(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, unsigned long simstep) { - global_log->debug() << "[Adios2Writer] beforeEventNewTimestep." << std::endl; + Log::global_log->debug() << "[Adios2Writer] beforeEventNewTimestep." << std::endl; } void Adios2Writer::beforeForces(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, unsigned long simstep) { - global_log->debug() << "[Adios2Writer] beforeForces." << std::endl; + Log::global_log->debug() << "[Adios2Writer] beforeForces." << std::endl; } void Adios2Writer::afterForces(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, unsigned long simstep) { - global_log->debug() << "[Adios2Writer] afterForces." << std::endl; + Log::global_log->debug() << "[Adios2Writer] afterForces." << std::endl; } void Adios2Writer::endStep(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, Domain* domain, @@ -337,20 +335,20 @@ void Adios2Writer::endStep(ParticleContainer* particleContainer, DomainDecompBas std::get>(_vars[Ly_name]).emplace_back(m->D(1)); std::get>(_vars[Lz_name]).emplace_back(m->D(2)); } - + m_id.emplace_back(m->getID()); comp_id.emplace_back(m->componentid()); } // gather offsets - global_log->debug() << "[Adios2Writer] numProcs: " << numProcs << std::endl; - + Log::global_log->debug() << "[Adios2Writer] numProcs: " << numProcs << std::endl; + uint64_t offset = 0; #ifdef ENABLE_MPI MPI_Exscan(&localNumParticles, &offset, 1, MPI_UINT64_T, MPI_SUM, domainDecomp->getCommunicator()); - global_log->debug() << "[Adios2Writer] localNumParticles " << localNumParticles << std::endl; - global_log->debug() << "[Adios2Writer] Offset " << offset << std::endl; + Log::global_log->debug() << "[Adios2Writer] localNumParticles " << localNumParticles << std::endl; + Log::global_log->debug() << "[Adios2Writer] Offset " << offset << std::endl; #endif std::array tmp_global_box = {0, 0, 0, domain->getGlobalLength(0), domain->getGlobalLength(1), domain->getGlobalLength(2)}; @@ -362,7 +360,7 @@ void Adios2Writer::endStep(ParticleContainer* particleContainer, DomainDecompBas std::array local_box; std::copy(tmp_local_box.begin(), tmp_local_box.end(), local_box.begin()); - global_log->debug() << "[Adios2Writer] Local Box: " << local_box[0] << " " << local_box[1] << " " << local_box[2] + Log::global_log->debug() << "[Adios2Writer] Local Box: " << local_box[0] << " " << local_box[1] << " " << local_box[2] << " " << local_box[3] << " " << local_box[4] << " " << local_box[5] << std::endl; try { _engine->BeginStep(); @@ -382,9 +380,9 @@ void Adios2Writer::endStep(ParticleContainer* particleContainer, DomainDecompBas if (domainDecomp->getRank() == 0) { const auto adios2_global_box = _io->InquireVariable(gbox_name); - global_log->debug() << "[Adios2Writer] Putting Variables" << std::endl; + Log::global_log->debug() << "[Adios2Writer] Putting Variables" << std::endl; if (!adios2_global_box) { - global_log->error() << "[Adios2Writer] Could not create variable: global_box" << std::endl; + Log::global_log->error() << "[Adios2Writer] Could not create variable: global_box" << std::endl; return; } _engine->Put(adios2_global_box, global_box.data()); @@ -394,7 +392,7 @@ void Adios2Writer::endStep(ParticleContainer* particleContainer, DomainDecompBas const auto adios2_local_box = _io->InquireVariable(lbox_name); if (!adios2_local_box) { - global_log->error() << "[Adios2Writer] Could not create variable: local_box" << std::endl; + Log::global_log->error() << "[Adios2Writer] Could not create variable: local_box" << std::endl; return; } _engine->Put(adios2_local_box, local_box.data()); @@ -408,7 +406,7 @@ void Adios2Writer::endStep(ParticleContainer* particleContainer, DomainDecompBas if (domainDecomp->getRank() == 0) { const auto adios2_simulationtime = _io->InquireVariable(simtime_name); if (!adios2_simulationtime) { - global_log->error() << "[Adios2Writer] Could not create variable: simulationtime" << std::endl; + Log::global_log->error() << "[Adios2Writer] Could not create variable: simulationtime" << std::endl; return; } _engine->Put(adios2_simulationtime, current_time); @@ -416,23 +414,23 @@ void Adios2Writer::endStep(ParticleContainer* particleContainer, DomainDecompBas // wait for completion of write _engine->EndStep(); - + clearContainers(); } catch (std::invalid_argument& e) { - global_log->error() << "[Adios2Writer] Invalid argument exception, STOPPING PROGRAM"; - global_log->error() << e.what(); + Log::global_log->error() << "[Adios2Writer] Invalid argument exception, STOPPING PROGRAM"; + Log::global_log->error() << e.what(); } catch (std::ios_base::failure& e) { - global_log->error() << "[Adios2Writer] IO System base failure exception, STOPPING PROGRAM"; - global_log->error() << e.what(); + Log::global_log->error() << "[Adios2Writer] IO System base failure exception, STOPPING PROGRAM"; + Log::global_log->error() << e.what(); } catch (std::exception& e) { - global_log->error() << "[Adios2Writer] Exception, STOPPING PROGRAM"; - global_log->error() << e.what(); + Log::global_log->error() << "[Adios2Writer] Exception, STOPPING PROGRAM"; + Log::global_log->error() << e.what(); } - global_log->info() << "[Adios2Writer] endStep." << std::endl; + Log::global_log->info() << "[Adios2Writer] endStep." << std::endl; } void Adios2Writer::finish(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, Domain* domain) { _engine->Close(); - global_log->info() << "[Adios2Writer] finish." << std::endl; + Log::global_log->info() << "[Adios2Writer] finish." << std::endl; } #endif diff --git a/src/io/BinaryReader.cpp b/src/io/BinaryReader.cpp index 73498bd05f..83875f6e95 100644 --- a/src/io/BinaryReader.cpp +++ b/src/io/BinaryReader.cpp @@ -31,8 +31,6 @@ #include #include -using Log::global_log; -using namespace std; enum MoleculeFormat : std::uint32_t { ICRVQD, IRV, ICRV @@ -46,30 +44,30 @@ BinaryReader::BinaryReader() BinaryReader::~BinaryReader() = default; void BinaryReader::readXML(XMLfileUnits& xmlconfig) { - string pspfile; - string pspheaderfile; + std::string pspfile; + std::string pspheaderfile; xmlconfig.getNodeValue("header", pspheaderfile); pspheaderfile = string_utils::trim(pspheaderfile); if (pspheaderfile[0] != '/') { pspheaderfile.insert(0, xmlconfig.getDir()); } - global_log->info() << "phase space header file: " << pspheaderfile << endl; + Log::global_log->info() << "phase space header file: " << pspheaderfile << std::endl; xmlconfig.getNodeValue("data", pspfile); pspfile = string_utils::trim(pspfile); // only prefix xml dir if path is not absolute if (pspfile[0] != '/') { pspfile.insert(0, xmlconfig.getDir()); } - global_log->info() << "phase space data file: " << pspfile << endl; + Log::global_log->info() << "phase space data file: " << pspfile << std::endl; setPhaseSpaceHeaderFile(pspheaderfile); setPhaseSpaceFile(pspfile); } -void BinaryReader::setPhaseSpaceFile(string filename) { +void BinaryReader::setPhaseSpaceFile(std::string filename) { _phaseSpaceFile = filename; } -void BinaryReader::setPhaseSpaceHeaderFile(string filename) { +void BinaryReader::setPhaseSpaceHeaderFile(std::string filename) { _phaseSpaceHeaderFile = filename; } @@ -77,8 +75,8 @@ void BinaryReader::readPhaseSpaceHeader(Domain* domain, double timestep) { XMLfileUnits inp(_phaseSpaceHeaderFile); if(not inp.changecurrentnode("/mardyn")) { - global_log->error() << "Could not find root node /mardyn in XML input file." << endl; - global_log->fatal() << "Not a valid MarDyn XML input file." << endl; + Log::global_log->error() << "Could not find root node /mardyn in XML input file." << std::endl; + Log::global_log->fatal() << "Not a valid MarDyn XML input file." << std::endl; Simulation::exit(1); } @@ -96,7 +94,7 @@ void BinaryReader::readPhaseSpaceHeader(Domain* domain, double timestep) { bInputOk = bInputOk && inp.getNodeValue("format@type", strMoleculeFormat); if(not bInputOk) { - global_log->error() << "Content of file: '" << _phaseSpaceHeaderFile << "' corrupted! Program exit ..." << endl; + Log::global_log->error() << "Content of file: '" << _phaseSpaceHeaderFile << "' corrupted! Program exit ..." << std::endl; Simulation::exit(1); } @@ -107,7 +105,7 @@ void BinaryReader::readPhaseSpaceHeader(Domain* domain, double timestep) { else if("ICRV" == strMoleculeFormat) _nMoleculeFormat = ICRV; else { - global_log->error() << "Not a valid molecule format: " << strMoleculeFormat << ", program exit ..." << endl; + Log::global_log->error() << "Not a valid molecule format: " << strMoleculeFormat << ", program exit ..." << std::endl; Simulation::exit(1); } @@ -128,23 +126,23 @@ BinaryReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domai #ifdef ENABLE_MPI if (domainDecomp->getRank() == 0) { // Rank 0 only #endif - global_log->info() << "Opening phase space file " << _phaseSpaceFile - << endl; + Log::global_log->info() << "Opening phase space file " << _phaseSpaceFile + << std::endl; _phaseSpaceFileStream.open(_phaseSpaceFile.c_str(), - ios::binary | ios::in); + std::ios::binary | std::ios::in); if(!_phaseSpaceFileStream.is_open()) { - global_log->error() << "Could not open phaseSpaceFile " - << _phaseSpaceFile << endl; + Log::global_log->error() << "Could not open phaseSpaceFile " + << _phaseSpaceFile << std::endl; Simulation::exit(1); } - global_log->info() << "Reading phase space file " << _phaseSpaceFile - << endl; + Log::global_log->info() << "Reading phase space file " << _phaseSpaceFile + << std::endl; #ifdef ENABLE_MPI } // Rank 0 only #endif - string token; - vector& dcomponents = *(_simulation.getEnsemble()->getComponents()); + std::string token; + std::vector& dcomponents = *(_simulation.getEnsemble()->getComponents()); size_t numcomponents = dcomponents.size(); unsigned long maxid = 0; // stores the highest molecule ID found in the phase space file @@ -157,7 +155,7 @@ BinaryReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domai int size; MPI_CHECK(MPI_Type_size(mpi_Particle, &size)); - global_log->debug() << "size of custom datatype is " << size << std::endl; + Log::global_log->debug() << "size of custom datatype is " << size << std::endl; #endif @@ -177,8 +175,8 @@ BinaryReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domai if (domainDecomp->getRank() == 0) { // Rank 0 only #endif if(_phaseSpaceFileStream.eof()) { - global_log->error() << "End of file was hit before all " << numMolecules << " expected molecules were read." - << endl; + Log::global_log->error() << "End of file was hit before all " << numMolecules << " expected molecules were read." + << std::endl; Simulation::exit(1); } _phaseSpaceFileStream.read(reinterpret_cast (&id), 8); @@ -220,26 +218,26 @@ BinaryReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domai _phaseSpaceFileStream.read(reinterpret_cast (&vz), 8); break; default: - global_log->error() << "BinaryReader: Unknown phase space format: " << _nMoleculeFormat << std::endl + Log::global_log->error() << "BinaryReader: Unknown phase space format: " << _nMoleculeFormat << std::endl << "Aborting simulation." << std::endl; Simulation::exit(12); } if ((x < 0.0 || x >= domain->getGlobalLength(0)) || (y < 0.0 || y >= domain->getGlobalLength(1)) || (z < 0.0 || z >= domain->getGlobalLength(2))) { - global_log->warning() << "Molecule " << id << " out of box: " << x << ";" << y << ";" << z << endl; + Log::global_log->warning() << "Molecule " << id << " out of box: " << x << ";" << y << ";" << z << std::endl; } if(componentid > numcomponents) { - global_log->error() << "Molecule id " << id + Log::global_log->error() << "Molecule id " << id << " has a component ID greater than the existing number of components: " << componentid << ">" - << numcomponents << endl; + << numcomponents << std::endl; Simulation::exit(1); } if(componentid == 0) { - global_log->error() << "Molecule id " << id - << " has componentID == 0." << endl; + Log::global_log->error() << "Molecule id " << id + << " has componentID == 0." << std::endl; Simulation::exit(1); } // ComponentIDs are used as array IDs, hence need to start at 0. @@ -304,19 +302,19 @@ BinaryReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domai // Print status message unsigned long iph = numMolecules / 100; if(iph != 0 && (i % iph) == 0) - global_log->info() << "Finished reading molecules: " << i / iph - << "%\r" << flush; + Log::global_log->info() << "Finished reading molecules: " << i / iph + << "%\r" << std::flush; } - global_log->info() << "Finished reading molecules: 100%" << endl; - global_log->info() << "Reading Molecules done" << endl; + Log::global_log->info() << "Finished reading molecules: 100%" << std::endl; + Log::global_log->info() << "Reading Molecules done" << std::endl; // TODO: Shouldn't we always calculate this? if (domain->getglobalRho() < 1e-5) { domain->setglobalRho( domain->getglobalNumMolecules(true, particleContainer, domainDecomp) / domain->getGlobalVolume()); - global_log->info() << "Calculated Rho_global = " - << domain->getglobalRho() << endl; + Log::global_log->info() << "Calculated Rho_global = " + << domain->getglobalRho() << std::endl; } #ifdef ENABLE_MPI @@ -328,8 +326,8 @@ BinaryReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domai #endif inputTimer.stop(); - global_log->info() << "Initial IO took: " - << inputTimer.get_etime() << " sec" << endl; + Log::global_log->info() << "Initial IO took: " + << inputTimer.get_etime() << " sec" << std::endl; #ifdef ENABLE_MPI MPI_CHECK(MPI_Type_free(&mpi_Particle)); #endif diff --git a/src/io/CavityWriter.cpp b/src/io/CavityWriter.cpp index d0c60ecab0..1ae3ff9118 100644 --- a/src/io/CavityWriter.cpp +++ b/src/io/CavityWriter.cpp @@ -12,55 +12,52 @@ #include "Simulation.h" #include "ensemble/CavityEnsemble.h" -using Log::global_log; -using namespace std; - void CavityWriter::readXML(XMLfileUnits &xmlconfig) { _writeFrequency = 1; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "[CavityWriter] Write frequency: " << _writeFrequency << endl; + Log::global_log->info() << "[CavityWriter] Write frequency: " << _writeFrequency << std::endl; _outputPrefix = "mardyn"; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "[CavityWriter] Output prefix: " << _outputPrefix << endl; + Log::global_log->info() << "[CavityWriter] Output prefix: " << _outputPrefix << std::endl; int incremental = 1; xmlconfig.getNodeValue("incremental", incremental); _incremental = (incremental != 0); - global_log->info() << "[CavityWriter] Incremental numbers: " << _incremental << endl; + Log::global_log->info() << "[CavityWriter] Incremental numbers: " << _incremental << std::endl; int appendTimestamp = 0; xmlconfig.getNodeValue("appendTimestamp", appendTimestamp); if (appendTimestamp > 0) { _appendTimestamp = true; } - global_log->info() << "[CavityWriter] Append timestamp: " << _appendTimestamp << endl; + Log::global_log->info() << "[CavityWriter] Append timestamp: " << _appendTimestamp << std::endl; xmlconfig.getNodeValue("maxNeighbours", _maxNeighbors); if (_maxNeighbors <= 0) { - global_log->error() << "[CavityWriter] Invalid number of maxNeighbors: " << _maxNeighbors << endl; + Log::global_log->error() << "[CavityWriter] Invalid number of maxNeighbors: " << _maxNeighbors << std::endl; Simulation::exit(999); } xmlconfig.getNodeValue("radius", _radius); if (_radius <= 0.0f) { - global_log->error() << "[CavityWriter] Invalid size of radius: " << _radius << endl; + Log::global_log->error() << "[CavityWriter] Invalid size of radius: " << _radius << std::endl; Simulation::exit(999); } xmlconfig.getNodeValue("Nx", _Nx); if (_Nx <= 0) { - global_log->error() << "[CavityWriter] Invalid number of cells Nx: " << _Nx << endl; + Log::global_log->error() << "[CavityWriter] Invalid number of cells Nx: " << _Nx << std::endl; Simulation::exit(999); } xmlconfig.getNodeValue("Ny", _Ny); if (_Ny <= 0) { - global_log->error() << "[CavityWriter] Invalid number of cells Ny: " << _Ny << endl; + Log::global_log->error() << "[CavityWriter] Invalid number of cells Ny: " << _Ny << std::endl; Simulation::exit(999); } xmlconfig.getNodeValue("Nz", _Nz); if (_Nz <= 0) { - global_log->error() << "[CavityWriter] Invalid number of cells Nz: " << _Nz << endl; + Log::global_log->error() << "[CavityWriter] Invalid number of cells Nz: " << _Nz << std::endl; Simulation::exit(999); } @@ -77,23 +74,23 @@ void CavityWriter::readXML(XMLfileUnits &xmlconfig) { xmlconfig.getNodeValue("ControlVolume/z1", _controlVolume[5]); for (int d = 0; d < 3; d++) { if (_controlVolume[d * 2] > _controlVolume[d * 2 + 1]) { - global_log->error() << "[CavityWriter] Lower Bound of Control Volume may not be larger than upper bound. " - << endl; + Log::global_log->error() << "[CavityWriter] Lower Bound of Control Volume may not be larger than upper bound. " + << std::endl; Simulation::exit(999); } if (_controlVolume[d * 2] < 0 || _controlVolume[d * 2 + 1] > global_simulation->getDomain()->getGlobalLength(d)) { - global_log->error() << "[CavityWriter] Control volume bounds may not be outside of domain boundaries. " - << endl; + Log::global_log->error() << "[CavityWriter] Control volume bounds may not be outside of domain boundaries. " + << std::endl; Simulation::exit(999); } } // Get components to check // get root - string oldpath = xmlconfig.getcurrentnodepath(); + std::string oldpath = xmlconfig.getcurrentnodepath(); - this->_mcav = map(); + this->_mcav = std::map(); // iterate over all components XMLfile::Query query = xmlconfig.query("componentid"); @@ -101,7 +98,7 @@ void CavityWriter::readXML(XMLfileUnits &xmlconfig) { xmlconfig.changecurrentnode(pluginIter); int componentID = -1; xmlconfig.getNodeValue(xmlconfig.getcurrentnodepath(), componentID); - global_log->info() << "[CavityWriter] Component: " << componentID << endl; + Log::global_log->info() << "[CavityWriter] Component: " << componentID << std::endl; CavityEnsemble *cav = new CavityEnsemble(); _mcav[componentID] = cav; } @@ -123,7 +120,7 @@ void CavityWriter::init(ParticleContainer *particleContainer, DomainDecompBase * if ((Tcur < 0.85 * Ttar) || (Tcur > 1.15 * Ttar)) Tcur = Ttar; - map::iterator ceit; + std::map::iterator ceit; for (ceit = _mcav.begin(); ceit != _mcav.end(); ceit++) { // setup @@ -138,9 +135,9 @@ void CavityWriter::init(ParticleContainer *particleContainer, DomainDecompBase * ceit->second->submitTemperature(Tcur); int cID = ceit->first; Component *c = global_simulation->getEnsemble()->getComponent(cID); - global_log->info() << "[Cavity Writer] init: " << cID << endl; + Log::global_log->info() << "[Cavity Writer] init: " << cID << std::endl; ceit->second->init(c, _Nx, _Ny, _Nz); - global_log->info() << "[Cavity Writer] init done: " << cID << endl; + Log::global_log->info() << "[Cavity Writer] init done: " << cID << std::endl; } } @@ -150,7 +147,7 @@ void CavityWriter::beforeEventNewTimestep( unsigned long simstep ) { if (simstep >= global_simulation->getInitStatistics() && simstep % _writeFrequency == 0) { - map::iterator ceit; + std::map::iterator ceit; for (ceit = this->_mcav.begin(); ceit != this->_mcav.end(); ceit++) { ceit->second->preprocessStep(); } @@ -163,7 +160,7 @@ void CavityWriter::afterForces( ) { if (simstep >= global_simulation->getInitStatistics() && simstep % _writeFrequency == 0) { - map::iterator ceit; + std::map::iterator ceit; for (ceit = this->_mcav.begin(); ceit != this->_mcav.end(); ceit++) { ceit->second->cavityStep(particleContainer); @@ -177,11 +174,11 @@ void CavityWriter::endStep(ParticleContainer * /*particleContainer*/, DomainDeco Domain * /*domain*/, unsigned long simstep) { if (simstep % _writeFrequency == 0) { - map::iterator ceit; + std::map::iterator ceit; - map cav_filenamestream; + std::map cav_filenamestream; for (ceit = _mcav.begin(); ceit != _mcav.end(); ceit++) { - cav_filenamestream[ceit->first] = new stringstream; + cav_filenamestream[ceit->first] = new std::stringstream; *cav_filenamestream[ceit->first] << _outputPrefix << "-c" << ceit->first; } @@ -195,15 +192,15 @@ void CavityWriter::endStep(ParticleContainer * /*particleContainer*/, DomainDeco for (ceit = _mcav.begin(); ceit != _mcav.end(); ceit++) { *cav_filenamestream[ceit->first] << ".cav.xyz"; - global_log->info() << "[CavityWriter] outputName: " << cav_filenamestream[ceit->first]->str() << endl; + Log::global_log->info() << "[CavityWriter] outputName: " << cav_filenamestream[ceit->first]->str() << std::endl; } int ownRank = domainDecomp->getRank(); if (ownRank == 0) { for (ceit = _mcav.begin(); ceit != _mcav.end(); ceit++) { - ofstream cavfilestream(cav_filenamestream[ceit->first]->str().c_str()); - cavfilestream << ceit->second->numCavities() << endl; - cavfilestream << "comment line" << endl; + std::ofstream cavfilestream(cav_filenamestream[ceit->first]->str().c_str()); + cavfilestream << ceit->second->numCavities() << std::endl; + cavfilestream << "comment line" << std::endl; cavfilestream.close(); } } @@ -213,12 +210,12 @@ void CavityWriter::endStep(ParticleContainer * /*particleContainer*/, DomainDeco if (ownRank == process) { for (ceit = _mcav.begin(); ceit != _mcav.end(); ceit++) { - ofstream cavfilestream(cav_filenamestream[ceit->first]->str().c_str(), ios::app); + std::ofstream cavfilestream(cav_filenamestream[ceit->first]->str().c_str(), std::ios::app); - map tcav = ceit->second->activeParticleContainer(); - map::iterator tcit; + std::map tcav = ceit->second->activeParticleContainer(); + std::map::iterator tcit; for (tcit = tcav.begin(); tcit != tcav.end(); tcit++) { - //global_log->info() << "[CavityWriter] output6" << endl; + //global_log->info() << "[CavityWriter] output6" << std::endl; if (ceit->first == 0) { cavfilestream << "C "; } else if (ceit->first == 1) { cavfilestream << "N "; } diff --git a/src/io/CheckpointWriter.cpp b/src/io/CheckpointWriter.cpp index 0b6c224962..da5f5010c0 100644 --- a/src/io/CheckpointWriter.cpp +++ b/src/io/CheckpointWriter.cpp @@ -11,19 +11,16 @@ #include "utils/Logger.h" -using Log::global_log; -using namespace std; - void CheckpointWriter::readXML(XMLfileUnits& xmlconfig) { _writeFrequency = 1; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "Write frequency: " << _writeFrequency << endl; + Log::global_log->info() << "Write frequency: " << _writeFrequency << std::endl; if(_writeFrequency == 0) { - global_log->error() << "Write frequency must be a positive nonzero integer, but is " << _writeFrequency << endl; + Log::global_log->error() << "Write frequency must be a positive nonzero integer, but is " << _writeFrequency << std::endl; Simulation::exit(-1); } - + std::string checkpointType = "unknown"; xmlconfig.getNodeValue("type", checkpointType); if("ASCII" == checkpointType) { @@ -33,18 +30,18 @@ void CheckpointWriter::readXML(XMLfileUnits& xmlconfig) { _useBinaryFormat = true; } else { - global_log->error() << "Unknown CheckpointWriter type '" << checkpointType << "', expected: ASCII|binary." << endl; + Log::global_log->error() << "Unknown CheckpointWriter type '" << checkpointType << "', expected: ASCII|binary." << std::endl; Simulation::exit(-1); } _outputPrefix = "mardyn"; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "Output prefix: " << _outputPrefix << endl; + Log::global_log->info() << "Output prefix: " << _outputPrefix << std::endl; int incremental = 1; xmlconfig.getNodeValue("incremental", incremental); _incremental = (incremental != 0); - global_log->info() << "Incremental numbers: " << _incremental << endl; + Log::global_log->info() << "Incremental numbers: " << _incremental << std::endl; int appendTimestamp = 0; xmlconfig.getNodeValue("appendTimestamp", appendTimestamp); @@ -53,7 +50,7 @@ void CheckpointWriter::readXML(XMLfileUnits& xmlconfig) { }else{ _appendTimestamp = false; } - global_log->info() << "Append timestamp: " << _appendTimestamp << endl; + Log::global_log->info() << "Append timestamp: " << _appendTimestamp << std::endl; } void CheckpointWriter::init(ParticleContainer * /*particleContainer*/, DomainDecompBase * /*domainDecomp*/, @@ -62,7 +59,7 @@ void CheckpointWriter::init(ParticleContainer * /*particleContainer*/, DomainDec void CheckpointWriter::endStep(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain, unsigned long simstep) { if( simstep % _writeFrequency == 0 ) { - stringstream filenamestream; + std::stringstream filenamestream; filenamestream << _outputPrefix; if(_incremental) { @@ -81,7 +78,7 @@ void CheckpointWriter::endStep(ParticleContainer *particleContainer, DomainDecom filenamestream << ".restart.dat"; } - string filename = filenamestream.str(); + std::string filename = filenamestream.str(); domain->writeCheckpoint(filename, particleContainer, domainDecomp, _simulation.getSimulationTime(), _useBinaryFormat); } } diff --git a/src/io/CheckpointWriter.h b/src/io/CheckpointWriter.h index 7bc6b7c922..61948fdd43 100644 --- a/src/io/CheckpointWriter.h +++ b/src/io/CheckpointWriter.h @@ -8,10 +8,10 @@ class CheckpointWriter : public PluginBase { public: - + CheckpointWriter() {} ~CheckpointWriter() {} - + /** @brief Read in XML configuration for CheckpointWriter. * @@ -27,7 +27,7 @@ class CheckpointWriter : public PluginBase { \endcode */ void readXML(XMLfileUnits& xmlconfig); - + void init(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain); void endStep( @@ -37,7 +37,7 @@ class CheckpointWriter : public PluginBase { ); void finish(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain); - + std::string getPluginName() { return std::string("CheckpointWriter"); } diff --git a/src/io/CommunicationPartnerWriter.cpp b/src/io/CommunicationPartnerWriter.cpp index c574799ccf..2d52b7e04c 100644 --- a/src/io/CommunicationPartnerWriter.cpp +++ b/src/io/CommunicationPartnerWriter.cpp @@ -8,31 +8,28 @@ #include "utils/Logger.h" #include "parallel/DomainDecompBase.h" -using Log::global_log; -using namespace std; - void CommunicationPartnerWriter::readXML(XMLfileUnits& xmlconfig) { _writeFrequency = 1; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "Write frequency: " << _writeFrequency << endl; + Log::global_log->info() << "Write frequency: " << _writeFrequency << std::endl; if(_writeFrequency == 0) { - global_log->error() << "Write frequency must be a positive nonzero integer, but is " << _writeFrequency << endl; + Log::global_log->error() << "Write frequency must be a positive nonzero integer, but is " << _writeFrequency << std::endl; Simulation::exit(-1); } - + std::string HaloParticleType = "unknown"; xmlconfig.getNodeValue("type", HaloParticleType); _outputPrefix = "mardyn"; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "Output prefix: " << _outputPrefix << endl; + Log::global_log->info() << "Output prefix: " << _outputPrefix << std::endl; int incremental = 1; xmlconfig.getNodeValue("incremental", incremental); _incremental = (incremental != 0); - global_log->info() << "Incremental numbers: " << _incremental << endl; + Log::global_log->info() << "Incremental numbers: " << _incremental << std::endl; int appendTimestamp = 0; xmlconfig.getNodeValue("appendTimestamp", appendTimestamp); @@ -41,7 +38,7 @@ void CommunicationPartnerWriter::readXML(XMLfileUnits& xmlconfig) { }else{ _appendTimestamp = false; } - global_log->info() << "Append timestamp: " << _appendTimestamp << endl; + Log::global_log->info() << "Append timestamp: " << _appendTimestamp << std::endl; } void CommunicationPartnerWriter::init(ParticleContainer * /*particleContainer*/, DomainDecompBase * /*domainDecomp*/, @@ -50,7 +47,7 @@ void CommunicationPartnerWriter::init(ParticleContainer * /*particleContainer*/, void CommunicationPartnerWriter::afterForces(ParticleContainer *particleContainer, DomainDecompBase* domainDecomp, unsigned long simstep) { if( simstep % _writeFrequency == 0 ) { - stringstream filenamestream; + std::stringstream filenamestream; filenamestream << _outputPrefix << "-rank" << domainDecomp->getRank(); if(_incremental) { @@ -65,7 +62,7 @@ void CommunicationPartnerWriter::afterForces(ParticleContainer *particleContaine filenamestream << ".commPartners.dat"; - string filename = filenamestream.str(); + std::string filename = filenamestream.str(); domainDecomp->printCommunicationPartners(filename); diff --git a/src/io/CommunicationPartnerWriter.h b/src/io/CommunicationPartnerWriter.h index 3c214b002c..c3764481ba 100644 --- a/src/io/CommunicationPartnerWriter.h +++ b/src/io/CommunicationPartnerWriter.h @@ -10,10 +10,10 @@ */ class CommunicationPartnerWriter : public PluginBase { public: - + CommunicationPartnerWriter() {} ~CommunicationPartnerWriter() {} - + /** @brief Read in XML configuration for CommunicationPartnerWriter. * @@ -28,7 +28,7 @@ class CommunicationPartnerWriter : public PluginBase { \endcode */ void readXML(XMLfileUnits& xmlconfig) override; - + void init(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain) override; void afterForces(ParticleContainer *particleContainer, @@ -41,7 +41,7 @@ class CommunicationPartnerWriter : public PluginBase { void finish(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain) override; - + std::string getPluginName() override { return std::string("CommunicationPartnerWriter"); } diff --git a/src/io/CubicGridGeneratorInternal.cpp b/src/io/CubicGridGeneratorInternal.cpp index 0840571d9d..51ece48d6e 100644 --- a/src/io/CubicGridGeneratorInternal.cpp +++ b/src/io/CubicGridGeneratorInternal.cpp @@ -27,25 +27,25 @@ CubicGridGeneratorInternal::CubicGridGeneratorInternal() : } void CubicGridGeneratorInternal::readXML(XMLfileUnits& xmlconfig) { - global_log->info() << "------------------------------------------------------------------------" << std::endl; - global_log->info() << "CubicGridGeneratorInternal (CGG)" << std::endl; + Log::global_log->info() << "------------------------------------------------------------------------" << std::endl; + Log::global_log->info() << "CubicGridGeneratorInternal (CGG)" << std::endl; xmlconfig.getNodeValue("numMolecules", _numMolecules); - if(_numMolecules)global_log->info() << "numMolecules: " << _numMolecules << std::endl; + if(_numMolecules)Log::global_log->info() << "numMolecules: " << _numMolecules << std::endl; double density = -1.; xmlconfig.getNodeValue("density", density); - global_log->info() << "density: " << density << std::endl; + Log::global_log->info() << "density: " << density << std::endl; xmlconfig.getNodeValue("binaryMixture", _binaryMixture); - global_log->info() << "binaryMixture: " << _binaryMixture << std::endl; + Log::global_log->info() << "binaryMixture: " << _binaryMixture << std::endl; // setting both or none is not allowed! if((_numMolecules == 0 && density == -1.) || (_numMolecules != 0 && density != -1.) ){ - global_log->error() << "Error in CubicGridGeneratorInternal: You have to set either density or numMolecules!" << std::endl; + Log::global_log->error() << "Error in CubicGridGeneratorInternal: You have to set either density or numMolecules!" << std::endl; Simulation::exit(2341); } if(density != -1.){ // density has been set if(density <= 0){ - global_log->error() + Log::global_log->error() << "Error in CubicGridGeneratorInternal: Density has to be positive and non-zero!" << std::endl; Simulation::exit(2342); @@ -54,7 +54,7 @@ void CubicGridGeneratorInternal::readXML(XMLfileUnits& xmlconfig) { for (int d = 0; d < 3; ++d) vol *= global_simulation->getDomain()->getGlobalLength(d); _numMolecules = density * vol; - global_log->info() << "numMolecules: " << _numMolecules << std::endl; + Log::global_log->info() << "numMolecules: " << _numMolecules << std::endl; } } @@ -63,7 +63,7 @@ unsigned long CubicGridGeneratorInternal::readPhaseSpace(ParticleContainer *part Log::global_log->info() << "Reading phase space file (CubicGridGenerator)." << std::endl; if(_numMolecules == 0){ - global_log->error() << "Error in CubicGridGeneratorInternal: numMolecules is not set!" + Log::global_log->error() << "Error in CubicGridGeneratorInternal: numMolecules is not set!" << std::endl << "Please make sure to run readXML()!" << std::endl; Simulation::exit(2341); } @@ -117,7 +117,7 @@ unsigned long CubicGridGeneratorInternal::readPhaseSpace(ParticleContainer *part global_simulation->timers()->setOutputString("CUBIC_GRID_GENERATOR_INPUT", "Initial IO took: "); Log::global_log->info() << "Initial IO took: " << global_simulation->timers()->getTime("CUBIC_GRID_GENERATOR_INPUT") << " sec" << std::endl; - global_log->info() << "------------------------------------------------------------------------" << std::endl; + Log::global_log->info() << "------------------------------------------------------------------------" << std::endl; return id + idOffset; } @@ -143,8 +143,8 @@ std::array CubicGridGeneratorInternal::determineMolsPerDimensi mardyn_assert(answer >= 1); if (answer < 1) { - global_log->error() << "computed num Molecules along dimension " << d << ": " << answer << std::endl; - global_log->error() << "Should be larger than 1. Exiting." << std::endl; + Log::global_log->error() << "computed num Molecules along dimension " << d << ": " << answer << std::endl; + Log::global_log->error() << "Should be larger than 1. Exiting." << std::endl; mardyn_exit(1); } diff --git a/src/io/DecompWriter.cpp b/src/io/DecompWriter.cpp index 3e83c70d0b..686f8b166e 100644 --- a/src/io/DecompWriter.cpp +++ b/src/io/DecompWriter.cpp @@ -11,9 +11,6 @@ #include "Simulation.h" #include "utils/Logger.h" -using Log::global_log; -using namespace std; - DecompWriter::DecompWriter() : _writeFrequency(1), _appendTimestamp(false), _incremental(true), _outputPrefix("mardyn") @@ -22,21 +19,21 @@ DecompWriter::DecompWriter() : void DecompWriter::readXML(XMLfileUnits& xmlconfig) { xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "Write frequency: " << _writeFrequency << endl; + Log::global_log->info() << "Write frequency: " << _writeFrequency << std::endl; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "Output prefix: " << _outputPrefix << endl; + Log::global_log->info() << "Output prefix: " << _outputPrefix << std::endl; int incremental = 1; xmlconfig.getNodeValue("incremental", incremental); _incremental = (incremental != 0); - global_log->info() << "Incremental numbers: " << _incremental << endl; + Log::global_log->info() << "Incremental numbers: " << _incremental << std::endl; int appendTimestamp = 0; xmlconfig.getNodeValue("appendTimestamp", appendTimestamp); if(appendTimestamp > 0) { _appendTimestamp = true; } - global_log->info() << "Append timestamp: " << _appendTimestamp << endl; + Log::global_log->info() << "Append timestamp: " << _appendTimestamp << std::endl; } @@ -46,7 +43,7 @@ void DecompWriter::init(ParticleContainer * /*particleContainer*/, DomainDecompB void DecompWriter::endStep(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain, unsigned long simstep) { if(simstep % _writeFrequency == 0) { - stringstream filenamestream; + std::stringstream filenamestream; filenamestream << _outputPrefix; if(_incremental) { /* align file numbers with preceding '0's in the required range from 0 to _numberOfTimesteps. */ @@ -60,7 +57,7 @@ void DecompWriter::endStep(ParticleContainer *particleContainer, DomainDecompBas filenamestream << ".decomp"; domainDecomp->printDecomp(filenamestream.str(), domain, particleContainer); - } + } } void DecompWriter::finish(ParticleContainer * /*particleContainer*/, DomainDecompBase * /*domainDecomp*/, diff --git a/src/io/DecompWriter.h b/src/io/DecompWriter.h index 2bd164a7f3..5c80b65242 100644 --- a/src/io/DecompWriter.h +++ b/src/io/DecompWriter.h @@ -43,7 +43,7 @@ class DecompWriter : public PluginBase { //! @todo comment void finish(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain); - + std::string getPluginName() { return std::string("DecompWriter"); } diff --git a/src/io/EnergyLogWriter.cpp b/src/io/EnergyLogWriter.cpp index 96a56050a4..a7ef2e069d 100644 --- a/src/io/EnergyLogWriter.cpp +++ b/src/io/EnergyLogWriter.cpp @@ -7,10 +7,9 @@ #include "particleContainer/ParticleContainer.h" #include "utils/xmlfileUnits.h" -using namespace std; void EnergyLogWriter::init(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain) { - global_log->info() << "Init global energy log." << endl; + Log::global_log->info() << "Init global energy log." << std::endl; #ifdef ENABLE_MPI int rank = domainDecomp->getRank(); @@ -22,7 +21,7 @@ void EnergyLogWriter::init(ParticleContainer *particleContainer, DomainDecompBas std::stringstream outputstream; outputstream.write(reinterpret_cast(&_writeFrequency), 8); - ofstream fileout(_outputFilename, std::ios::out | std::ios::binary); + std::ofstream fileout(_outputFilename, std::ios::out | std::ios::binary); fileout << outputstream.str(); fileout.close(); } @@ -30,10 +29,10 @@ void EnergyLogWriter::init(ParticleContainer *particleContainer, DomainDecompBas void EnergyLogWriter::readXML(XMLfileUnits& xmlconfig) { _writeFrequency = 1; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "Write frequency: " << _writeFrequency << endl; + Log::global_log->info() << "Write frequency: " << _writeFrequency << std::endl; _outputFilename = "global_energy.log"; xmlconfig.getNodeValue("outputfilename", _outputFilename); - global_log->info() << "Output filename: " << _outputFilename << endl; + Log::global_log->info() << "Output filename: " << _outputFilename << std::endl; } void EnergyLogWriter::endStep(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain, @@ -92,7 +91,7 @@ void EnergyLogWriter::endStep(ParticleContainer *particleContainer, DomainDecomp outputstream.write(reinterpret_cast(&globalT), 8); outputstream.write(reinterpret_cast(&globalPressure), 8); - ofstream fileout(_outputFilename, std::ios::app | std::ios::binary); + std::ofstream fileout(_outputFilename, std::ios::app | std::ios::binary); fileout << outputstream.str(); fileout.close(); } diff --git a/src/io/EnergyLogWriter.h b/src/io/EnergyLogWriter.h index 078e73f385..188fcf7565 100644 --- a/src/io/EnergyLogWriter.h +++ b/src/io/EnergyLogWriter.h @@ -43,7 +43,7 @@ class EnergyLogWriter : public PluginBase { ); void finish(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain); - + std::string getPluginName() { return std::string("EnergyLogWriter"); } diff --git a/src/io/FlopRateWriter.cpp b/src/io/FlopRateWriter.cpp index b4ebd2bcf7..7854594962 100644 --- a/src/io/FlopRateWriter.cpp +++ b/src/io/FlopRateWriter.cpp @@ -25,23 +25,23 @@ void FlopRateWriter::readXML(XMLfileUnits& xmlconfig) { _writeToStdout = true; _writeToFile = true; } else { - global_log->error() << "Unknown FlopRateOutputPlugin::mode. Choose \"stdout\", \"file\" or \"both\"." << endl; + Log::global_log->error() << "Unknown FlopRateOutputPlugin::mode. Choose \"stdout\", \"file\" or \"both\"." << std::endl; } _writeFrequency = 1; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "Write frequency: " << _writeFrequency << endl; + Log::global_log->info() << "Write frequency: " << _writeFrequency << std::endl; // TODO: if(_writeToFile) { - global_log->error() << "TODO: file output not yet supported." << endl; + Log::global_log->error() << "TODO: file output not yet supported." << std::endl; Simulation::exit(1); } if(_writeToFile) { _outputPrefix = "mardyn"; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "Output prefix: " << _outputPrefix << endl; + Log::global_log->info() << "Output prefix: " << _outputPrefix << std::endl; } } @@ -52,19 +52,19 @@ void FlopRateWriter::init(ParticleContainer * /*particleContainer*/, return; // initialize result file - string resultfile(_outputPrefix+".res"); + std::string resultfile(_outputPrefix+".res"); const auto now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); tm unused{}; if(domainDecomp->getRank()==0){ _fileStream.open(resultfile.c_str()); - _fileStream << "# ls1 MarDyn simulation started at " << std::put_time(localtime_r(&now, &unused), "%c") << endl; + _fileStream << "# ls1 MarDyn simulation started at " << std::put_time(localtime_r(&now, &unused), "%c") << std::endl; _fileStream << "#step\tt\t\tFLOP-Count\tFLOP-Rate-force\t\tFLOP-Rate-loop\tefficiency(%)\t\n"; } } void FlopRateWriter::afterForces(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, unsigned long simstep){ - global_log->debug() << "[FLOPRATEWRITER] after forces FLOPs" << std::endl; + Log::global_log->debug() << "[FLOPRATEWRITER] after forces FLOPs" << std::endl; measureFLOPS(particleContainer, simstep); } @@ -102,10 +102,10 @@ void FlopRateWriter::endStep(ParticleContainer *particleContainer, setPrefix(flop_rate_loop, flop_rate_loop_normalized, prefix_flop_rate_loop); if(_writeToStdout) { - global_log->info() << "FlopRateWriter (simulation step " << simstep << ")" << endl - << "\tFLOP-Count per Iteration : " << flops_normalized << " " << prefix_flops << "FLOPs" << endl - << "\tFLOP-rate in force calculation : " << flop_rate_force_normalized << " " << prefix_flop_rate_force << "FLOP/sec" << endl - << "\tFLOP-rate for main loop : " << flop_rate_loop_normalized << " " << prefix_flop_rate_loop << "FLOP/sec (" << percentage << " %)" << endl; + Log::global_log->info() << "FlopRateWriter (simulation step " << simstep << ")" << std::endl + << "\tFLOP-Count per Iteration : " << flops_normalized << " " << prefix_flops << "FLOPs" << std::endl + << "\tFLOP-rate in force calculation : " << flop_rate_force_normalized << " " << prefix_flop_rate_force << "FLOP/sec" << std::endl + << "\tFLOP-rate for main loop : " << flop_rate_loop_normalized << " " << prefix_flop_rate_loop << "FLOP/sec (" << percentage << " %)" << std::endl; _flopCounter->printStats(); } @@ -121,7 +121,7 @@ void FlopRateWriter::finish(ParticleContainer *particleContainer, const auto now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); tm unused{}; - _fileStream << "# ls1 mardyn simulation finished at " << std::put_time(localtime_r(&now, &unused), "%c") << endl; + _fileStream << "# ls1 mardyn simulation finished at " << std::put_time(localtime_r(&now, &unused), "%c") << std::endl; _fileStream << "# \n# Please address your questions and suggestions to the ls1 mardyn contact point:\n# \n# E-mail: contact@ls1-mardyn.de\n# \n# Phone: +49 631 205 3227\n# University of Kaiserslautern\n# Computational Molecular Engineering\n# Erwin-Schroedinger-Str. 44\n# D-67663 Kaiserslautern, Germany\n# \n# http://www.ls1-mardyn.de/\n"; _fileStream.close(); diff --git a/src/io/GammaWriter.cpp b/src/io/GammaWriter.cpp index f362a1d7ab..2faa439c1f 100644 --- a/src/io/GammaWriter.cpp +++ b/src/io/GammaWriter.cpp @@ -13,16 +13,16 @@ void GammaWriter::readXML(XMLfileUnits& xmlconfig) { xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "[GammaWriter] Write frequency: " << _writeFrequency << std::endl; + Log::global_log->info() << "[GammaWriter] Write frequency: " << _writeFrequency << std::endl; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "[GammaWriter] Output prefix: " << _outputPrefix << std::endl; + Log::global_log->info() << "[GammaWriter] Output prefix: " << _outputPrefix << std::endl; xmlconfig.getNodeValue("numInterfaces", _numInterfaces); - global_log->info() << "[GammaWriter] Number of interfaces: " << _numInterfaces << std::endl; + Log::global_log->info() << "[GammaWriter] Number of interfaces: " << _numInterfaces << std::endl; _range.ymax = global_simulation->getDomain()->getGlobalLength(1); xmlconfig.getNodeValue("range/ymin", _range.ymin); xmlconfig.getNodeValue("range/ymax", _range.ymax); - global_log->info() << "[GammaWriter] Range: y: " << _range.ymin << " - " << _range.ymax << std::endl; + Log::global_log->info() << "[GammaWriter] Range: y: " << _range.ymin << " - " << _range.ymax << std::endl; } void GammaWriter::init(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain) { @@ -36,12 +36,12 @@ void GammaWriter::init(ParticleContainer *particleContainer, DomainDecompBase *d // Rank 0 writes data to file if (domainDecomp->getRank() == 0) { - string resultfilename(_outputPrefix + ".dat"); + std::string resultfilename(_outputPrefix + ".dat"); _gammaStream.open(resultfilename); _gammaStream.precision(6); - _gammaStream << setw(24) << "simstep"; + _gammaStream << std::setw(24) << "simstep"; for (unsigned int componentId = 0; componentId < _numComp; ++componentId) { - _gammaStream << setw(22) << "gamma[" << componentId << "]"; + _gammaStream << std::setw(22) << "gamma[" << componentId << "]"; } _gammaStream << std::endl; _gammaStream.close(); @@ -57,8 +57,8 @@ void GammaWriter::endStep(ParticleContainer *particleContainer, DomainDecompBase if ((simstep % _writeFrequency == 0) && (simstep > global_simulation->getNumInitTimesteps())) { // Rank 0 writes data to file if (domainDecomp->getRank() == 0) { - string resultfilename(_outputPrefix + ".dat"); - + std::string resultfilename(_outputPrefix + ".dat"); + _gammaStream.open(resultfilename, std::ios::app); _gammaStream << FORMAT_SCI_MAX_DIGITS << simstep; for (unsigned int componentId = 0; componentId < _numComp; ++componentId) { diff --git a/src/io/GammaWriter.h b/src/io/GammaWriter.h index b0d0ff2c90..d1d2fd6f2a 100644 --- a/src/io/GammaWriter.h +++ b/src/io/GammaWriter.h @@ -6,7 +6,7 @@ #include class ParticleContainer; -class DomainDecompBase; +class DomainDecompBase; class Domain; /** @brief The GammaWriter plugin writes the surface tension to a file. @@ -59,7 +59,7 @@ class GammaWriter : public PluginBase { void finish(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain) override {} - + std::string getPluginName() override { return "GammaWriter"; } static PluginBase* createInstance() { return new GammaWriter(); } diff --git a/src/io/HaloParticleWriter.cpp b/src/io/HaloParticleWriter.cpp index 6dd1111b06..c18cbc4c2f 100644 --- a/src/io/HaloParticleWriter.cpp +++ b/src/io/HaloParticleWriter.cpp @@ -8,36 +8,33 @@ #include "utils/Logger.h" #include "parallel/DomainDecompBase.h" -using Log::global_log; -using namespace std; - void HaloParticleWriter::readXML(XMLfileUnits& xmlconfig) { _writeFrequency = 1; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "Write frequency: " << _writeFrequency << endl; + Log::global_log->info() << "Write frequency: " << _writeFrequency << std::endl; if(_writeFrequency == 0) { - global_log->error() << "Write frequency must be a positive nonzero integer, but is " << _writeFrequency << endl; + Log::global_log->error() << "Write frequency must be a positive nonzero integer, but is " << _writeFrequency << std::endl; Simulation::exit(-1); } - + std::string HaloParticleType = "unknown"; xmlconfig.getNodeValue("type", HaloParticleType); _outputPrefix = "mardyn"; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "Output prefix: " << _outputPrefix << endl; + Log::global_log->info() << "Output prefix: " << _outputPrefix << std::endl; _incremental = true; xmlconfig.getNodeValue("incremental", _incremental); - global_log->info() << "Incremental numbers: " << _incremental << endl; + Log::global_log->info() << "Incremental numbers: " << _incremental << std::endl; _appendTimestamp = false; xmlconfig.getNodeValue("appendTimestamp", _appendTimestamp); - global_log->info() << "Append timestamp: " << _appendTimestamp << endl; + Log::global_log->info() << "Append timestamp: " << _appendTimestamp << std::endl; } void HaloParticleWriter::init(ParticleContainer * /*particleContainer*/, DomainDecompBase * /*domainDecomp*/, @@ -46,7 +43,7 @@ void HaloParticleWriter::init(ParticleContainer * /*particleContainer*/, DomainD void HaloParticleWriter::afterForces(ParticleContainer *particleContainer, DomainDecompBase* domainDecomp, unsigned long simstep) { if( simstep % _writeFrequency == 0 ) { - stringstream filenamestream; + std::stringstream filenamestream; filenamestream << _outputPrefix << "-rank" << domainDecomp->getRank(); if(_incremental) { @@ -61,7 +58,7 @@ void HaloParticleWriter::afterForces(ParticleContainer *particleContainer, Domai filenamestream << ".halos.dat"; - string filename = filenamestream.str(); + std::string filename = filenamestream.str(); //global_simulation->getDomain()->writeCheckpoint(filename, particleContainer, domainDecomp, _simulation.getSimulationTime(), false); double rmin[3],rmax[3]; diff --git a/src/io/HaloParticleWriter.h b/src/io/HaloParticleWriter.h index b2546f4610..2130d43f0c 100644 --- a/src/io/HaloParticleWriter.h +++ b/src/io/HaloParticleWriter.h @@ -12,10 +12,10 @@ */ class HaloParticleWriter : public PluginBase { public: - + HaloParticleWriter() = default; ~HaloParticleWriter() override = default; - + /** @brief Read in XML configuration for HaloParticleWriter. * @@ -30,7 +30,7 @@ class HaloParticleWriter : public PluginBase { \endcode */ void readXML(XMLfileUnits& xmlconfig) override; - + void init(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain) override; void afterForces(ParticleContainer *particleContainer, @@ -43,7 +43,7 @@ class HaloParticleWriter : public PluginBase { void finish(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain) override; - + std::string getPluginName() override { return std::string("HaloParticleWriter"); } diff --git a/src/io/IOHelpers.cpp b/src/io/IOHelpers.cpp index 591d877a8f..d8dccf4b99 100644 --- a/src/io/IOHelpers.cpp +++ b/src/io/IOHelpers.cpp @@ -128,4 +128,4 @@ unsigned long IOHelpers::makeParticleIdsUniqueAndGetTotalNumParticles(ParticleCo unsigned long globalNumParticles = domainDecomp->collCommGetUnsLong(); domainDecomp->collCommFinalize(); return globalNumParticles; -} \ No newline at end of file +} diff --git a/src/io/IOHelpers.h b/src/io/IOHelpers.h index 2441577b8c..18a03b7743 100644 --- a/src/io/IOHelpers.h +++ b/src/io/IOHelpers.h @@ -10,7 +10,7 @@ namespace IOHelpers { /** * Removes the momentum from the simulation. - * Will first sum up the overall momentum (m*v) and mass of the simulation and then apply a velocity shift + * Will first sum up the overall momentum (m*v) and mass of the simulation and then apply a velocity shift * `-(momentum_sum / mass_sum)` to all particles which removes the momentum from the simulation. * @param particleContainer * @param components diff --git a/src/io/LoadBalanceWriter.cpp b/src/io/LoadBalanceWriter.cpp index f587fcc2cf..3d92664404 100644 --- a/src/io/LoadBalanceWriter.cpp +++ b/src/io/LoadBalanceWriter.cpp @@ -17,11 +17,11 @@ LoadbalanceWriter::LoadbalanceWriter::LoadbalanceWriter() : void LoadbalanceWriter::readXML(XMLfileUnits& xmlconfig) { xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "Write frequency: " << _writeFrequency << endl; + Log::global_log->info() << "Write frequency: " << _writeFrequency << std::endl; xmlconfig.getNodeValue("averageLength", _averageLength); - global_log->info() << "Average length: " << _averageLength << endl; + Log::global_log->info() << "Average length: " << _averageLength << std::endl; xmlconfig.getNodeValue("outputfilename", _outputFilename); - global_log->info() << "Output filename: " << _outputFilename << endl; + Log::global_log->info() << "Output filename: " << _outputFilename << std::endl; XMLfile::Query query = xmlconfig.query("timers/timer"); std::string oldpath = xmlconfig.getcurrentnodepath(); @@ -43,7 +43,7 @@ void LoadbalanceWriter::readXML(XMLfileUnits& xmlconfig) { _incremental_previous_times[timername] = 0.; } - global_log->info() << "Added timer for LB monitoring: " << timername << ", warninglevel: " << warninglevel + Log::global_log->info() << "Added timer for LB monitoring: " << timername << ", warninglevel: " << warninglevel << ", incremental: " << incrementalTimer << std::endl; } @@ -57,7 +57,7 @@ void LoadbalanceWriter::init(ParticleContainer */*particleContainer*/, // memory of this timer is managed by TimerProfiler. _defaultTimer = new Timer(); - global_simulation->timers()->registerTimer(default_timer_name, vector{"SIMULATION"}, _defaultTimer); + global_simulation->timers()->registerTimer(default_timer_name, std::vector{"SIMULATION"}, _defaultTimer); _timerNames.push_back(default_timer_name); size_t timestep_entry_offset = 2 * _timerNames.size(); @@ -92,7 +92,7 @@ void LoadbalanceWriter::endStep( _defaultTimer->reset(); if((simstep % _writeFrequency) == 0) { - flush(domainDecomp); + LoadbalanceWriter::flush(domainDecomp); } _defaultTimer->start(); } @@ -219,7 +219,7 @@ void LoadbalanceWriter::writeLBEntry(size_t id, std::ofstream &outputfile, int n } void LoadbalanceWriter::displayWarning(unsigned long simstep, const std::string& timername, double f_LB) { - global_log->warning() << "Load balance limit exceeded in simstep " << simstep + Log::global_log->warning() << "Load balance limit exceeded in simstep " << simstep << " for timer " << timername << ", limit: " << _warninglevels[timername] << " value: " << f_LB << std::endl; diff --git a/src/io/MPICheckpointWriter.cpp b/src/io/MPICheckpointWriter.cpp index 8e0d58ecbd..55c2d44969 100644 --- a/src/io/MPICheckpointWriter.cpp +++ b/src/io/MPICheckpointWriter.cpp @@ -23,8 +23,6 @@ #include "parallel/ParticleData.h" #endif -using Log::global_log; -using namespace std; extern Simulation* global_simulation; @@ -32,7 +30,7 @@ const char MPICheckpointWriter::_magicVersion[] = "MarDyn20150211trunk"; // int32_t const int MPICheckpointWriter::_endiannesstest = 0x0a0b0c0d; -MPICheckpointWriter::MPICheckpointWriter(unsigned long writeFrequency, string outputPrefix, bool incremental, string datarep) +MPICheckpointWriter::MPICheckpointWriter(unsigned long writeFrequency, std::string outputPrefix, bool incremental, std::string datarep) : _outputPrefix(outputPrefix), _writeFrequency(writeFrequency), _incremental(incremental), _appendTimestamp(false), _datarep(datarep) { if (outputPrefix == "") @@ -49,51 +47,51 @@ void MPICheckpointWriter::readXML(XMLfileUnits& xmlconfig) { _writeFrequency = 1; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "[MPICheckpointWriter]\twrite frequency: " << _writeFrequency << endl; - + Log::global_log->info() << "[MPICheckpointWriter]\twrite frequency: " << _writeFrequency << std::endl; + _outputPrefix = "mardyn"; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "[MPICheckpointWriter]\toutput prefix: " << _outputPrefix << endl; - + Log::global_log->info() << "[MPICheckpointWriter]\toutput prefix: " << _outputPrefix << std::endl; + _incremental = false; int incremental = 1; xmlconfig.getNodeValue("incremental", incremental); //_incremental = (incremental != 0); if(incremental > 0) { _incremental = true; - global_log->info() << "[MPICheckpointWriter]\tusing incremental numbers in file names" << endl; + Log::global_log->info() << "[MPICheckpointWriter]\tusing incremental numbers in file names" << std::endl; } - + _appendTimestamp = false; int appendTimestamp = 0; xmlconfig.getNodeValue("appendTimestamp", appendTimestamp); //_appendTimestamp = (appendTimestamp != 0); if(appendTimestamp > 0) { _appendTimestamp = true; - global_log->info() << "[MPICheckpointWriter]\tappend timestamp to file names" << endl; + Log::global_log->info() << "[MPICheckpointWriter]\tappend timestamp to file names" << std::endl; } - + _datarep = ""; // -> NULL //_datarep = "external32"; // "native", "internal", "external32" xmlconfig.getNodeValue("datarep", _datarep); if(!_datarep.empty()) - global_log->info() << "[MPICheckpointWriter]\tdata representation: " << _datarep << endl; - + Log::global_log->info() << "[MPICheckpointWriter]\tdata representation: " << _datarep << std::endl; + _measureTime = false; int measureTime = 0; xmlconfig.getNodeValue("measureTime", measureTime); //_measureTime = (measureTime != 0); if(measureTime > 0) { _measureTime = true; - global_log->info() << "[MPICheckpointWriter]\texecution wall time will be measured" << endl; + Log::global_log->info() << "[MPICheckpointWriter]\texecution wall time will be measured" << std::endl; } - + if(xmlconfig.changecurrentnode("mpi_info")) { #ifdef ENABLE_MPI - global_log->info() << "[MPICheckpointWriter] Setting MPI info object for IO" << endl; + Log::global_log->info() << "[MPICheckpointWriter] Setting MPI info object for IO" << std::endl; _mpiinfo.readXML(xmlconfig); #else - global_log->info() << "[MPICheckpointWriter] mpi_info only used in parallel/MPI version" << endl; + Log::global_log->info() << "[MPICheckpointWriter] mpi_info only used in parallel/MPI version" << std::endl; #endif xmlconfig.changecurrentnode(".."); } @@ -103,9 +101,9 @@ void MPICheckpointWriter::readXML(XMLfileUnits& xmlconfig) if(_particlesbuffersize) { #ifdef ENABLE_MPI - global_log->info() << "[MPICheckpointWriter]\tparticles buffer size: " << _particlesbuffersize << endl; + Log::global_log->info() << "[MPICheckpointWriter]\tparticles buffer size: " << _particlesbuffersize << std::endl; #else - global_log->info() << "[MPICheckpointWriter]\tparticles buffer size (" << _particlesbuffersize << ") only used in parallel/MPI version" << endl; + Log::global_log->info() << "[MPICheckpointWriter]\tparticles buffer size (" << _particlesbuffersize << ") only used in parallel/MPI version" << std::endl; #endif } } @@ -115,7 +113,7 @@ void MPICheckpointWriter::init(ParticleContainer * /*particleContainer*/, Domain { if(_incremental && _appendTimestamp) { // use the same timestamp for all increments: add it to the outputPrefix - stringstream outputPrefixstream; + std::stringstream outputPrefixstream; outputPrefixstream << _outputPrefix; char fmt[] = "%Y%m%dT%H%M%S"; // must have fixed size format for all time values/processes char timestring[256]; @@ -126,7 +124,7 @@ void MPICheckpointWriter::init(ParticleContainer * /*particleContainer*/, Domain #else gettimestr(fmt, timestring, sizeof(timestring)/sizeof(timestring[0])); #endif - outputPrefixstream << "_" << string(timestring); + outputPrefixstream << "_" << std::string(timestring); _outputPrefix = outputPrefixstream.str(); } } @@ -137,14 +135,14 @@ void MPICheckpointWriter::endStep(ParticleContainer *particleContainer, DomainDe const char *mpidatarep = NULL; if (!_datarep.empty()) mpidatarep=_datarep.c_str(); #endif - + if( simstep % _writeFrequency == 0 ) { - stringstream filenamestream; + std::stringstream filenamestream; filenamestream << _outputPrefix; - + if(_incremental) { /* align file numbers with preceding '0's in the required range from 0 to _numberOfTimesteps. */ - + unsigned long numTimesteps = _simulation.getNumTimesteps(); int num_digits = (int) ceil( log( double( numTimesteps / _writeFrequency ) ) / log(10.) ); filenamestream << "-" << aligned_number( simstep / _writeFrequency, num_digits, '0' ); @@ -160,20 +158,20 @@ void MPICheckpointWriter::endStep(ParticleContainer *particleContainer, DomainDe #else gettimestr(fmt, timestring, sizeof(timestring)/sizeof(timestring[0])); #endif - filenamestream << "_" << string(timestring); + filenamestream << "_" << std::string(timestring); } filenamestream << ".MPIrestart.dat"; - string filename = filenamestream.str(); - global_log->info() << "[MPICheckpointWriter]\tfilename: " << filename << endl; - + std::string filename = filenamestream.str(); + Log::global_log->info() << "[MPICheckpointWriter]\tfilename: " << filename << std::endl; + unsigned long numParticles_global = domain->getglobalNumMolecules(true, particleContainer, domainDecomp); unsigned long numParticles = particleContainer->getNumberOfParticles(); // local unsigned long numbb{1ul}; #ifdef ENABLE_MPI - global_log->info() << "[MPICheckpointWriter]\tnumber of particles: " << numParticles_global + Log::global_log->info() << "[MPICheckpointWriter]\tnumber of particles: " << numParticles_global << "\t(*" << sizeof(ParticleData) << "=" << numParticles_global*sizeof(ParticleData) << " Bytes in memory)" - << endl; + << std::endl; //global_log->set_mpi_output_all() int num_procs; MPI_CHECK( MPI_Comm_size(MPI_COMM_WORLD, &num_procs) ); @@ -183,28 +181,33 @@ void MPICheckpointWriter::endStep(ParticleContainer *particleContainer, DomainDe double mpistarttime=0; // =0 to prevent Jenkins/gcc complaining about uninitialized mpistarttime [-Werror=uninitialized] if(_measureTime) { - //if(ownrank==0) global_log->debug() << "MPICheckpointWriter (" << filename << ")\tstart measuring time" << endl; + //if(ownrank==0) Log::global_log->debug() << "MPICheckpointWriter (" << filename << ")\tstart measuring time" << std::endl; MPI_CHECK( MPI_Barrier(MPI_COMM_WORLD) ); mpistarttime=MPI_Wtime(); // global_simulation->timers()->start("MPI_CHECKPOINT_WRITER_INPUT"); // should use Timer instead } MPI_File mpifh; - MPI_CHECK( MPI_File_open(MPI_COMM_WORLD, const_cast(filename.c_str()), MPI_MODE_WRONLY|MPI_MODE_CREATE, _mpiinfo, &mpifh) ); // arg 2 type cast due to old MPI (<=V2) implementations (should be const char* now) - // Why does an explicit C cast (char*) not work? -> should be interpreted like a const_cast in the first place (see e.g. http://en.cppreference.com/w/cpp/language/explicit_cast) + // arg 2 type cast due to old MPI (<=V2) implementations (should be const char* now) + // Why does an explicit C cast (char*) not work? -> should be interpreted like a const_cast in the first place + // (see e.g. http://en.cppreference.com/w/cpp/language/explicit_cast) + MPI_CHECK( MPI_File_open(MPI_COMM_WORLD, const_cast(filename.c_str()), MPI_MODE_WRONLY|MPI_MODE_CREATE, _mpiinfo, &mpifh) ); //MPI_CHECK( MPI_File_preallocate( mpifh, mpifilesize); ) // might ensure that data can be written, but might be slow //MPI_Aint mpidtParticleDte; MPI_CHECK( MPI_File_get_type_extent(mpifh,mpidtParticleD,&mpidtParticleDte) ); - MPI_CHECK( MPI_File_set_view(mpifh, 0, MPI_BYTE, MPI_BYTE, const_cast(mpidatarep), _mpiinfo) ); // arg 5 type cast due to old MPI (<=V2) implementations (should be const char* now) + // arg 5 type cast due to old MPI (<=V2) implementations (should be const char* now) + MPI_CHECK( MPI_File_set_view(mpifh, 0, MPI_BYTE, MPI_BYTE, const_cast(mpidatarep), _mpiinfo) ); MPI_Offset mpioffset=0; MPI_Status mpistat; unsigned long startidx; if(ownrank==0) { // the first part of header will be written by rank 0 only //MPI_CHECK( MPI_File_write_at(mpifh,mpioffset,_magicVersion,strlen(_magicVersion)+1,MPI_CHAR,&mpistat) ); - MPI_CHECK( MPI_File_write(mpifh, (void*)const_cast(_magicVersion), strlen(_magicVersion)+1, MPI_CHAR, &mpistat) ); // arg 2 type cast due to old MPI (<=V2) implementations (should be const void* now) + // arg 2 type cast due to old MPI (<=V2) implementations (should be const void* now) + MPI_CHECK( MPI_File_write(mpifh, (void*)const_cast(_magicVersion), strlen(_magicVersion)+1, MPI_CHAR, &mpistat) ); mpioffset=64-sizeof(unsigned long)-sizeof(int); //MPI_CHECK( MPI_File_write_at(mpifh,mpioffset,&_endiannesstest,1,MPI_INT,&mpistat) ); MPI_CHECK( MPI_File_seek(mpifh,mpioffset,MPI_SEEK_SET) ); - MPI_CHECK( MPI_File_write(mpifh, (void*)const_cast(&_endiannesstest), 1, MPI_INT, &mpistat) ); // arg 2 type cast due to old MPI (<=V2) implementations (should be const void* now) + // arg 2 type cast due to old MPI (<=V2) implementations (should be const void* now) + MPI_CHECK( MPI_File_write(mpifh, (void*)const_cast(&_endiannesstest), 1, MPI_INT, &mpistat) ); //mpioffset=64-sizeof(unsigned long); //MPI_CHECK( MPI_File_write_at(mpifh,mpioffset,&gap,1,MPI_UNSIGNED_LONG,&mpistat) ); //MPI_CHECK( MPI_File_seek(mpifh,mpioffset,MPI_SEEK_SET) ); @@ -213,12 +216,14 @@ void MPICheckpointWriter::endStep(ParticleContainer *particleContainer, DomainDe //mpioffset=64; //MPI_CHECK( MPI_File_write_at(mpifh,mpioffset,"ICRVQD",7,MPI_CHAR,&mpistat) ); //MPI_CHECK( MPI_File_seek(mpifh,mpioffset,MPI_SEEK_SET) ); - MPI_CHECK( MPI_File_write(mpifh, (void*)const_cast("ICRVQD"), 6+1, MPI_CHAR, &mpistat) ); // arg 2 type cast due to old MPI (<=V2) implementations (should be const void* now) + // arg 2 type cast due to old MPI (<=V2) implementations (should be const void* now) + MPI_CHECK( MPI_File_write(mpifh, (void*)const_cast("ICRVQD"), 6+1, MPI_CHAR, &mpistat) ); mpioffset+=7; // //MPI_CHECK( MPI_File_write_at(mpifh,mpioffset,"BB",3,MPI_CHAR,&mpistat) ); //MPI_CHECK( MPI_File_seek(mpifh,mpioffset,MPI_SEEK_SET) ); - MPI_CHECK( MPI_File_write(mpifh, (void*)const_cast("BB"), 2+1, MPI_CHAR, &mpistat) ); // arg 2 type cast due to old MPI (<=V2) implementations (should be const void* now) + // arg 2 type cast due to old MPI (<=V2) implementations (should be const void* now) + MPI_CHECK( MPI_File_write(mpifh, (void*)const_cast("BB"), 2+1, MPI_CHAR, &mpistat) ); mpioffset+=3; numbb=(unsigned long)(num_procs); //MPI_CHECK( MPI_File_write_at(mpifh,mpioffset,&numbb,1,MPI_UNSIGNED_LONG,&mpistat) ); @@ -254,10 +259,10 @@ void MPICheckpointWriter::endStep(ParticleContainer *particleContainer, DomainDe mpioffset+=sizeof(unsigned long); MPI_CHECK( MPI_File_write_at(mpifh,mpioffset,&numParticles,1,MPI_UNSIGNED_LONG,&mpistat) ); mpioffset+=sizeof(unsigned long); - global_log->debug() << "[MPICheckpointWriter](" << ownrank << ")\tBB " << ":\t" + Log::global_log->debug() << "[MPICheckpointWriter](" << ownrank << ")\tBB " << ":\t" << bbmin[0] << ", " << bbmin[1] << ", " << bbmin[2] << " - " << bbmax[0] << ", " << bbmax[1] << ", " << bbmax[2] - << "\tstarting index=" << startidx << " numParticles=" << numParticles << endl; + << "\tstarting index=" << startidx << " numParticles=" << numParticles << std::endl; // MPI_Datatype mpidtParticleM, mpidtParticleD; ParticleData::getMPIType(mpidtParticleM); @@ -274,20 +279,41 @@ void MPICheckpointWriter::endStep(ParticleContainer *particleContainer, DomainDe mpidtParticleMsize=addr1-addr0; */ mpioffset=64+gap+startidx*mpidtParticleMsize; - MPI_CHECK( MPI_File_set_view(mpifh, mpioffset, mpidtParticleM, mpidtParticleM, const_cast(mpidatarep), _mpiinfo) ); // arg 5 type cast due to old MPI (<=V2) implementations (should be const char* now) - global_log->debug() << "[MPICheckpointWriter](" << ownrank << ")\twriting molecule data for " << numParticles << " particles of size " << mpidtParticleDts << endl; + // arg 5 type cast due to old MPI (<=V2) implementations (should be const char* now) + MPI_CHECK( MPI_File_set_view(mpifh, mpioffset, mpidtParticleM, mpidtParticleM, const_cast(mpidatarep), _mpiinfo) ); + Log::global_log->debug() + << "[MPICheckpointWriter](" + << ownrank + << ")\twriting molecule data for " + << numParticles + << " particles of size " + << mpidtParticleDts + << std::endl; //unsigned long writecounter=0; if(_particlesbuffersize>0) { ParticleData* particleStructBuffer=new ParticleData[_particlesbuffersize]; unsigned long bufidx=0; for (auto pos = particleContainer->iterator(ParticleIterator::ONLY_INNER_AND_BOUNDARY); pos.isValid(); ++pos) { - //global_log->debug() << "MPICheckpointWriter[" << ownrank << "]\t" << pos->getID() << "\t" << pos->componentid() << "\t" << pos->r(0) << "," << pos->r(1) << "," << pos->r(2) << endl; + // Log::global_log->debug() + // << "MPICheckpointWriter[" + // << ownrank + // << "]\t" + // << pos->getID() + // << "\t" + // << pos->componentid() + // << "\t" + // << pos->r(0) + // << "," + // << pos->r(1) + // << "," + // << pos->r(2) + // << std::endl; ParticleData::MoleculeToParticleData(particleStructBuffer[bufidx], *pos); ++bufidx; if(bufidx==_particlesbuffersize) { - //global_log->debug() << "MPICheckpointWriter[" << ownrank << "]\twriting" << _particlesbuffersize << " particles" << endl + //global_log->debug() << "MPICheckpointWriter[" << ownrank << "]\twriting" << _particlesbuffersize << " particles" << std::endl MPI_CHECK( MPI_File_write(mpifh, particleStructBuffer, _particlesbuffersize, mpidtParticleD, &mpistat) ); //++writecounter; bufidx=0; @@ -295,7 +321,7 @@ void MPICheckpointWriter::endStep(ParticleContainer *particleContainer, DomainDe } if(bufidx>0) { - //global_log->debug() << "MPICheckpointWriter[" << ownrank << "]\twriting" << bufidx << " particles" << endl + //global_log->debug() << "MPICheckpointWriter[" << ownrank << "]\twriting" << bufidx << " particles" << std::endl MPI_CHECK( MPI_File_write(mpifh, particleStructBuffer, bufidx, mpidtParticleD, &mpistat) ); //++writecounter; } @@ -305,16 +331,29 @@ void MPICheckpointWriter::endStep(ParticleContainer *particleContainer, DomainDe { ParticleData particleStruct; for (auto pos = particleContainer->iterator(ParticleIterator::ONLY_INNER_AND_BOUNDARY); pos.isValid(); ++pos) { - //global_log->debug() << "MPICheckpointWriter[" << ownrank << "]\t" << pos->getID() << "\t" << pos->componentid() << "\t" << pos->r(0) << "," << pos->r(1) << "," << pos->r(2) << endl; + // Log::global_log->debug() + // << "MPICheckpointWriter[" + // << ownrank + // << "]\t" + // << pos->getID() + // << "\t" + // << pos->componentid() + // << "\t" + // << pos->r(0) + // << "," + // << pos->r(1) + // << "," + // << pos->r(2) + // << std::endl; ParticleData::MoleculeToParticleData(particleStruct, *pos); - //global_log->debug() << "MPICheckpointWriter[" << ownrank << "]\twriting particle" << endl + // Log::global_log->debug() << "MPICheckpointWriter[" << ownrank << "]\twriting particle" << std::endl MPI_CHECK( MPI_File_write(mpifh, &particleStruct, 1, mpidtParticleD, &mpistat) ); //++writecounter; - // saving a struct directly will also save padding zeros... + // saving a struct directly will also save padding zeros... //mpioffset+=mpidtParticleMsize; } } - + MPI_CHECK( MPI_File_close(&mpifh) ); if(_measureTime) { @@ -322,28 +361,32 @@ void MPICheckpointWriter::endStep(ParticleContainer *particleContainer, DomainDe double mpimeasuredtime=MPI_Wtime()-mpistarttime; // global_simulation->timers()->stop("MPI_CHECKPOINT_WRITER_INPUT"); // double mpimeasuredtime=global_simulation->timers()->getTime("MPI_CHECKPOINT_WRITER_INPUT"); - if(ownrank==0) - global_log->info() << "[MPICheckpointWriter]\tmeasured time: " << mpimeasuredtime << " sec (par., " << num_procs << " proc.; " - << numParticles_global << "*" << mpidtParticleDts << "=" << numParticles_global*mpidtParticleDts << " Bytes)" - << endl; + if(ownrank==0) { + Log::global_log->info() << "[MPICheckpointWriter]\tmeasured time: " << mpimeasuredtime << " sec (par., " + << num_procs << " proc.; " << numParticles_global << "*" << mpidtParticleDts + << "=" << numParticles_global * mpidtParticleDts << " Bytes)" << std::endl; + } } #else - global_log->info() << "[MPICheckpointWriter]\tnumber of particles: " << numParticles_global + Log::global_log->info() << "[MPICheckpointWriter]\tnumber of particles: " << numParticles_global << "\t(*" << 2*sizeof(unsigned long)+13*sizeof(double) << "=" << numParticles_global*(2*sizeof(unsigned long)+13*sizeof(double)) << " Bytes in memory)" - << endl; + << std::endl; unsigned long gap=7+3+sizeof(unsigned long)+(6*sizeof(double)+2*sizeof(unsigned long)); unsigned int i; unsigned int offset=0; - if (!_datarep.empty()) global_log->warning() << "[MPICheckpointWriter]\tsetting data representation (" << _datarep << ") is not supported (yet) in sequential version" << endl; + if (!_datarep.empty()) { + Log::global_log->warning() << "[MPICheckpointWriter]\tsetting data representation (" << _datarep + << ") is not supported (yet) in sequential version" << std::endl; + } // should use Timer instead struct timeval tod_start; if(_measureTime) { - //global_log->debug() << "MPICheckpointWriter (" << filename << ")\tstart measuring time" << endl; + //global_log->debug() << "MPICheckpointWriter (" << filename << ")\tstart measuring time" << std::endl; gettimeofday( &tod_start, NULL ); // global_simulation->timers()->start("MPI_CHECKPOINT_WRITER_INPUT"); } // - ofstream ostrm(filename.c_str(),ios::out|ios::binary); + std::ofstream ostrm(filename.c_str(),std::ios::out|std::ios::binary); ostrm << _magicVersion; offset+=strlen(_magicVersion); for(i=0;i<64-offset-sizeof(unsigned long)-sizeof(int);++i) ostrm << '\0'; @@ -398,7 +441,7 @@ void MPICheckpointWriter::endStep(ParticleContainer *particleContainer, DomainDe double measuredtime=(double)(tod_end.tv_sec-tod_start.tv_sec)+(double)(tod_end.tv_usec-tod_start.tv_usec)/1.E6; // global_simulation->timers()->stop("MPI_CHECKPOINT_WRITER_INPUT"); // double measuredtime=global_simulation->timers()->getTime("MPI_CHECKPOINT_WRITER_INPUT"); - global_log->info() << "[MPICheckpointWriter]\tmeasured time: " << measuredtime << " sec (seq.)" << endl; + Log::global_log->info() << "[MPICheckpointWriter]\tmeasured time: " << measuredtime << " sec (seq.)" << std::endl; } #endif } diff --git a/src/io/MPICheckpointWriter.h b/src/io/MPICheckpointWriter.h index 6be92035d5..6cd6ad2ee4 100644 --- a/src/io/MPICheckpointWriter.h +++ b/src/io/MPICheckpointWriter.h @@ -15,7 +15,7 @@ class MPICheckpointWriter : public PluginBase { public: - + MPICheckpointWriter(){} //! @brief writes a checkpoint file that can be used to continue the simulation using MPIIO //! @@ -27,10 +27,10 @@ class MPICheckpointWriter : public PluginBase { //! Byte offset 56 - 63, 8: unsigned int gap_to_data=data_displ-64=18+numBB*64 //! Byte offset 64 - 70, 7: string tuple structure "ICRVQD\0" //! Byte offset 71 - 73, 3: string "BB\0" - //! Byte offset 74 - 81, 8: unsigned long number of bounding boxes + //! Byte offset 74 - 81, 8: unsigned long number of bounding boxes //! Byte offset 82 - (81+numBB*(6*8+2*8)), numBB*64: numBB*(6*double+2*unsigned long) bounding boxes //! Byte offset (64+gap_to_data) - : data tuples - //! + //! //! @param writeFrequency Controls the frequency of writing out the data (every timestep, every 10th, 100th, ... timestep) //! @param outputPrefix path and prefix for file name used //! @param incremental add simulation step to file name @@ -39,9 +39,9 @@ class MPICheckpointWriter : public PluginBase { , std::string outputPrefix, bool incremental=true , std::string datarep=std::string("")); //~MPICheckpointWriter() {}; - + void readXML(XMLfileUnits& xmlconfig); - + void init(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain); void endStep( @@ -51,7 +51,7 @@ class MPICheckpointWriter : public PluginBase { ); void finish(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain); - + std::string getPluginName() { return std::string("MPICheckpointWriter"); } @@ -59,7 +59,7 @@ class MPICheckpointWriter : public PluginBase { private: static const char _magicVersion[56]; static const int _endiannesstest; - + std::string _outputPrefix; unsigned long _writeFrequency; bool _incremental; diff --git a/src/io/MPI_IOCheckpointWriter.cpp b/src/io/MPI_IOCheckpointWriter.cpp index 0b390a9aef..685f5bd3dc 100644 --- a/src/io/MPI_IOCheckpointWriter.cpp +++ b/src/io/MPI_IOCheckpointWriter.cpp @@ -28,7 +28,6 @@ #include "particleContainer/Cell.h" #include -using Log::global_log; MPI_IOCheckpointWriter::MPI_IOCheckpointWriter(unsigned long writeFrequency, std::string outputPrefix, bool incremental) { @@ -50,23 +49,23 @@ MPI_IOCheckpointWriter::~MPI_IOCheckpointWriter() { void MPI_IOCheckpointWriter::readXML(XMLfileUnits& xmlconfig) { _writeFrequency = 1; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "Write frequency: " << _writeFrequency << std::endl; + Log::global_log->info() << "Write frequency: " << _writeFrequency << std::endl; _outputPrefix = "mardyn"; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "Output prefix: " << _outputPrefix << std::endl; + Log::global_log->info() << "Output prefix: " << _outputPrefix << std::endl; int incremental = 1; xmlconfig.getNodeValue("incremental", incremental); _incremental = (incremental != 0); - global_log->info() << "Incremental numbers: " << _incremental << std::endl; + Log::global_log->info() << "Incremental numbers: " << _incremental << std::endl; int appendTimestamp = 0; xmlconfig.getNodeValue("appendTimestamp", appendTimestamp); if (appendTimestamp > 0) { _appendTimestamp = true; } - global_log->info() << "Append timestamp: " << _appendTimestamp << std::endl; + Log::global_log->info() << "Append timestamp: " << _appendTimestamp << std::endl; } void MPI_IOCheckpointWriter::init(ParticleContainer *particleContainer, @@ -107,8 +106,8 @@ void MPI_IOCheckpointWriter::endStep(ParticleContainer *particleContainer, Domai long realLocalNumCells = boxCellDimension[0]*boxCellDimension[1]*boxCellDimension[2]; long realGlobalNumCells = 0; MPI_Allreduce(&realLocalNumCells, &realGlobalNumCells, 1, MPI_LONG, MPI_SUM, MPI_COMM_WORLD); - cout << "Rank: " << domainDecomp->getRank() << " realGlobalNumCells: " << realGlobalNumCells << std::endl; - cout << "Rank: " << domainDecomp->getRank() << " BoundingBoxMin: " << domainDecomp->getBoundingBoxMin(0, domain) << "," << domainDecomp->getBoundingBoxMin(1, domain) << "," << domainDecomp->getBoundingBoxMin(2, domain) << " BoundingBoxMax: " << domainDecomp->getBoundingBoxMax(0, domain) << "," << domainDecomp->getBoundingBoxMax(1, domain) << "," << domainDecomp->getBoundingBoxMax(2, domain) << std::endl; + std::cout << "Rank: " << domainDecomp->getRank() << " realGlobalNumCells: " << realGlobalNumCells << std::endl; + std::cout << "Rank: " << domainDecomp->getRank() << " BoundingBoxMin: " << domainDecomp->getBoundingBoxMin(0, domain) << "," << domainDecomp->getBoundingBoxMin(1, domain) << "," << domainDecomp->getBoundingBoxMin(2, domain) << " BoundingBoxMax: " << domainDecomp->getBoundingBoxMax(0, domain) << "," << domainDecomp->getBoundingBoxMax(1, domain) << "," << domainDecomp->getBoundingBoxMax(2, domain) << std::endl; domainDecomp->getBoundingBoxMin(0, domain); */ @@ -181,7 +180,7 @@ void MPI_IOCheckpointWriter::endStep(ParticleContainer *particleContainer, Domai for (int i = 0; i < globalNumCells; i++) { if (localNumParticlesPerCell[i] > 0) { if (globalNumParticlesPerCell[i] != localNumParticlesPerCell[i]) { - global_log->info() << "Allreduce ist fehlgeschlagen" + Log::global_log->info() << "Allreduce ist fehlgeschlagen" << std::endl; } } @@ -192,7 +191,7 @@ void MPI_IOCheckpointWriter::endStep(ParticleContainer *particleContainer, Domai gettimeofday(&timer2, NULL); timeDiff = timer2.tv_sec - timer1.tv_sec + (timer2.tv_usec - timer1.tv_usec) / 1.E6; - global_log->info() << "Das MPI-IO Allreduce hat " << timeDiff + Log::global_log->info() << "Das MPI-IO Allreduce hat " << timeDiff << " Sekunden benötigt" << std::endl; } */ @@ -286,7 +285,7 @@ void MPI_IOCheckpointWriter::endStep(ParticleContainer *particleContainer, Domai gettimeofday(&timer2, NULL); timeDiff = timer2.tv_sec - timer1.tv_sec + (timer2.tv_usec - timer1.tv_usec) / 1.E6; - global_log->info() << "Das Schreiben des MPI-IO Headers hat " + Log::global_log->info() << "Das Schreiben des MPI-IO Headers hat " << timeDiff << " Sekunden benötigt" << std::endl; } @@ -359,7 +358,7 @@ void MPI_IOCheckpointWriter::endStep(ParticleContainer *particleContainer, Domai gettimeofday(&timer2, NULL); timeDiff = timer2.tv_sec - timer1.tv_sec + (timer2.tv_usec - timer1.tv_usec) / 1.E6; - global_log->info() << "Das Belegen des MPI-IO Schreibearrays hat " + Log::global_log->info() << "Das Belegen des MPI-IO Schreibearrays hat " << timeDiff << " Sekunden benötigt" << std::endl; } @@ -404,7 +403,7 @@ void MPI_IOCheckpointWriter::endStep(ParticleContainer *particleContainer, Domai /* if (domainDecomp->getRank() == 0) { - global_log->info() << "Das Lesen der Zellen hat " << timeDiffGlobal + Log::global_log->info() << "Das Lesen der Zellen hat " << timeDiffGlobal << " Sekunden benötigt" << std::endl; } @@ -433,7 +432,7 @@ void MPI_IOCheckpointWriter::handle_error(int i) { MPI_Error_string(i, error_string, &length_of_error_string); - global_log->error() << "Writing of file was not successfull " << " , " << i + Log::global_log->error() << "Writing of file was not successfull " << " , " << i << " , " << error_string << std::endl; Simulation::exit(1); #endif diff --git a/src/io/MPI_IOReader.cpp b/src/io/MPI_IOReader.cpp index 5bb19e0c3a..f706427b96 100644 --- a/src/io/MPI_IOReader.cpp +++ b/src/io/MPI_IOReader.cpp @@ -32,8 +32,6 @@ //#include -using Log::global_log; -using namespace std; MPI_IOReader::MPI_IOReader() { // TODO Auto-generated constructor stub @@ -44,42 +42,42 @@ MPI_IOReader::~MPI_IOReader() { // TODO Auto-generated destructor stub } -void MPI_IOReader::setPhaseSpaceFile(string filename) { +void MPI_IOReader::setPhaseSpaceFile(std::string filename) { _phaseSpaceFile = filename; } -void MPI_IOReader::setPhaseSpaceHeaderFile(string filename) { +void MPI_IOReader::setPhaseSpaceHeaderFile(std::string filename) { _phaseSpaceHeaderFile = filename; } void MPI_IOReader::readPhaseSpaceHeader(Domain* domain, double timestep) { - string token, token2; + std::string token, token2; - global_log->info() << "Opening phase space header file " << _phaseSpaceHeaderFile << endl; + Log::global_log->info() << "Opening phase space header file " << _phaseSpaceHeaderFile << std::endl; _phaseSpaceHeaderFileStream.open(_phaseSpaceHeaderFile.c_str()); _phaseSpaceHeaderFileStream >> token; if(token != "mardyn") { - global_log->error() << _phaseSpaceHeaderFile << " not a valid mardyn input file." << endl; + Log::global_log->error() << _phaseSpaceHeaderFile << " not a valid mardyn input file." << std::endl; Simulation::exit(1); } - string inputversion; + std::string inputversion; _phaseSpaceHeaderFileStream >> token >> inputversion; // FIXME: remove tag trunk from file specification? if(token != "trunk") { - global_log->error() << "Wrong input file specifier (\'" << token << "\' instead of \'trunk\')." << endl; + Log::global_log->error() << "Wrong input file specifier (\'" << token << "\' instead of \'trunk\')." << std::endl; Simulation::exit(1); } if(strtoul(inputversion.c_str(), NULL, 0) < 20080701) { - global_log->error() << "Input version tool old (" << inputversion << ")" << endl; + Log::global_log->error() << "Input version tool old (" << inputversion << ")" << std::endl; Simulation::exit(1); } - global_log->info() << "Reading phase space header from file " << _phaseSpaceHeaderFile << endl; + Log::global_log->info() << "Reading phase space header from file " << _phaseSpaceHeaderFile << std::endl; - vector& dcomponents = *(_simulation.getEnsemble()->getComponents()); + std::vector& dcomponents = *(_simulation.getEnsemble()->getComponents()); bool header = true; // When the last header element is reached, "header" is set to false while(header) { @@ -94,7 +92,7 @@ void MPI_IOReader::readPhaseSpaceHeader(Domain* domain, double timestep) { token.clear(); _phaseSpaceHeaderFileStream >> token; - global_log->info() << "{{" << token << "}}" << endl; + Log::global_log->info() << "{{" << token << "}}" << std::endl; if((token == "currentTime") || (token == "t")) { // set current simulation time @@ -108,7 +106,7 @@ void MPI_IOReader::readPhaseSpaceHeader(Domain* domain, double timestep) { domain->setGlobalTemperature(targetT); } else if((token == "MoleculeFormat") || (token == "M")) { - string ntypestring("ICRVQD"); + std::string ntypestring("ICRVQD"); _phaseSpaceFileStream >> ntypestring; ntypestring.erase(ntypestring.find_last_not_of(" \t\n") + 1); @@ -116,12 +114,12 @@ void MPI_IOReader::readPhaseSpaceHeader(Domain* domain, double timestep) { if(!(ntypestring == "ICRVQD" || ntypestring == "ICRV" || ntypestring == "IRV")) { - global_log->error() << "Unknown molecule format: '" - << ntypestring << "'" << endl; + Log::global_log->error() << "Unknown molecule format: '" + << ntypestring << "'" << std::endl; Simulation::exit(1); } _moleculeFormat = ntypestring; - global_log->info() << " molecule format: " << ntypestring << endl; + Log::global_log->info() << " molecule format: " << ntypestring << std::endl; header = false; } else if((token == "ThermostatTemperature") || (token == "ThT") || (token == "h")) { // set up a new thermostat @@ -129,7 +127,7 @@ void MPI_IOReader::readPhaseSpaceHeader(Domain* domain, double timestep) { double targetT; _phaseSpaceHeaderFileStream >> thermostat_id; _phaseSpaceHeaderFileStream >> targetT; - global_log->info() << "Thermostat number " << thermostat_id << " has T = " << targetT << ".\n"; + Log::global_log->info() << "Thermostat number " << thermostat_id << " has T = " << targetT << ".\n"; domain->setTargetTemperature(thermostat_id, targetT); } else if((token == "ComponentThermostat") || (token == "CT") || (token == "o")) { // specify a thermostat for a component @@ -138,7 +136,7 @@ void MPI_IOReader::readPhaseSpaceHeader(Domain* domain, double timestep) { int component_id; int thermostat_id; _phaseSpaceHeaderFileStream >> component_id >> thermostat_id; - global_log->info() << "Component " << component_id << " (internally: " + Log::global_log->info() << "Component " << component_id << " (internally: " << component_id - 1 << ") is regulated by thermostat number " << thermostat_id << ".\n"; component_id--; // FIXME thermostat IDs start with 0 in the program but not in the config file?! if(thermostat_id < 0) // thermostat IDs start with 0 @@ -170,10 +168,10 @@ void MPI_IOReader::readPhaseSpaceHeader(Domain* domain, double timestep) { // components: unsigned int numcomponents = 0; _phaseSpaceHeaderFileStream >> numcomponents; - global_log->info() << "Reading " << numcomponents << " components" << endl; + Log::global_log->info() << "Reading " << numcomponents << " components" << std::endl; dcomponents.resize(numcomponents); for(unsigned int i = 0; i < numcomponents; i++) { - global_log->info() << "comp. i = " << i << ": " << endl; + Log::global_log->info() << "comp. i = " << i << ": " << std::endl; dcomponents[i].setID(i); unsigned int numljcenters = 0; unsigned int numcharges = 0; @@ -183,7 +181,7 @@ void MPI_IOReader::readPhaseSpaceHeader(Domain* domain, double timestep) { _phaseSpaceHeaderFileStream >> numljcenters >> numcharges >> numdipoles >> numquadrupoles >> numtersoff; if(numtersoff != 0) { - global_log->error() << "tersoff no longer supported." << std::endl; + Log::global_log->error() << "tersoff no longer supported." << std::endl; Simulation::exit(-1); } double x, y, z, m; @@ -191,27 +189,27 @@ void MPI_IOReader::readPhaseSpaceHeader(Domain* domain, double timestep) { double eps, sigma, tcutoff, do_shift; _phaseSpaceHeaderFileStream >> x >> y >> z >> m >> eps >> sigma >> tcutoff >> do_shift; dcomponents[i].addLJcenter(x, y, z, m, eps, sigma, tcutoff, (do_shift != 0)); - global_log->info() << "LJ at [" << x << " " << y << " " << z - << "], mass: " << m << ", epsilon: " << eps << ", sigma: " << sigma << endl; + Log::global_log->info() << "LJ at [" << x << " " << y << " " << z + << "], mass: " << m << ", epsilon: " << eps << ", sigma: " << sigma << std::endl; } for(unsigned int j = 0; j < numcharges; j++) { double q; _phaseSpaceHeaderFileStream >> x >> y >> z >> m >> q; dcomponents[i].addCharge(x, y, z, m, q); - global_log->info() << "charge at [" << x << " " << y << " " << z - << "], mass: " << m << ", q: " << q << endl; + Log::global_log->info() << "charge at [" << x << " " << y << " " << z + << "], mass: " << m << ", q: " << q << std::endl; } for(unsigned int j = 0; j < numdipoles; j++) { double eMyx, eMyy, eMyz, absMy; _phaseSpaceHeaderFileStream >> x >> y >> z >> eMyx >> eMyy >> eMyz >> absMy; dcomponents[i].addDipole(x, y, z, eMyx, eMyy, eMyz, absMy); - global_log->info() << "dipole at [" << x << " " << y << " " << z << "] " << endl; + Log::global_log->info() << "dipole at [" << x << " " << y << " " << z << "] " << std::endl; } for(unsigned int j = 0; j < numquadrupoles; j++) { double eQx, eQy, eQz, absQ; _phaseSpaceHeaderFileStream >> x >> y >> z >> eQx >> eQy >> eQz >> absQ; dcomponents[i].addQuadrupole(x, y, z, eQx, eQy, eQz, absQ); - global_log->info() << "quad at [" << x << " " << y << " " << z << "] " << endl; + Log::global_log->info() << "quad at [" << x << " " << y << " " << z << "] " << std::endl; } double IDummy1, IDummy2, IDummy3; // FIXME! Was soll das hier? Was ist mit der Initialisierung im Fall I <= 0. @@ -223,18 +221,18 @@ void MPI_IOReader::readPhaseSpaceHeader(Domain* domain, double timestep) { if(IDummy3 > 0.) dcomponents[i].setI33(IDummy3); domain->setProfiledComponentMass(dcomponents[i].m()); - global_log->info() << endl; + Log::global_log->info() << std::endl; } #ifndef NDEBUG for(unsigned int i = 0; i < numcomponents; i++) { - global_log->debug() << "Component " << (i + 1) << " of " << numcomponents << endl; - global_log->debug() << dcomponents[i] << endl; + Log::global_log->debug() << "Component " << (i + 1) << " of " << numcomponents << std::endl; + Log::global_log->debug() << dcomponents[i] << std::endl; } #endif // Mixing coefficients - vector& dmixcoeff = domain->getmixcoeff(); + std::vector& dmixcoeff = domain->getmixcoeff(); dmixcoeff.clear(); for(unsigned int i = 1; i < numcomponents; i++) { for(unsigned int j = i + 1; j <= numcomponents; j++) { @@ -254,7 +252,7 @@ void MPI_IOReader::readPhaseSpaceHeader(Domain* domain, double timestep) { // find out the actual position, because the phase space definition will follow // FIXME: is there a more elegant way? fpos = _phaseSpaceHeaderFileStream.tellg(); - _phaseSpaceFileStream.seekg(fpos, ios::beg); + _phaseSpaceFileStream.seekg(fpos, std::ios::beg); } // FIXME: Is there a better solution than skipping the rest of the file? // This is not the last line of the header. The last line is 'MoleculeFormat' @@ -268,7 +266,7 @@ void MPI_IOReader::readPhaseSpaceHeader(Domain* domain, double timestep) { } // LOCATION OF OLD PRESSURE GRADIENT TOKENS else { - global_log->error() << "Invalid token \'" << token << "\' found. Skipping rest of the header." << endl; + Log::global_log->error() << "Invalid token \'" << token << "\' found. Skipping rest of the header." << std::endl; header = false; } } @@ -284,15 +282,15 @@ MPI_IOReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domai Timer inputTimer; inputTimer.start(); - string token; - vector& dcomponents = *(_simulation.getEnsemble()->getComponents()); + std::string token; + std::vector& dcomponents = *(_simulation.getEnsemble()->getComponents()); unsigned int numcomponents = dcomponents.size(); unsigned long localMaxid = 0; // stores the highest molecule ID found in the phase space file if (numcomponents < 1) { - global_log->warning() + Log::global_log->warning() << "No components defined! Setting up single one-centered LJ" - << endl; + << std::endl; numcomponents = 1; dcomponents.resize(numcomponents); dcomponents[0].setID(0); @@ -300,8 +298,8 @@ MPI_IOReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domai } if (domainDecomp->getRank() == 0) { - global_log->info() << "Opening phase space file " << _phaseSpaceFile - << endl; + Log::global_log->info() << "Opening phase space file " << _phaseSpaceFile + << std::endl; } const char * fileName = _phaseSpaceFile.c_str(); @@ -326,7 +324,7 @@ MPI_IOReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domai ret = MPI_File_open(MPI_COMM_WORLD, fileName, MPI_MODE_RDONLY, info, &fh); if (ret != MPI_SUCCESS) { std::cerr << "Could not open phaseSpaceFile " << _phaseSpaceFile - << endl; + << std::endl; handle_error(ret); } @@ -420,7 +418,7 @@ MPI_IOReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domai gettimeofday(&timer2, NULL); timeDiff = timer2.tv_sec - timer1.tv_sec + (timer2.tv_usec - timer1.tv_usec) / 1.E6; - global_log->info() << "Das Lesen des MPI-IO Headers hat " << timeDiff + Log::global_log->info() << "Das Lesen des MPI-IO Headers hat " << timeDiff << " Sekunden benötigt" << std::endl; } */ @@ -574,7 +572,7 @@ MPI_IOReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domai MPI_COMM_WORLD); if (domainDecomp->getRank() == 0) { - global_log->info() << "Das Lesen der Zellen hat " << timeDiffGlobal + Log::global_log->info() << "Das Lesen der Zellen hat " << timeDiffGlobal << " Sekunden benötigt" << std::endl; } */ @@ -619,20 +617,20 @@ MPI_IOReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domai gettimeofday(&timer2, NULL); timeDiff = timer2.tv_sec - timer1.tv_sec + (timer2.tv_usec - timer1.tv_usec) / 1.E6; - global_log->info() << "NumMolsInComps und globalRotDOF hat " + Log::global_log->info() << "NumMolsInComps und globalRotDOF hat " << timeDiff << " Sekunden benötigt" << std::endl; } */ - global_log->info() << "Finished reading molecules: 100%" << endl; - global_log->info() << "Reading Molecules done" << endl; + Log::global_log->info() << "Finished reading molecules: 100%" << std::endl; + Log::global_log->info() << "Reading Molecules done" << std::endl; // TODO: Shouldn't we always calculate this? if (domain->getglobalRho() < 1e-5) { domain->setglobalRho( domain->getglobalNumMolecules(true, particleContainer, domainDecomp) / domain->getGlobalVolume()); - global_log->info() << "Calculated Rho_global = " - << domain->getglobalRho() << endl; + Log::global_log->info() << "Calculated Rho_global = " + << domain->getglobalRho() << std::endl; } //get maximum I/O time of each process and output it inputTimer.stop(); @@ -642,8 +640,8 @@ MPI_IOReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domai MPI_Reduce(&ioTime, &maxIOTime, 1, MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD); if (domainDecomp->getRank() == 0) { - global_log->info() << "Initial IO took: " << maxIOTime - << " sec" << endl; + Log::global_log->info() << "Initial IO took: " << maxIOTime + << " sec" << std::endl; } //get the global maximumID @@ -664,7 +662,7 @@ void MPI_IOReader::handle_error(int i) { MPI_Error_string(i, error_string, &length_of_error_string); - global_log->error() << "Writing of file was not successfull " << " , " << i + Log::global_log->error() << "Writing of file was not successfull " << " , " << i << " , " << error_string << std::endl; Simulation::exit(1); #endif diff --git a/src/io/MaxWriter.cpp b/src/io/MaxWriter.cpp index bbc180fc0e..7232d20820 100644 --- a/src/io/MaxWriter.cpp +++ b/src/io/MaxWriter.cpp @@ -10,8 +10,6 @@ #include #include -using Log::global_log; -using namespace std; MaxWriter::MaxWriter() : @@ -32,18 +30,18 @@ MaxWriter::~MaxWriter() {} void MaxWriter::readXML(XMLfileUnits& xmlconfig) { - global_log->info() << "------------------------------------------------------------------------" << std::endl; - global_log->info() << "MaxWriter" << std::endl; + Log::global_log->info() << "------------------------------------------------------------------------" << std::endl; + Log::global_log->info() << "MaxWriter" << std::endl; _writeFrequency = 1000; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "Write frequency: " << _writeFrequency << endl; + Log::global_log->info() << "Write frequency: " << _writeFrequency << std::endl; _outputPrefix = "maxvals"; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "Output prefix: " << _outputPrefix << endl; + Log::global_log->info() << "Output prefix: " << _outputPrefix << std::endl; - global_log->info() << "------------------------------------------------------------------------" << std::endl; + Log::global_log->info() << "------------------------------------------------------------------------" << std::endl; } void MaxWriter::init(ParticleContainer * /*particleContainer*/, @@ -107,8 +105,8 @@ void MaxWriter::init(ParticleContainer * /*particleContainer*/, for(uint32_t qi=0; qi<_numQuantities; ++qi) { - ofstream ofs(sstrFilename[qi].str().c_str(), ios::out); - sstrOutput[qi] << endl; + std::ofstream ofs(sstrFilename[qi].str().c_str(), std::ios::out); + sstrOutput[qi] << std::endl; ofs << sstrOutput[qi].str(); ofs.close(); } @@ -250,13 +248,13 @@ void MaxWriter::writeData(DomainDecompBase* domainDecomp) for(uint32_t vi=1; vi<_numValsPerQuantity; ++vi) sstrOutput[qi] << FORMAT_SCI_MAX_DIGITS << _dMaxValuesGlobal[nOffsetComponent+nOffsetQuantity+vi]; } - sstrOutput[qi] << endl; + sstrOutput[qi] << std::endl; } // write streams to files for(uint32_t qi=0; qi<_numQuantities; ++qi) { - ofstream ofs(sstrFilename[qi].str().c_str(), ios::app); + std::ofstream ofs(sstrFilename[qi].str().c_str(), std::ios::app); ofs << sstrOutput[qi].str(); ofs.close(); } diff --git a/src/io/MaxWriter.h b/src/io/MaxWriter.h index 2985fe8fd6..8957597d86 100644 --- a/src/io/MaxWriter.h +++ b/src/io/MaxWriter.h @@ -37,7 +37,7 @@ class MaxWriter : public PluginBase void finish(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain); - + std::string getPluginName() { return std::string("MaxWriter"); } diff --git a/src/io/MemoryProfiler.cpp b/src/io/MemoryProfiler.cpp index 49aca0dc0c..7653c4b764 100644 --- a/src/io/MemoryProfiler.cpp +++ b/src/io/MemoryProfiler.cpp @@ -50,8 +50,8 @@ void MemoryProfiler::registerObject(MemoryProfilable** object) { Log::global_log->debug() << "MemoryProfiler: added object" << std::endl; } -void MemoryProfiler::doOutput(const std::string& string) { - printGeneralInfo(string); +void MemoryProfiler::doOutput(const std::string& myString) { + printGeneralInfo(myString); // further info Log::global_log->debug() << "MemoryProfiler: number of objects: " << _list.size() << std::endl; @@ -135,7 +135,7 @@ int MemoryProfiler::getOwnMemory() { //Note: this value is in KB! return result; } -void MemoryProfiler::printGeneralInfo(const std::string& string) { +void MemoryProfiler::printGeneralInfo(const std::string& myString) { #ifndef _SX struct sysinfo memInfo; sysinfo(&memInfo); @@ -143,8 +143,8 @@ void MemoryProfiler::printGeneralInfo(const std::string& string) { long long usedMem = ((memInfo.totalram - memInfo.freeram - memInfo.bufferram) * memInfo.mem_unit / 1024 - getCachedSize()) / 1024; std::stringstream additionalinfo; - if (string.length() > 0) { - additionalinfo << " (" << string << ")"; + if (myString.length() > 0) { + additionalinfo << " (" << myString << ")"; } additionalinfo << ":" << std::endl; Log::global_log->info() << "Memory consumption" << additionalinfo.str(); diff --git a/src/io/Mkesfera.cpp b/src/io/Mkesfera.cpp index de3c9d7cd8..f227a3f4b2 100755 --- a/src/io/Mkesfera.cpp +++ b/src/io/Mkesfera.cpp @@ -20,8 +20,6 @@ //might be necessary to increase for exascale #define OVERLAPFACTOR 1.5 -using namespace std; -using Log::global_log; void MkesferaGenerator::readXML(XMLfileUnits& xmlconfig) { #define MAX(a, b) (((a) >= (b)) (a) : (b)); @@ -32,23 +30,23 @@ void MkesferaGenerator::readXML(XMLfileUnits& xmlconfig) { boxLength = length; } } - global_log->info() << "Box length: " << boxLength << endl; + Log::global_log->info() << "Box length: " << boxLength << std::endl; R_o = boxLength / 2; xmlconfig.getNodeValueReduced("outer-density", rho_o); - global_log->info() << "Outer density: " << rho_o << endl; + Log::global_log->info() << "Outer density: " << rho_o << std::endl; xmlconfig.getNodeValueReduced("droplet/radius", R_i); - global_log->info() << "Droplet radius: " << R_i << endl; + Log::global_log->info() << "Droplet radius: " << R_i << std::endl; xmlconfig.getNodeValueReduced("droplet/density", rho_i); - global_log->info() << "Droplet density: " << rho_i << endl; + Log::global_log->info() << "Droplet density: " << rho_i << std::endl; for(int d = 0; d < 3; d++) { center[d] = R_o; } xmlconfig.getNodeValueReduced("droplet/center/x", center[0]); xmlconfig.getNodeValueReduced("droplet/center/y", center[1]); xmlconfig.getNodeValueReduced("droplet/center/z", center[2]); - global_log->info() << "Droplet center: " << center[0] << ", " << center[0] << ", " << center[0] << endl; + Log::global_log->info() << "Droplet center: " << center[0] << ", " << center[0] << ", " << center[0] << std::endl; } unsigned long @@ -88,9 +86,9 @@ MkesferaGenerator::readPhaseSpace(ParticleContainer* particleContainer, Domain* } for(int d = 0; d < 3; d++) { - endx[d] = min(fl_units - 1, endx[d] + 1); + endx[d] = std::min(fl_units - 1, endx[d] + 1); - startx[d] = max(0, startx[d] - 1); + startx[d] = std::max(0, startx[d] - 1); fl_units_local[d] = endx[d] - startx[d] + 1; @@ -98,7 +96,7 @@ MkesferaGenerator::readPhaseSpace(ParticleContainer* particleContainer, Domain* } double T = _simulation.getEnsemble()->T(); - global_log->info() << "Temperature: " << T << endl; + Log::global_log->info() << "Temperature: " << T << std::endl; double cutoff = _simulation.getcutoffRadius(); Random* rnd = new Random(); @@ -120,10 +118,10 @@ MkesferaGenerator::readPhaseSpace(ParticleContainer* particleContainer, Domain* } unsigned slots = 3.0 * fl_units * fl_units * fl_units; double boxdensity = (double) slots / (8.0 * R_o * R_o * R_o); - global_log->debug() << "Box density: " << boxdensity << " (unit cell: " << fl_unit << ")" << endl; + Log::global_log->debug() << "Box density: " << boxdensity << " (unit cell: " << fl_unit << ")" << std::endl; double P_in = rho_i / boxdensity; double P_out = rho_o / boxdensity; - global_log->debug() << "Insertion probability: " << P_in << " inside, " << P_out << " outside" << endl; + Log::global_log->debug() << "Insertion probability: " << P_in << " inside, " << P_out << " outside" << std::endl; /* box min is assumed to be 0 (not in parallel!)*/ for(int d = 0; d < 3; d++) { @@ -176,7 +174,7 @@ MkesferaGenerator::readPhaseSpace(ParticleContainer* particleContainer, Domain* if(idx[0] - startx[0] >= fl_units_local[0] or idx[1] - startx[1] >= fl_units_local[1] or idx[2] - startx[2] >= fl_units_local[2] or startx[0] > idx[0] or startx[1] > idx[1] or startx[2] > idx[2]) { - global_log->error() << "Error in calculation of start and end values! \n"; + Log::global_log->error() << "Error in calculation of start and end values! \n"; Simulation::exit(0); } fill[idx[0] - startx[0]][idx[1] - startx[1]][idx[2] - startx[2]][p] = tfill; @@ -194,8 +192,8 @@ MkesferaGenerator::readPhaseSpace(ParticleContainer* particleContainer, Domain* MPI_Allreduce(MPI_IN_PLACE, &N, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); #endif - global_log->debug() << "Filling " << N << " out of " << slots << " slots" << endl; - global_log->debug() << "Density: " << N / (8.0 * R_o * R_o * R_o) << endl; + Log::global_log->debug() << "Filling " << N << " out of " << slots << " slots" << std::endl; + Log::global_log->debug() << "Density: " << N / (8.0 * R_o * R_o * R_o) << std::endl; double v_avg = sqrt(3.0 * T); @@ -213,7 +211,7 @@ MkesferaGenerator::readPhaseSpace(ParticleContainer* particleContainer, Domain* if(idx[0] >= startx[0] and idx[0] <= endx[0] and idx[1] >= startx[1] and idx[1] <= endx[1] and idx[2] >= startx[2] and idx[2] <= endx[2]) { if(fill[idx[0] - startx[0]][idx[1] - startx[1]][idx[2] - startx[2]][p]) { - //global_log->debug() << "Inserting: " << idx[0] << "," << idx[1] << "," << idx[2] << "; " << p << endl; + //global_log->debug() << "Inserting: " << idx[0] << "," << idx[1] << "," << idx[2] << "; " << p << std::endl; double q[3]; bool notInBox = false; for(int d = 0; d < 3; d++) { @@ -260,7 +258,7 @@ MkesferaGenerator::readPhaseSpace(ParticleContainer* particleContainer, Domain* domain->setglobalNumMolecules(numberOfMolecules); domain->setglobalRho(numberOfMolecules / _simulation.getEnsemble()->V()); - global_log->info() << "Inserted number of molecules: " << numberOfMolecules << endl; + Log::global_log->info() << "Inserted number of molecules: " << numberOfMolecules << std::endl; return ID; } diff --git a/src/io/MmpldWriter.cpp b/src/io/MmpldWriter.cpp index 6b26c11f01..6c3019b468 100644 --- a/src/io/MmpldWriter.cpp +++ b/src/io/MmpldWriter.cpp @@ -36,8 +36,6 @@ #define MMPLD_HEADER_DATA_SIZE 60 #define MMPLD_SEEK_TABLE_OFFSET MMPLD_HEADER_DATA_SIZE -using Log::global_log; - std::string MmpldWriter::getOutputFilename() { std::stringstream filenamestream; filenamestream << _outputPrefix << "_" << fill_width('0', 4) << _fileCount << ".mmpld"; @@ -76,11 +74,11 @@ void MmpldWriter::readXML(XMLfileUnits& xmlconfig) xmlconfig.getNodeValue("writecontrol/stop", _stopTimestep); xmlconfig.getNodeValue("writecontrol/framesperfile", _numFramesPerFile); xmlconfig.getNodeValue("writecontrol/writeBufferSize", _writeBufferSize); - global_log->info() << "[MMPLD Writer] Start sampling from simstep: " << _startTimestep << std::endl; - global_log->info() << "[MMPLD Writer] Write with frequency: " << _writeFrequency << std::endl; - global_log->info() << "[MMPLD Writer] Stop sampling at simstep: " << _stopTimestep << std::endl; - global_log->info() << "[MMPLD Writer] Split files every " << _numFramesPerFile << "th frame."<< std::endl; - global_log->info() << "[MMPLD Writer] Write buffer size: " << _writeBufferSize << " Byte" << std::endl; + Log::global_log->info() << "[MMPLD Writer] Start sampling from simstep: " << _startTimestep << std::endl; + Log::global_log->info() << "[MMPLD Writer] Write with frequency: " << _writeFrequency << std::endl; + Log::global_log->info() << "[MMPLD Writer] Stop sampling at simstep: " << _stopTimestep << std::endl; + Log::global_log->info() << "[MMPLD Writer] Split files every " << _numFramesPerFile << "th frame."<< std::endl; + Log::global_log->info() << "[MMPLD Writer] Write buffer size: " << _writeBufferSize << " Byte" << std::endl; int mmpldversion = 100; xmlconfig.getNodeValue("mmpldversion", mmpldversion); @@ -90,23 +88,23 @@ void MmpldWriter::readXML(XMLfileUnits& xmlconfig) case 102: break; default: - global_log->error() << "Unsupported MMPLD version:" << _mmpldversion << std::endl; + Log::global_log->error() << "Unsupported MMPLD version:" << _mmpldversion << std::endl; Simulation::exit(1); break; } xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "[MMPLD Writer] Output prefix: " << _outputPrefix << std::endl; + Log::global_log->info() << "[MMPLD Writer] Output prefix: " << _outputPrefix << std::endl; // sphere params: radius, colors uint32_t numSites = 0; XMLfile::Query query = xmlconfig.query("spheres/site"); numSites = query.card(); - global_log->info() << "[MMPLD Writer] Number of sites: " << numSites << std::endl; + Log::global_log->info() << "[MMPLD Writer] Number of sites: " << numSites << std::endl; if(numSites < 1) { - global_log->fatal() << "[MMPLD Writer] No site parameters specified." << std::endl; + Log::global_log->fatal() << "[MMPLD Writer] No site parameters specified." << std::endl; Simulation::exit(48973); } - string oldpath = xmlconfig.getcurrentnodepath(); + std::string oldpath = xmlconfig.getcurrentnodepath(); XMLfile::Query::const_iterator outputSiteIter; for( outputSiteIter = query.begin(); outputSiteIter; outputSiteIter++ ) { @@ -131,10 +129,10 @@ void MmpldWriter::readXML(XMLfileUnits& xmlconfig) if(xmlconfig.changecurrentnode("mpi_info")) { #ifdef ENABLE_MPI - global_log->info() << "[MMPLD Writer] Setting MPI info object for IO" << std::endl; + Log::global_log->info() << "[MMPLD Writer] Setting MPI info object for IO" << std::endl; _mpiinfo.readXML(xmlconfig); #else - global_log->info() << "[MMPLD Writer] mpi_info only used in parallel/MPI version" << std::endl; + Log::global_log->info() << "[MMPLD Writer] mpi_info only used in parallel/MPI version" << std::endl; #endif xmlconfig.changecurrentnode(".."); } @@ -150,7 +148,7 @@ void MmpldWriter::init(ParticleContainer *particleContainer, _frameCount = 0; // number of components / sites - vector *components = global_simulation->getEnsemble()->getComponents(); + std::vector *components = global_simulation->getEnsemble()->getComponents(); _numComponents = components->size(); _numSitesPerComp.resize(_numComponents); _nCompSitesOffset.resize(_numComponents); @@ -162,16 +160,16 @@ void MmpldWriter::init(ParticleContainer *particleContainer, int numSites = component.numLJcenters(); _numSitesPerComp.at(cid) = numSites; _nCompSitesOffset.at(cid) = _numSitesTotal; /* offset is total number of sites so far */ - global_log->debug() << "[MMPLD Writer] Component[" << cid << "] numSites=" << numSites << " offset=" << unsigned(_nCompSitesOffset.at(cid)) << std::endl; + Log::global_log->debug() << "[MMPLD Writer] Component[" << cid << "] numSites=" << numSites << " offset=" << unsigned(_nCompSitesOffset.at(cid)) << std::endl; _numSitesTotal += numSites; } - global_log->debug() << "[MMPLD Writer] Total number of sites taken into account: " << unsigned(_numSitesTotal) << std::endl; + Log::global_log->debug() << "[MMPLD Writer] Total number of sites taken into account: " << unsigned(_numSitesTotal) << std::endl; // init radius and color of spheres this->InitSphereData(); this->SetNumSphereTypes(); - string filename = getOutputFilename(); + std::string filename = getOutputFilename(); uint8_t magicIdentifier[6] = {0x4D, 0x4D, 0x50, 0x4C, 0x44, 0x00}; // format marker uint16_t mmpldversion_le = htole16(_mmpldversion); uint32_t numframes = _numFramesPerFile; // number of frames @@ -184,11 +182,11 @@ void MmpldWriter::init(ParticleContainer *particleContainer, int rank = domainDecomp->getRank(); if (rank == 0){ #endif - ofstream mmpldfstream(filename.c_str(), ios::binary|ios::out); + std::ofstream mmpldfstream(filename.c_str(), std::ios::binary|std::ios::out); mmpldfstream.write((char*)magicIdentifier, sizeof(magicIdentifier)); mmpldfstream.write((char*)&mmpldversion_le, sizeof(mmpldversion_le)); mmpldfstream.write((char*)&numframes_le,sizeof(numframes_le)); - global_log->debug() << "[MMPLD Writer] Writing bounding box data." << std::endl; + Log::global_log->debug() << "[MMPLD Writer] Writing bounding box data." << std::endl; float minbox[3] = {0, 0, 0}; float maxbox[3]; for (unsigned short d = 0; d < 3; ++d) { @@ -196,7 +194,7 @@ void MmpldWriter::init(ParticleContainer *particleContainer, } mmpldfstream.write((char*)minbox, sizeof(minbox)); mmpldfstream.write((char*)maxbox, sizeof(maxbox)); - global_log->debug() << "[MMPLD Writer] Writing clipping box data." << std::endl; + Log::global_log->debug() << "[MMPLD Writer] Writing clipping box data." << std::endl; float inflateRadius = 0; for(auto radius : _global_radius) { if(inflateRadius < radius ) { @@ -209,7 +207,7 @@ void MmpldWriter::init(ParticleContainer *particleContainer, } mmpldfstream.write((char*)minbox, sizeof(minbox)); mmpldfstream.write((char*)maxbox, sizeof(maxbox)); - global_log->debug() << "[MMPLD Writer] Preallocating " << _numSeekEntries << " seek table entries for frames" << std::endl; + Log::global_log->debug() << "[MMPLD Writer] Preallocating " << _numSeekEntries << " seek table entries for frames" << std::endl; for (uint32_t i = 0; i < _numSeekEntries; ++i) { uint64_t offset_le = htole64(_seekTable.at(i)); mmpldfstream.write((char*) &offset_le, sizeof(offset_le)); @@ -222,7 +220,7 @@ void MmpldWriter::init(ParticleContainer *particleContainer, void MmpldWriter::write_frame(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp) { - string filename = getOutputFilename(); + std::string filename = getOutputFilename(); // calculate local number of spheres per component|siteType std::vector numSpheresPerType(_numSphereTypes); @@ -314,14 +312,14 @@ void MmpldWriter::endStep(ParticleContainer *particleContainer, MultiFileApproachReset(particleContainer, domainDecomp, domain); // begin new file } - string filename = getOutputFilename(); - global_log->debug() << "[MMPLD Writer] Writing MMPLD frame " << _frameCount << " for simstep " << simstep << " to file " << filename << std::endl; + std::string filename = getOutputFilename(); + Log::global_log->debug() << "[MMPLD Writer] Writing MMPLD frame " << _frameCount << " for simstep " << simstep << " to file " << filename << std::endl; write_frame(particleContainer, domainDecomp); } void MmpldWriter::finish(ParticleContainer * /*particleContainer*/, DomainDecompBase *domainDecomp, Domain * /*domain*/) { - string filename = getOutputFilename(); + std::string filename = getOutputFilename(); #ifdef ENABLE_MPI int rank = domainDecomp->getRank(); @@ -392,10 +390,10 @@ void MmpldWriter::PrepareWriteControl() _stopTimestep = std::min(_stopTimestep, _simulation.getNumTimesteps()); - global_log->info() << "[MMPLD Writer] Setting start:stop to " << _startTimestep << ":" << _stopTimestep << std::endl; + Log::global_log->info() << "[MMPLD Writer] Setting start:stop to " << _startTimestep << ":" << _stopTimestep << std::endl; if(_stopTimestep < _startTimestep) { - global_log->warning() << "[MMPLD Writer] Invalid time interval. No frames will be recorded!" << std::endl; + Log::global_log->warning() << "[MMPLD Writer] Invalid time interval. No frames will be recorded!" << std::endl; return; } @@ -416,7 +414,7 @@ long MmpldWriter::get_data_frame_header_size() { data_frame_header_size = sizeof(float) + sizeof(uint32_t); break; default: - global_log->error() << "[MMPLD Writer] Unsupported MMPLD version: " << _mmpldversion << std::endl; + Log::global_log->error() << "[MMPLD Writer] Unsupported MMPLD version: " << _mmpldversion << std::endl; Simulation::exit(1); break; } diff --git a/src/io/MmpldWriter.h b/src/io/MmpldWriter.h index b5e0ffc3d7..fdf0abcfcc 100644 --- a/src/io/MmpldWriter.h +++ b/src/io/MmpldWriter.h @@ -75,7 +75,7 @@ class MmpldWriter : public PluginBase ); void finish(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain); - + std::string getPluginName() { return std::string("MmpldWriter"); } diff --git a/src/io/MmspdBinWriter.cpp b/src/io/MmspdBinWriter.cpp index d3f85c8648..c27b56473c 100644 --- a/src/io/MmspdBinWriter.cpp +++ b/src/io/MmspdBinWriter.cpp @@ -15,10 +15,8 @@ #include "Simulation.h" #include "utils/Logger.h" -using Log::global_log; -using namespace std; -MmspdBinWriter::MmspdBinWriter(unsigned long writeFrequency, string outputPrefix) { +MmspdBinWriter::MmspdBinWriter(unsigned long writeFrequency, std::string outputPrefix) { _outputPrefix = outputPrefix; _writeFrequency = writeFrequency; @@ -35,23 +33,23 @@ MmspdBinWriter::~MmspdBinWriter(){} void MmspdBinWriter::readXML(XMLfileUnits& xmlconfig) { _writeFrequency = 1; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "Write frequency: " << _writeFrequency << endl; + Log::global_log->info() << "Write frequency: " << _writeFrequency << std::endl; _outputPrefix = "mardyn"; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "Output prefix: " << _outputPrefix << endl; - + Log::global_log->info() << "Output prefix: " << _outputPrefix << std::endl; + int appendTimestamp = 0; xmlconfig.getNodeValue("appendTimestamp", appendTimestamp); if(appendTimestamp > 0) { _appendTimestamp = true; } - global_log->info() << "Append timestamp: " << _appendTimestamp << endl; + Log::global_log->info() << "Append timestamp: " << _appendTimestamp << std::endl; } void MmspdBinWriter::init(ParticleContainer * /*particleContainer*/, DomainDecompBase *domainDecomp, Domain *domain) { - stringstream filenamestream; + std::stringstream filenamestream; filenamestream << _outputPrefix; if(_appendTimestamp) { @@ -66,7 +64,7 @@ void MmspdBinWriter::init(ParticleContainer * /*particleContainer*/, int rank = domainDecomp->getRank(); if (rank == 0){ #endif - ofstream mmspdfstream(filename.data(), ios::binary|ios::out); + std::ofstream mmspdfstream(filename.data(), std::ios::binary|std::ios::out); // format marker mmspdfstream << "MMSPDb"; @@ -79,7 +77,7 @@ void MmspdBinWriter::init(ParticleContainer * /*particleContainer*/, unsigned short version[2] = {1, 0}; mmspdfstream.write((char*)&version,sizeof(version)); - + unsigned char padend = 128; for(int i=0; i<4; ++i) mmspdfstream.write((char*)&padend,sizeof(padend)); @@ -164,8 +162,8 @@ void MmspdBinWriter::init(ParticleContainer * /*particleContainer*/, else { mmspdfstream << "**************** Error: Unspecified component!*************\n Possible reason: more than 5 components?\n"; } - } // end of particle definitions - + } // end of particle definitions + mmspdfstream.close(); #ifdef ENABLE_MPI } @@ -176,14 +174,14 @@ void MmspdBinWriter::endStep(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain, unsigned long simstep){ if (simstep % _writeFrequency == 0) { - stringstream filenamestream, outputstream; + std::stringstream filenamestream, outputstream; filenamestream << _outputPrefix; if(_appendTimestamp) { filenamestream << "-" << gettimestring(); } filenamestream << ".mmspd"; - + std::vector filename(filenamestream.str().size()+1); strcpy(filename.data(),filenamestream.str().c_str()); @@ -224,7 +222,7 @@ void MmspdBinWriter::endStep(ParticleContainer *particleContainer, offset += outputsize_get; } - global_log->debug() << "MmspdBinWriter rank: " << rank << "; step: " << simstep << "; offset: " << offset << endl; + Log::global_log->debug() << "MmspdBinWriter rank: " << rank << "; step: " << simstep << "; offset: " << offset << std::endl; MPI_File_seek(fh, offset, MPI_SEEK_END); diff --git a/src/io/MmspdBinWriter.h b/src/io/MmspdBinWriter.h index e275eeb253..d5588f9d7e 100644 --- a/src/io/MmspdBinWriter.h +++ b/src/io/MmspdBinWriter.h @@ -33,7 +33,7 @@ class MmspdBinWriter : public PluginBase{ ); void finish(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain); - + std::string getPluginName() { return std::string("MmspdBinWriter"); } diff --git a/src/io/MmspdWriter.cpp b/src/io/MmspdWriter.cpp index d75107b4ac..5d85c6aa02 100644 --- a/src/io/MmspdWriter.cpp +++ b/src/io/MmspdWriter.cpp @@ -15,10 +15,8 @@ #include "Simulation.h" #include "utils/Logger.h" -using Log::global_log; -using namespace std; -MmspdWriter::MmspdWriter(unsigned long writeFrequency, string outputPrefix) { +MmspdWriter::MmspdWriter(unsigned long writeFrequency, std::string outputPrefix) { _outputPrefix = outputPrefix; _writeFrequency = writeFrequency; @@ -36,18 +34,18 @@ MmspdWriter::~MmspdWriter(){} void MmspdWriter::readXML(XMLfileUnits& xmlconfig) { _writeFrequency = 1; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "Write frequency: " << _writeFrequency << endl; + Log::global_log->info() << "Write frequency: " << _writeFrequency << std::endl; _outputPrefix = "mardyn"; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "Output prefix: " << _outputPrefix << endl; + Log::global_log->info() << "Output prefix: " << _outputPrefix << std::endl; int appendTimestamp = 0; xmlconfig.getNodeValue("appendTimestamp", appendTimestamp); if(appendTimestamp > 0) { _appendTimestamp = true; } - global_log->info() << "Append timestamp: " << _appendTimestamp << endl; + Log::global_log->info() << "Append timestamp: " << _appendTimestamp << std::endl; } void MmspdWriter::init(ParticleContainer * /*particleContainer*/, @@ -56,7 +54,7 @@ void MmspdWriter::init(ParticleContainer * /*particleContainer*/, int rank = domainDecomp->getRank(); if (rank == 0){ #endif - stringstream filenamestream; + std::stringstream filenamestream; filenamestream << _outputPrefix; if(_appendTimestamp) { @@ -64,57 +62,57 @@ void MmspdWriter::init(ParticleContainer * /*particleContainer*/, } filenamestream << ".mmspd"; _filename = filenamestream.str(); - ofstream mmspdfstream(_filename.c_str(), ios::binary|ios::out); - - + std::ofstream mmspdfstream(_filename.c_str(), std::ios::binary|std::ios::out); + + /* writing the header of the mmspd file, i.e. writing the BOM, the format marker (UTF-8), the header line and defining the particle types */ // BOM short int bom1,bom2,bom3; bom1 = 0xef; bom2 = 0xbb; bom3 = 0xbf; - + mmspdfstream.write(reinterpret_cast(& bom1), 1); mmspdfstream.write(reinterpret_cast(& bom2), 1); mmspdfstream.write(reinterpret_cast(& bom3), 1); - + // format marker mmspdfstream << "MMSPDu 1.0" << "\n"; // header line unsigned long numTimesteps = _simulation.getNumTimesteps(); mmspdfstream << "1 " << "0 0 0 " << domain->getGlobalLength(0) <<" "<< domain->getGlobalLength(1)<< " " << domain->getGlobalLength(2) << " " << numTimesteps / _writeFrequency+1 << " " << domain-> getNumberOfComponents() << " " << "0" << "\n"; - - - - /*mmspdfstream << "1 " << particleContainer->getBoundingBoxMin(0) << " " << particleContainer->getBoundingBoxMin(1) << " " - << particleContainer->getBoundingBoxMin(2) << " " << particleContainer->getBoundingBoxMax(0) << " " + + + + /*mmspdfstream << "1 " << particleContainer->getBoundingBoxMin(0) << " " << particleContainer->getBoundingBoxMin(1) << " " + << particleContainer->getBoundingBoxMin(2) << " " << particleContainer->getBoundingBoxMax(0) << " " << particleContainer->getBoundingBoxMax(1) << " " << particleContainer->getBoundingBoxMax(2) << " " << _numberOfTimesteps / _writeFrequency+1 << " " << domain-> getNumberOfComponents() << " " << "0" << "\n";*/ - + // particle definitions every single line specifies a particular particle type for(unsigned i = 0; i < domain->getNumberOfComponents() ; i++){ if (i == 0){ - mmspdfstream << "s 4 3 cr b 255 cg b 0 cb b 0 r f "; + mmspdfstream << "s 4 3 cr b 255 cg b 0 cb b 0 r f "; } else if (i == 1){ - mmspdfstream << "s 4 3 cr b 0 cg b 102 cb b 0 r f "; + mmspdfstream << "s 4 3 cr b 0 cg b 102 cb b 0 r f "; } else if (i == 2){ - mmspdfstream << "s 4 3 cr b 0 cg b 255 cb b 255 r f "; + mmspdfstream << "s 4 3 cr b 0 cg b 255 cb b 255 r f "; } else if(i == 3){ - mmspdfstream << "s 4 3 cr b 150 cg b 0 cb b 150 r f "; + mmspdfstream << "s 4 3 cr b 150 cg b 0 cb b 150 r f "; } else if (i == 4){ - mmspdfstream << "s 4 3 cr b 100 cg b 100 cb b 100 r f "; + mmspdfstream << "s 4 3 cr b 100 cg b 100 cb b 100 r f "; } else { - mmspdfstream << "**************** Error: Unspecified component!*************\n Possible reason: more than 5 components?\n"; + mmspdfstream << "**************** Error: Unspecified component!*************\n Possible reason: more than 5 components?\n"; } - mmspdfstream<< setprecision(4) << domain->getSigma(i,0)*0.7 << " x f y f z f" << "\n"; - } // end of particle definitions - + mmspdfstream<< std::setprecision(4) << domain->getSigma(i,0)*0.7 << " x f y f z f" << "\n"; + } // end of particle definitions + mmspdfstream.close(); #ifdef ENABLE_MPI } @@ -131,7 +129,7 @@ void MmspdWriter::endStep(ParticleContainer *particleContainer, int tag = 4711; if (rank == 0){ #endif - ofstream mmspdfstream(_filename.c_str(), ios::out|ios::app); + std::ofstream mmspdfstream(_filename.c_str(), std::ios::out|std::ios::app); mmspdfstream << "> " << globalNumMolecules << "\n"; for (auto pos = particleContainer->iterator(ParticleIterator::ONLY_INNER_AND_BOUNDARY); pos.isValid(); ++pos) { bool halo = false; @@ -142,9 +140,9 @@ void MmspdWriter::endStep(ParticleContainer *particleContainer, } } if (!halo) { - mmspdfstream << setiosflags(ios::fixed) << setw(8) << pos->getID() << setw(3) - << pos->componentid() << setprecision(3) << " "; - for (unsigned short d = 0; d < 3; d++) mmspdfstream << setw(7) << pos->r(d) << " " ; + mmspdfstream << setiosflags(std::ios::fixed) << std::setw(8) << pos->getID() << std::setw(3) + << pos->componentid() << std::setprecision(3) << " "; + for (unsigned short d = 0; d < 3; d++) mmspdfstream << std::setw(7) << pos->r(d) << " " ; mmspdfstream << "\n"; } } @@ -157,7 +155,7 @@ void MmspdWriter::endStep(ParticleContainer *particleContainer, MPI_Get_count(&status_probe, MPI_CHAR, &numchars); char *recvbuff = new char[numchars]; MPI_Recv(recvbuff, numchars, MPI_CHAR, fromrank, tag, MPI_COMM_WORLD, &status_recv); - mmspdfstream << string(recvbuff); + mmspdfstream << std::string(recvbuff); delete[] recvbuff; } #endif @@ -165,7 +163,7 @@ void MmspdWriter::endStep(ParticleContainer *particleContainer, #ifdef ENABLE_MPI } else { - stringstream mmspdfstream; + std::stringstream mmspdfstream; for (auto pos = particleContainer->iterator(ParticleIterator::ONLY_INNER_AND_BOUNDARY); pos.isValid(); ++pos) { bool halo = false; for (unsigned short d = 0; d < 3; d++) { @@ -175,14 +173,14 @@ void MmspdWriter::endStep(ParticleContainer *particleContainer, } } if (!halo) { - mmspdfstream << setiosflags(ios::fixed) << setw(8) << pos->getID() << setw(3) - << pos->componentid() << setprecision(3) << " "; - for (unsigned short d = 0; d < 3; d++) mmspdfstream << setw(7) << pos->r(d) << " " ; + mmspdfstream << setiosflags(std::ios::fixed) << std::setw(8) << pos->getID() << std::setw(3) + << pos->componentid() << std::setprecision(3) << " "; + for (unsigned short d = 0; d < 3; d++) mmspdfstream << std::setw(7) << pos->r(d) << " " ; mmspdfstream << "\n"; } } - - string sendbuff; + + std::string sendbuff; sendbuff = mmspdfstream.str(); MPI_Send(sendbuff.c_str(), sendbuff.length() + 1, MPI_CHAR, 0, tag, MPI_COMM_WORLD); } diff --git a/src/io/MmspdWriter.h b/src/io/MmspdWriter.h index 31c29d7470..3758b9b3d3 100644 --- a/src/io/MmspdWriter.h +++ b/src/io/MmspdWriter.h @@ -21,7 +21,7 @@ class MmspdWriter : public PluginBase{ //! @param writeFrequency Controls the frequency of writing out the data (every timestep, every 10th, 100th, ... timestep) MmspdWriter(unsigned long writeFrequency, std::string outputPrefix); ~MmspdWriter(); - + void readXML(XMLfileUnits& xmlconfig); void init(ParticleContainer *particleContainer, diff --git a/src/io/MultiObjectGenerator.cpp b/src/io/MultiObjectGenerator.cpp index 2c0367c3cf..b5459c7da7 100644 --- a/src/io/MultiObjectGenerator.cpp +++ b/src/io/MultiObjectGenerator.cpp @@ -23,9 +23,6 @@ #include "utils/xmlfileUnits.h" -using Log::global_log; -using namespace std; - MultiObjectGenerator::MultiObjectGenerator::~MultiObjectGenerator() { for(auto& generator : _generators) { delete generator; @@ -36,8 +33,8 @@ MultiObjectGenerator::MultiObjectGenerator::~MultiObjectGenerator() { void MultiObjectGenerator::readXML(XMLfileUnits& xmlconfig) { XMLfile::Query query = xmlconfig.query("objectgenerator"); - global_log->info() << "Number of sub-objectgenerators: " << query.card() << endl; - string oldpath = xmlconfig.getcurrentnodepath(); + Log::global_log->info() << "Number of sub-objectgenerators: " << query.card() << std::endl; + std::string oldpath = xmlconfig.getcurrentnodepath(); for(auto generatorIter = query.begin(); generatorIter; ++generatorIter) { xmlconfig.changecurrentnode(generatorIter); ObjectGenerator* generator = new ObjectGenerator(); @@ -59,12 +56,12 @@ unsigned long MultiObjectGenerator::readPhaseSpace(ParticleContainer* particleCo numMolecules += generator->readPhaseSpace(particleContainer, domain, domainDecomp); } particleContainer->updateMoleculeCaches(); - global_log->info() << "Number of locally inserted molecules: " << numMolecules << endl; + Log::global_log->info() << "Number of locally inserted molecules: " << numMolecules << std::endl; _globalNumMolecules = numMolecules; #ifdef ENABLE_MPI MPI_Allreduce(MPI_IN_PLACE, &_globalNumMolecules, 1, MPI_UNSIGNED_LONG, MPI_SUM, domainDecomp->getCommunicator()); #endif - global_log->info() << "Number of globally inserted molecules: " << _globalNumMolecules << endl; + Log::global_log->info() << "Number of globally inserted molecules: " << _globalNumMolecules << std::endl; //! @todo Get rid of the domain class calls at this place here... return _globalNumMolecules; } diff --git a/src/io/ODF.cpp b/src/io/ODF.cpp index dff6b11a70..fb426bc7ce 100644 --- a/src/io/ODF.cpp +++ b/src/io/ODF.cpp @@ -4,23 +4,23 @@ #include "WrapOpenMP.h" void ODF::readXML(XMLfileUnits& xmlconfig) { - global_log->debug() << "[ODF] enabled. Dipole orientations must be set to [0 0 1]!" << std::endl; + Log::global_log->debug() << "[ODF] enabled. Dipole orientations must be set to [0 0 1]!" << std::endl; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "[ODF] Write frequency: " << _writeFrequency << endl; + Log::global_log->info() << "[ODF] Write frequency: " << _writeFrequency << std::endl; xmlconfig.getNodeValue("initstatistics", _initStatistics); - global_log->info() << "[ODF] Init Statistics: " << _initStatistics << endl; + Log::global_log->info() << "[ODF] Init Statistics: " << _initStatistics << std::endl; xmlconfig.getNodeValue("recordingtimesteps", _recordingTimesteps); - global_log->info() << "[ODF] Recording Timesteps: " << _recordingTimesteps << endl; + Log::global_log->info() << "[ODF] Recording Timesteps: " << _recordingTimesteps << std::endl; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "[ODF] Output prefix: " << _outputPrefix << endl; + Log::global_log->info() << "[ODF] Output prefix: " << _outputPrefix << std::endl; xmlconfig.getNodeValue("phi1increments", _phi1Increments); - global_log->info() << "[ODF] Phi1 increments: " << _phi1Increments << endl; + Log::global_log->info() << "[ODF] Phi1 increments: " << _phi1Increments << std::endl; xmlconfig.getNodeValue("phi2increments", _phi2Increments); - global_log->info() << "[ODF] Phi2 increments: " << _phi2Increments << endl; + Log::global_log->info() << "[ODF] Phi2 increments: " << _phi2Increments << std::endl; xmlconfig.getNodeValue("gammaincrements", _gammaIncrements); - global_log->info() << "[ODF] Gamma increments: " << _gammaIncrements << endl; + Log::global_log->info() << "[ODF] Gamma increments: " << _gammaIncrements << std::endl; xmlconfig.getNodeValue("shellcutoff", _shellCutOff); - global_log->info() << "[ODF] Shell cutoff: " << _shellCutOff << endl; + Log::global_log->info() << "[ODF] Shell cutoff: " << _shellCutOff << std::endl; } void ODF::init(ParticleContainer* particleContainer, DomainDecompBase* /*domainDecomp*/, Domain* domain) { @@ -41,7 +41,7 @@ void ODF::init(ParticleContainer* particleContainer, DomainDecompBase* /*domainD if (isDipole[i] == 1) { bool orientationIsCorrect = ci.dipole(0).e() == std::array{0,0,1}; if(orientationIsCorrect == false){ - global_log->error() << "Wrong dipole vector chosen! Please always choose [eMyx eMyy eMyz] = [0 0 1] when using the ODF plugin" << endl; + Log::global_log->error() << "Wrong dipole vector chosen! Please always choose [eMyx eMyy eMyz] = [0 0 1] when using the ODF plugin" << std::endl; } numPairs++; } @@ -49,8 +49,8 @@ void ODF::init(ParticleContainer* particleContainer, DomainDecompBase* /*domainD _numPairs = numPairs * numPairs; _numElements = _phi1Increments * _phi2Increments * _gammaIncrements + 1; - global_log->info() << "ODF arrays contains " << _numElements << " elements each for " << _numPairs << "pairings" - << endl; + Log::global_log->info() << "ODF arrays contains " << _numElements << " elements each for " << _numPairs << "pairings" + << std::endl; _ODF11.resize(_numElements); _ODF12.resize(_numElements); _ODF21.resize(_numElements); @@ -69,10 +69,10 @@ void ODF::init(ParticleContainer* particleContainer, DomainDecompBase* /*domainD resize2D(_threadLocalODF22, mardyn_get_max_threads(), _numElements); if (_numPairs < 1) { - global_log->error() << "No components with dipoles. ODF's not being calculated!" << endl; + Log::global_log->error() << "No components with dipoles. ODF's not being calculated!" << std::endl; } else if (_numPairs > 4) { - global_log->error() - << "Number of pairings for ODF calculation too high. Current maximum number of ODF pairings is 4." << endl; + Log::global_log->error() + << "Number of pairings for ODF calculation too high. Current maximum number of ODF pairings is 4." << std::endl; } reset(); @@ -102,7 +102,7 @@ void ODF::endStep(ParticleContainer* /*particleContainer*/, DomainDecompBase* do } void ODF::reset() { - global_log->info() << "[ODF] resetting data sets" << endl; + Log::global_log->info() << "[ODF] resetting data sets" << std::endl; // // C++ 14: // auto fillZero = [](auto& vec) {std::fill(vec.begin(), vec.end(), 0);}; @@ -120,20 +120,20 @@ void ODF::reset() { std::for_each(_threadLocalODF22.begin(), _threadLocalODF22.end(), fillZero); } -void ODF::calculateOrientation(const array& simBoxSize, const Molecule& mol1, const Molecule& mol2, - const array& orientationVector1) { +void ODF::calculateOrientation(const std::array& simBoxSize, const Molecule& mol1, const Molecule& mol2, + const std::array& orientationVector1) { // TODO Implement rotation matrices to calculate orientations for dipole direction unit vectors other than [0 0 1]; - - double Quaternion2[4], orientationVector2[3], distanceVector12[3], moleculeDistance1D[3], auxiliaryVector1[3], auxiliaryVector2[3], projectionVector1[3], projectionVector2[3]; + + double Quaternion2[4], orientationVector2[3], distanceVector12[3], moleculeDistance1D[3], auxiliaryVector1[3], auxiliaryVector2[3], projectionVector1[3], projectionVector2[3]; auto cid = mol1.getComponentLookUpID(); double cosPhi1, cosPhi2, cosGamma12, Gamma12, absoluteProjection1, absoluteProjection2, absoluteDistanceVector12/*, shellCutoff = _shellCutOff[cid]*/; double roundingThreshold = 0.0001; unsigned long indexPhi1, indexPhi2, indexGamma12, elementID, elementIDreversed; unsigned maximumIncrements; - bool assignPhi1, assignPhi2, assignGamma12; + bool assignPhi1, assignPhi2, assignGamma12; + - double distanceSquared = 0.; // Determine modular distance between molecules for (int i = 0; i < 3; i++) { @@ -143,7 +143,7 @@ void ODF::calculateOrientation(const array& simBoxSize, const Molecul } distanceSquared += moleculeDistance1D[i] * moleculeDistance1D[i]; } - + /*if (_mixingRule == 1) { shellCutoff = 1. / 2. * _shellCutOff[cid] + _shellCutOff[mol2.getComponentLookUpID()]; }*/ @@ -193,7 +193,7 @@ void ODF::calculateOrientation(const array& simBoxSize, const Molecul orientationVector2[2] = 1 - 2 * (Quaternion2[1] * Quaternion2[1] + Quaternion2[2] * Quaternion2[2]); // calculate projection of the vectors onto plane perpendicular to the distance vector with cross product for calculation of the torque angle gamma - + auxiliaryVector1[0] = orientationVector1[1] * distanceVector12[2] - orientationVector1[2] * distanceVector12[1]; auxiliaryVector1[1] = orientationVector1[2] * distanceVector12[0] - orientationVector1[0] * distanceVector12[2]; auxiliaryVector1[2] = orientationVector1[0] * distanceVector12[1] - orientationVector1[1] * distanceVector12[0]; @@ -242,13 +242,13 @@ void ODF::calculateOrientation(const array& simBoxSize, const Molecul } Gamma12 = acos(cosGamma12); - + // determine array element // NOTE: element 0 of array ODF is unused - maximumIncrements = max(_phi1Increments, _phi2Increments); - maximumIncrements = max(maximumIncrements, _gammaIncrements); - + maximumIncrements = std::max(_phi1Increments, _phi2Increments); + maximumIncrements = std::max(maximumIncrements, _gammaIncrements); + // calculate indices for phi1, phi2 and gamma12 for bin assignment for (unsigned i = 0; i < maximumIncrements; i++) { if (1. - i * 2. / (double)_phi1Increments >= cosPhi1 && @@ -291,19 +291,19 @@ void ODF::calculateOrientation(const array& simBoxSize, const Molecul // notification if anything goes wrong during calculataion if (assignPhi1 == 0 || assignPhi2 == 0 || assignGamma12 == 0) { - global_log->warning() << "Array element in ODF calculation not properly assigned!" << endl; - global_log->warning() << "Mol-ID 1 = " << mol1.getID() << " Mol-ID 2 = " << mol2.getID() << endl; - global_log->warning() << "orientationVector1=" << orientationVector1[0] << " " << orientationVector1[1] << " " << orientationVector1[2] << " " << endl; - global_log->warning() << "orientationVector2=" << orientationVector2[0] << " " << orientationVector2[1] << " " << orientationVector2[2] << " " << endl; - global_log->warning() << "distanceVector12=" << distanceVector12[0] << " " << distanceVector12[1] << " " << distanceVector12[2] << " " << endl; - global_log->warning() << "[cosphi1 cosphi2 cosgamma12] = [" << cosPhi1 << " " << cosPhi2 << " " - << cosGamma12 << "]" << endl; - global_log->warning() << "indices are " << indexPhi1 << " " << indexPhi2 << " " << indexGamma12 << endl; + Log::global_log->warning() << "Array element in ODF calculation not properly assigned!" << std::endl; + Log::global_log->warning() << "Mol-ID 1 = " << mol1.getID() << " Mol-ID 2 = " << mol2.getID() << std::endl; + Log::global_log->warning() << "orientationVector1=" << orientationVector1[0] << " " << orientationVector1[1] << " " << orientationVector1[2] << " " << std::endl; + Log::global_log->warning() << "orientationVector2=" << orientationVector2[0] << " " << orientationVector2[1] << " " << orientationVector2[2] << " " << std::endl; + Log::global_log->warning() << "distanceVector12=" << distanceVector12[0] << " " << distanceVector12[1] << " " << distanceVector12[2] << " " << std::endl; + Log::global_log->warning() << "[cosphi1 cosphi2 cosgamma12] = [" << cosPhi1 << " " << cosPhi2 << " " + << cosGamma12 << "]" << std::endl; + Log::global_log->warning() << "indices are " << indexPhi1 << " " << indexPhi2 << " " << indexGamma12 << std::endl; } - + // assignment of bin ID elementID = indexPhi1 * _phi2Increments * _gammaIncrements + (indexPhi2 * _gammaIncrements) + indexGamma12; - elementIDreversed = indexPhi2 * _phi2Increments * _gammaIncrements + (indexPhi1 * _gammaIncrements) + indexGamma12; + elementIDreversed = indexPhi2 * _phi2Increments * _gammaIncrements + (indexPhi1 * _gammaIncrements) + indexGamma12; //the ODFcellProcessor calculates every particle interaction only once. Therefore the reverse interaction is considered here as well // determine component pairing and add to bin @@ -384,34 +384,34 @@ void ODF::collect(DomainDecompBase* domainDecomp) { } void ODF::output(Domain* /*domain*/, long unsigned timestep) { - global_log->info() << "[ODF] writing output" << std::endl; + Log::global_log->info() << "[ODF] writing output" << std::endl; // Setup outfile constexpr double piHalf = 0.5 * M_PI; double cosPhi1 = 1. + 1. / (double)_phi1Increments; double cosPhi2 = 1. - 2. / _phi2Increments; double Gamma12 = 0.; double averageODF11 = 0.; - string prefix; - ostringstream osstrm; + std::string prefix; + std::ostringstream osstrm; osstrm << _outputPrefix; osstrm.fill('0'); osstrm.width(7); - osstrm << right << timestep; + osstrm << std::right << timestep; prefix = osstrm.str(); osstrm.str(""); osstrm.clear(); if (_numPairs == 1) { - string ODF11name = prefix + ".ODF11"; - ofstream outfile(ODF11name.c_str()); + std::string ODF11name = prefix + ".ODF11"; + std::ofstream outfile(ODF11name.c_str()); outfile.precision(6); - + for (unsigned long i = 1; i < _numElements; i++) { averageODF11 += (double)_ODF11[i]; } - + averageODF11 /= ((double)_numElements - 1.); - + outfile << "//Output generated by ODF plugin\n" << "//The output is to be interpreted as follows: an orientation with a value of ODF_normed = 1 has the same probability as random orientation. ODF_normed = 1.4 means 40% higher probability than random orientation, 0.4 means 60% lower probability than random orientation etc.\n" << "//Angular distribution at time step = " << timestep << " for component pairing pairing 11\n"; @@ -434,34 +434,34 @@ void ODF::output(Domain* /*domain*/, long unsigned timestep) { double averageODF12 = 0.; double averageODF21 = 0.; double averageODF22 = 0.; - + for (unsigned long i = 1; i < _numElements; i++) { averageODF11 += (double)_ODF11[i]; averageODF12 += (double)_ODF12[i]; averageODF21 += (double)_ODF21[i]; averageODF22 += (double)_ODF22[i]; } - + averageODF11 /= ((double)_numElements - 1.); averageODF12 /= ((double)_numElements - 1.); averageODF21 /= ((double)_numElements - 1.); averageODF22 /= ((double)_numElements - 1.); - - string ODF11name = prefix + ".ODF11"; - string ODF12name = prefix + ".ODF12"; - string ODF22name = prefix + ".ODF22"; - string ODF21name = prefix + ".ODF21"; - - ofstream ODF11(ODF11name.c_str()); - ofstream ODF12(ODF12name.c_str()); - ofstream ODF22(ODF22name.c_str()); - ofstream ODF21(ODF21name.c_str()); + + std::string ODF11name = prefix + ".ODF11"; + std::string ODF12name = prefix + ".ODF12"; + std::string ODF22name = prefix + ".ODF22"; + std::string ODF21name = prefix + ".ODF21"; + + std::ofstream ODF11(ODF11name.c_str()); + std::ofstream ODF12(ODF12name.c_str()); + std::ofstream ODF22(ODF22name.c_str()); + std::ofstream ODF21(ODF21name.c_str()); ODF11.precision(5); ODF12.precision(5); ODF22.precision(5); ODF21.precision(5); - - + + ODF11 << "//Output generated by ODF plugin\n" << "//The output is to be interpreted as follows: an orientation with a value of ODF_normed = 1 has the same probability as random orientation. ODF_normed = 1.4 means 40% higher probability than random orientation, 0.4 means 60% lower probability than random orientation etc.\n" @@ -479,8 +479,8 @@ void ODF::output(Domain* /*domain*/, long unsigned timestep) { << "//The output is to be interpreted as follows: an orientation with a value of ODF_normed = 1 has the same probability as random orientation. ODF_normed = 1.4 means 40% higher probability than random orientation, 0.4 means 60% lower probability than random orientation etc.\n" << "//Angular distribution at time step = " << timestep << " for component pairing pairing 21\n"; ODF21 << "cosPhi1\tcosPhi2\tcosGamma12\tODF_normed\n"; - - + + for (unsigned long i = 0; i < _numElements - 1; i++) { Gamma12 += M_PI / (double)_gammaIncrements; diff --git a/src/io/ODF.h b/src/io/ODF.h index 6b4e07fc1c..9ed44f03fa 100644 --- a/src/io/ODF.h +++ b/src/io/ODF.h @@ -34,10 +34,10 @@ class ODF : public PluginBase { unsigned long simstep) override; void reset(); void collect(DomainDecompBase* domainDecomp); - void calculateOrientation(const array &simBoxSize, + void calculateOrientation(const std::array &simBoxSize, const Molecule &mol1, const Molecule &mol2, - const array &orientationVector1); + const std::array &orientationVector1); void output(Domain* domain, long unsigned timestep); void finish(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, Domain* domain) override{}; std::string getPluginName() override { return std::string("ODF"); } diff --git a/src/io/ObjectGenerator.cpp b/src/io/ObjectGenerator.cpp index e959c271e6..25a080147c 100644 --- a/src/io/ObjectGenerator.cpp +++ b/src/io/ObjectGenerator.cpp @@ -16,48 +16,46 @@ #include "utils/generator/VelocityAssignerBase.h" -using std::endl; - void ObjectGenerator::readXML(XMLfileUnits& xmlconfig) { if(xmlconfig.changecurrentnode("filler")) { std::string fillerType; xmlconfig.getNodeValue("@type", fillerType); - global_log->debug() << "Filler type: " << fillerType << endl; + Log::global_log->debug() << "Filler type: " << fillerType << std::endl; ObjectFillerFactory objectFillerFactory; _filler = std::shared_ptr(objectFillerFactory.create(fillerType)); if(!_filler) { - global_log->error() << "Object filler could not be created" << endl; + Log::global_log->error() << "Object filler could not be created" << std::endl; Simulation::exit(1); } - global_log->debug() << "Using object filler of type: " << _filler->getPluginName() << endl; + Log::global_log->debug() << "Using object filler of type: " << _filler->getPluginName() << std::endl; _filler->readXML(xmlconfig); xmlconfig.changecurrentnode(".."); } else { - global_log->error() << "No filler specified." << endl; + Log::global_log->error() << "No filler specified." << std::endl; Simulation::exit(1); } if(xmlconfig.changecurrentnode("object")) { std::string objectType; xmlconfig.getNodeValue("@type", objectType); - global_log->debug() << "Obj name: " << objectType << endl; + Log::global_log->debug() << "Obj name: " << objectType << std::endl; ObjectFactory objectFactory; _object = std::shared_ptr(objectFactory.create(objectType)); if(!_object) { - global_log->error() << "Unknown object type: " << objectType << endl; + Log::global_log->error() << "Unknown object type: " << objectType << std::endl; } - global_log->debug() << "Created object of type: " << _object->getPluginName() << endl; + Log::global_log->debug() << "Created object of type: " << _object->getPluginName() << std::endl; _object->readXML(xmlconfig); xmlconfig.changecurrentnode(".."); } else { - global_log->error() << "No object specified." << endl; + Log::global_log->error() << "No object specified." << std::endl; Simulation::exit(1); } if(xmlconfig.changecurrentnode("velocityAssigner")) { std::string velocityAssignerName; xmlconfig.getNodeValue("@type", velocityAssignerName); - global_log->info() << "Velocity assigner: " << velocityAssignerName << endl; + Log::global_log->info() << "Velocity assigner: " << velocityAssignerName << std::endl; const long seed = [&]() -> long { bool enableRandomSeed = false; @@ -69,27 +67,27 @@ void ObjectGenerator::readXML(XMLfileUnits& xmlconfig) { * at the same time */ return std::chrono::system_clock::now().time_since_epoch().count() + _simulation.domainDecomposition().getRank(); - + } else { return 0; } }(); - global_log->info() << "Seed for velocity assigner: " << seed << endl; + Log::global_log->info() << "Seed for velocity assigner: " << seed << std::endl; if(velocityAssignerName == "EqualVelocityDistribution") { _velocityAssigner = std::make_shared(0, seed); } else if(velocityAssignerName == "MaxwellVelocityDistribution") { _velocityAssigner = std::make_shared(0, seed); } else { - global_log->error() << "Unknown velocity assigner specified." << endl; + Log::global_log->error() << "Unknown velocity assigner specified." << std::endl; Simulation::exit(1); } Ensemble* ensemble = _simulation.getEnsemble(); - global_log->info() << "Setting temperature for velocity assigner to " << ensemble->T() << endl; + Log::global_log->info() << "Setting temperature for velocity assigner to " << ensemble->T() << std::endl; _velocityAssigner->setTemperature(ensemble->T()); xmlconfig.changecurrentnode(".."); } else { - global_log->warning() << "No velocityAssigner specified. Will not change velocities provided by filler." - << endl; + Log::global_log->warning() << "No velocityAssigner specified. Will not change velocities provided by filler." + << std::endl; } } diff --git a/src/io/PovWriter.cpp b/src/io/PovWriter.cpp index 5d717e8fce..b75b954517 100644 --- a/src/io/PovWriter.cpp +++ b/src/io/PovWriter.cpp @@ -12,12 +12,8 @@ #include "Simulation.h" #include "utils/Logger.h" -using Log::global_log; -using namespace std; - - -static void writePOVobjs(Component const &component, std::ostream& ostrm, string para) { +static void writePOVobjs(Component const &component, std::ostream& ostrm, std::string para) { if (component.numLJcenters() <= 0) return; if (component.numLJcenters() == 1) { LJcenter LJsite = component.ljcenter(0); @@ -36,16 +32,16 @@ static void writePOVobjs(Component const &component, std::ostream& ostrm, string void PovWriter::readXML(XMLfileUnits& xmlconfig) { _writeFrequency = 1; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "Write frequency: " << _writeFrequency << endl; + Log::global_log->info() << "Write frequency: " << _writeFrequency << std::endl; _outputPrefix = "mardyn"; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "Output prefix: " << _outputPrefix << endl; + Log::global_log->info() << "Output prefix: " << _outputPrefix << std::endl; int incremental = 1; xmlconfig.getNodeValue("incremental", incremental); _incremental = (incremental != 0); - global_log->info() << "Incremental numbers: " << _incremental << endl; + Log::global_log->info() << "Incremental numbers: " << _incremental << std::endl; int appendTimestamp = 0; xmlconfig.getNodeValue("appendTimestamp", appendTimestamp); @@ -54,7 +50,7 @@ void PovWriter::readXML(XMLfileUnits& xmlconfig) { } else{ _appendTimestamp = false; } - global_log->info() << "Append timestamp: " << _appendTimestamp << endl; + Log::global_log->info() << "Append timestamp: " << _appendTimestamp << std::endl; } void PovWriter::init(ParticleContainer * /*particleContainer*/, @@ -65,7 +61,7 @@ void PovWriter::endStep(ParticleContainer *particleContainer, DomainDecompBase * /*domainDecomp*/, Domain *domain, unsigned long simstep) { if (simstep % _writeFrequency == 0) { - stringstream filenamestream; + std::stringstream filenamestream; filenamestream << _outputPrefix; if(_incremental) { @@ -79,49 +75,49 @@ void PovWriter::endStep(ParticleContainer *particleContainer, } filenamestream << ".pov"; - ofstream ostrm(filenamestream.str().c_str()); + std::ofstream ostrm(filenamestream.str().c_str()); - ostrm << "// " << filenamestream.str() << endl; - ostrm << "// moldy" << endl; + ostrm << "// " << filenamestream.str() << std::endl; + ostrm << "// moldy" << std::endl; const auto now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); tm unused{}; - ostrm << "// " << std::put_time(localtime_r(&now, &unused), "%c") << endl; + ostrm << "// " << std::put_time(localtime_r(&now, &unused), "%c") << std::endl; - ostrm << "// bb: [0," << domain->getGlobalLength(0) << "]^3" << endl; - ostrm << "//*PMRawBegin" << endl; - ostrm << "background {rgb <1,1,1>}" << endl; - ostrm << "//*PMRawEnd" << endl; - vector* dcomponents = _simulation.getEnsemble()->getComponents(); + ostrm << "// bb: [0," << domain->getGlobalLength(0) << "]^3" << std::endl; + ostrm << "//*PMRawBegin" << std::endl; + ostrm << "background {rgb <1,1,1>}" << std::endl; + ostrm << "//*PMRawEnd" << std::endl; + std::vector* dcomponents = _simulation.getEnsemble()->getComponents(); for (unsigned int i = 0; i < dcomponents->size(); ++i) { - ostringstream osstrm; + std::ostringstream osstrm; osstrm.clear(); osstrm.str(""); osstrm << " pigment {color rgb <" << (i + 1) % 2 << "," << (i + 1) / 2 % 2 << "," << (i + 1) / 4 % 2 << ">}"; osstrm << " finish{ambient 0.5 diffuse 0.4 phong 0.3 phong_size 3}"; ostrm << "#declare T" << i << " = "; writePOVobjs(dcomponents->at(i), ostrm, osstrm.str()); - ostrm << endl; + ostrm << std::endl; } - ostrm << endl; - ostrm << "camera { perspective" << endl; + ostrm << std::endl; + ostrm << "camera { perspective" << std::endl; float xloc = -.1 * domain->getGlobalLength(0); float yloc = 1.1 * domain->getGlobalLength(1); float zloc = -1.5 * domain->getGlobalLength(2); - ostrm << " location <" << xloc << ", " << yloc << ", " << zloc << ">" << endl; - ostrm << " look_at <" << .5 * domain->getGlobalLength(0) << ", " << .5 * domain->getGlobalLength(1) << ", " << .5 * domain->getGlobalLength(2) << ">" << endl; - ostrm << "}" << endl; - ostrm << endl; - ostrm << "light_source { <" << xloc << ", " << yloc << ", " << zloc << ">, color rgb <1,1,1> }" << endl; - ostrm << "light_source { <0,0,0>, color rgb <1,1,1> }" << endl; - ostrm << "light_source { <0,0," << domain->getGlobalLength(2) << ">, color rgb <1,1,1> }" << endl; - ostrm << "light_source { <0," << domain->getGlobalLength(1) << ",0>, color rgb <1,1,1> }" << endl; - ostrm << "light_source { <0," << domain->getGlobalLength(1) << "," << domain->getGlobalLength(2) << ">, color rgb <1,1,1> }" << endl; - ostrm << "light_source { <" << domain->getGlobalLength(0) << ",0,0>, color rgb <1,1,1> }" << endl; - ostrm << "light_source { <" << domain->getGlobalLength(0) << ",0," << domain->getGlobalLength(2) << ">, color rgb <1,1,1> }" << endl; - ostrm << "light_source { <" << domain->getGlobalLength(0) << "," << domain->getGlobalLength(1) << ",0>, color rgb <1,1,1> }" << endl; - ostrm << "light_source { <" << domain->getGlobalLength(0) << "," << domain->getGlobalLength(1) << "," << domain->getGlobalLength(2) << ">, color rgb <1,1,1> }" << endl; - ostrm << endl; - ostrm << "// " << dcomponents->size() << " objects for the atoms following..." << endl; + ostrm << " location <" << xloc << ", " << yloc << ", " << zloc << ">" << std::endl; + ostrm << " look_at <" << .5 * domain->getGlobalLength(0) << ", " << .5 * domain->getGlobalLength(1) << ", " << .5 * domain->getGlobalLength(2) << ">" << std::endl; + ostrm << "}" << std::endl; + ostrm << std::endl; + ostrm << "light_source { <" << xloc << ", " << yloc << ", " << zloc << ">, color rgb <1,1,1> }" << std::endl; + ostrm << "light_source { <0,0,0>, color rgb <1,1,1> }" << std::endl; + ostrm << "light_source { <0,0," << domain->getGlobalLength(2) << ">, color rgb <1,1,1> }" << std::endl; + ostrm << "light_source { <0," << domain->getGlobalLength(1) << ",0>, color rgb <1,1,1> }" << std::endl; + ostrm << "light_source { <0," << domain->getGlobalLength(1) << "," << domain->getGlobalLength(2) << ">, color rgb <1,1,1> }" << std::endl; + ostrm << "light_source { <" << domain->getGlobalLength(0) << ",0,0>, color rgb <1,1,1> }" << std::endl; + ostrm << "light_source { <" << domain->getGlobalLength(0) << ",0," << domain->getGlobalLength(2) << ">, color rgb <1,1,1> }" << std::endl; + ostrm << "light_source { <" << domain->getGlobalLength(0) << "," << domain->getGlobalLength(1) << ",0>, color rgb <1,1,1> }" << std::endl; + ostrm << "light_source { <" << domain->getGlobalLength(0) << "," << domain->getGlobalLength(1) << "," << domain->getGlobalLength(2) << ">, color rgb <1,1,1> }" << std::endl; + ostrm << std::endl; + ostrm << "// " << dcomponents->size() << " objects for the atoms following..." << std::endl; double mrot[3][3]; for (auto pos = particleContainer->iterator(ParticleIterator::ONLY_INNER_AND_BOUNDARY); pos.isValid(); ++pos) { (pos->q()).getRotMatrix(mrot); diff --git a/src/io/RDF.cpp b/src/io/RDF.cpp index cdabde5414..2e628a8b95 100644 --- a/src/io/RDF.cpp +++ b/src/io/RDF.cpp @@ -12,8 +12,6 @@ #include #include -using namespace std; -using namespace Log; RDF::RDF() : _intervalLength(0), @@ -34,7 +32,7 @@ RDF::RDF() : void RDF::init() { if(!_readConfig){ - global_log->error() << "RDF initialized without reading the configuration, exiting" << std::endl; + Log::global_log->error() << "RDF initialized without reading the configuration, exiting" << std::endl; Simulation::exit(25); } @@ -154,27 +152,27 @@ void RDF::init() { void RDF::readXML(XMLfileUnits& xmlconfig) { _writeFrequency = 1; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "Write frequency: " << _writeFrequency << endl; + Log::global_log->info() << "Write frequency: " << _writeFrequency << std::endl; _samplingFrequency = 1; xmlconfig.getNodeValue("samplingfrequency", _samplingFrequency); - global_log->info() << "Sampling frequency: " << _samplingFrequency << endl; + Log::global_log->info() << "Sampling frequency: " << _samplingFrequency << std::endl; _outputPrefix = "mardyn"; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "Output prefix: " << _outputPrefix << endl; + Log::global_log->info() << "Output prefix: " << _outputPrefix << std::endl; _bins = 1; xmlconfig.getNodeValue("bins", _bins); - global_log->info() << "Number of bins: " << _bins << endl; - + Log::global_log->info() << "Number of bins: " << _bins << std::endl; + _angularBins = 1; xmlconfig.getNodeValue("angularbins", _angularBins); - global_log->info() << "Number of angular bins: " << _angularBins << endl; + Log::global_log->info() << "Number of angular bins: " << _angularBins << std::endl; _intervalLength = 1; xmlconfig.getNodeValueReduced("intervallength", _intervalLength); - global_log->info() << "Interval length: " << _intervalLength << endl; + Log::global_log->info() << "Interval length: " << _intervalLength << std::endl; _readConfig = true; } @@ -192,7 +190,7 @@ RDF::~RDF() { // nothing to do since refactoring to vectors } -void RDF::accumulateNumberOfMolecules(vector& components) { +void RDF::accumulateNumberOfMolecules(std::vector& components) { for (size_t i = 0; i < components.size(); i++) { _globalCtr[i] += components[i].getNumMolecules(); } @@ -251,10 +249,10 @@ void RDF::collectRDF(DomainDecompBase* dode) { dode->collCommFinalize(); // communicate component-component ARDFs - + if(_doARDF) { dode->collCommInit(_ARDFBins * _numberOfComponents * _numberOfComponents); - + for(unsigned i=0; i < _numberOfComponents; i++) { for(unsigned k=0; k < _numberOfComponents; k++) { for(unsigned long l=0; l < _ARDFBins; l++) { @@ -273,7 +271,7 @@ void RDF::collectRDF(DomainDecompBase* dode) { } dode->collCommFinalize(); } - + // communicate site-site RDFs for(unsigned i=0; i < _numberOfComponents; i++) { unsigned ni = (*_components)[i].numSites(); @@ -346,12 +344,12 @@ void RDF::endStep(ParticleContainer * /*particleContainer*/, DomainDecompBase *d if((simStep > 0) && (simStep % _writeFrequency == 0)) { collectRDF(domainDecomposition); - + if( domainDecomposition->getRank() == 0 ) { accumulateRDF(); for (unsigned i = 0; i < _numberOfComponents; i++) { for (unsigned j = i; j < _numberOfComponents; j++) { - ostringstream osstrm; + std::ostringstream osstrm; osstrm << _outputPrefix << "_" << i << "-" << j << "."; osstrm.fill('0'); osstrm.width(9); @@ -360,7 +358,7 @@ void RDF::endStep(ParticleContainer * /*particleContainer*/, DomainDecompBase *d } if( _doARDF) { for (unsigned j = 0; j < _numberOfComponents; j++){ - ostringstream osstrm2; + std::ostringstream osstrm2; osstrm2 << _outputPrefix << "_" << i << "-" << j << "."; osstrm2.fill('0'); osstrm2.width(9); @@ -375,9 +373,9 @@ void RDF::endStep(ParticleContainer * /*particleContainer*/, DomainDecompBase *d } void RDF::writeToFileARDF(const Domain* domain, const std::string& filename, unsigned i, unsigned j) const { - ofstream ardfout(filename); + std::ofstream ardfout(filename); if( ardfout.fail() ) { - global_log->error() << "[ARDF] Failed opening output file '" << filename << "'" << endl; + Log::global_log->error() << "[ARDF] Failed opening output file '" << filename << "'" << std::endl; return; } double V = domain->getGlobalVolume(); @@ -391,7 +389,7 @@ void RDF::writeToFileARDF(const Domain* domain, const std::string& filename, uns double rho_Aj = N_Aj / V; unsigned long angularID = 0; unsigned int radialID = 0; - + ardfout << "\n"; ardfout << "# \n# ctr_i: " << _globalCtr[i] << "\n# ctr_j: " << _globalCtr[j] << "\n# V: " << V << "\n# _universalRDFTimesteps: " << _numberOfRDFTimesteps @@ -407,13 +405,13 @@ void RDF::writeToFileARDF(const Domain* domain, const std::string& filename, uns double N_pair_int = 0.0; double N_Apair_int = 0.0; for(unsigned long l = 0; l < numARDFBins(); ++l) { - + if (l % _angularBins == 0 && l != 0) { radialID++; } angularID = l - radialID * _angularBins; - - + + double rmin = radialID * binwidth(); double rmid = (radialID+0.5) * binwidth(); double rmax = (radialID+1.0) * binwidth(); @@ -421,7 +419,7 @@ void RDF::writeToFileARDF(const Domain* domain, const std::string& filename, uns double cosPhiMid = 1. -(angularID + 0.5) * angularbinwidth(); double cosPhiMax = 1. -(angularID + 1.0) * angularbinwidth(); double dV = 2./3. * M_PI * ((rmax * rmax * rmax - rmin * rmin * rmin) * (1. - cosPhiMax) + (rmin * rmin * rmin - rmax * rmax * rmax) * (1. - cosPhiMin)); - + double N_pair = _ARDFdistribution.global[i][j][l] / (double)_numberOfRDFTimesteps; N_pair_int += N_pair; double N_Apair = _globalAccumulatedARDFDistribution[i][j][l] / (double)_accumulatedNumberOfRDFTimesteps; @@ -455,13 +453,13 @@ void RDF::writeToFileARDF(const Domain* domain, const std::string& filename, uns void RDF::writeToFile(const Domain* domain, const std::string& filename, unsigned i, unsigned j) const { - ofstream rdfout(filename); + std::ofstream rdfout(filename); if( rdfout.fail() ) { - global_log->error() << "[RDF] Failed opening output file '" << filename << "'" << endl; + Log::global_log->error() << "[RDF] Failed opening output file '" << filename << "'" << std::endl; return; } - global_log->debug() << "[RDF] Writing output" << endl; + Log::global_log->debug() << "[RDF] Writing output" << std::endl; unsigned ni = (*_components)[i].numSites(); unsigned nj = (*_components)[j].numSites(); @@ -573,7 +571,7 @@ void RDF::writeToFile(const Domain* domain, const std::string& filename, unsigne void RDF::afterForces(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, unsigned long simstep) { if (simstep % _samplingFrequency == 0 && simstep > global_simulation->getInitStatistics()) { - global_log->debug() << "Activating the RDF sampling" << endl; + Log::global_log->debug() << "Activating the RDF sampling" << std::endl; tickRDF(); accumulateNumberOfMolecules(*(global_simulation->getEnsemble()->getComponents())); particleContainer->traverseCells(*_cellProcessor); diff --git a/src/io/RDF.h b/src/io/RDF.h index a098f58495..4e01215cec 100644 --- a/src/io/RDF.h +++ b/src/io/RDF.h @@ -30,8 +30,8 @@ class RDFCellProcessor; * - for each bin: calculate the number density (i.e. number of particles per volume) * of the corresponding shell * - divide the number density by the number density of the system. - - *Update: Optionally, the RDF can be additionally resolved in angular direction, by chosing angularbins > 1 in the input. Phi is the angle between the central molecules orientation vector and the vector connecting the pair of molecules. + + *Update: Optionally, the RDF can be additionally resolved in angular direction, by chosing angularbins > 1 in the input. Phi is the angle between the central molecules orientation vector and the vector connecting the pair of molecules. *The angular coordinate is given and discretized in terms of the cosine of the angle cos(phi), to ensure equal control volume sizes for equal distance R */ class RDF : public PluginBase { @@ -89,9 +89,9 @@ class RDF : public PluginBase { //! count the number of molecules per component //! @todo: remove it and replace it by component.getNumMolecules() void accumulateNumberOfMolecules(std::vector& components); - + void observeARDFMolecule(double dd, double cosPhi, double cosPhiReverse, unsigned cid1, unsigned cid2) { - + if(dd > _maxDistanceSquare) { return; } size_t distanceBinID = floor( sqrt(dd) / binwidth() ); size_t angularBinID = floor( (-cosPhi + 1.)/ angularbinwidth() ); @@ -198,7 +198,7 @@ class RDF : public PluginBase { //! The length of an interval //! Only used for the output to scale the "radius"-axis. double _intervalLength; - + //! The length of an angular interval //! Only used for the output to scale the "phi"-axis. double _angularIntervalLength; @@ -206,11 +206,11 @@ class RDF : public PluginBase { //! The number of bins, i.e. the number of intervals in which the cutoff //! radius will be subdivided. unsigned long _bins; - + //! The number of bins in angular direction in case the angular RDF is //! being calculated unsigned long _angularBins {1}; - + //! The total number of bins for the ARDF is the product of the radial bins and //! the angular bins unsigned long _ARDFBins; @@ -253,7 +253,7 @@ class RDF : public PluginBase { //! holds the distribution of the neighbouring particles, globally accumulated. std::vector>> _globalAccumulatedDistribution; std::vector>> _globalAccumulatedARDFDistribution; - + bool _doCollectSiteRDF; bool _doARDF; // vector indices: diff --git a/src/io/ReplicaGenerator.cpp b/src/io/ReplicaGenerator.cpp index 7225fab67a..fc505430e0 100755 --- a/src/io/ReplicaGenerator.cpp +++ b/src/io/ReplicaGenerator.cpp @@ -23,7 +23,6 @@ #include "Simulation.h" #include "utils/Logger.h" -using Log::global_log; enum MoleculeFormat : uint32_t { ICRVQD, IRV, ICRV @@ -56,8 +55,8 @@ void ReplicaGenerator::readReplicaPhaseSpaceHeader(SubDomain& subDomain) { XMLfileUnits inp(subDomain.strFilePathHeader); if(not inp.changecurrentnode("/mardyn")) { - global_log->error() << "Could not find root node /mardyn in XML input file." << endl; - global_log->fatal() << "Not a valid MarDyn XML input file." << endl; + Log::global_log->error() << "Could not find root node /mardyn in XML input file." << std::endl; + Log::global_log->fatal() << "Not a valid MarDyn XML input file." << std::endl; Simulation::exit(1); } @@ -80,8 +79,8 @@ void ReplicaGenerator::readReplicaPhaseSpaceHeader(SubDomain& subDomain) { subDomain.dDensity = subDomain.numParticles / subDomain.dVolume; if(not bInputOk) { - global_log->error() << "Content of file: '" << subDomain.strFilePathHeader << "' corrupted! Program exit ..." - << endl; + Log::global_log->error() << "Content of file: '" << subDomain.strFilePathHeader << "' corrupted! Program exit ..." + << std::endl; Simulation::exit(1); } @@ -92,7 +91,7 @@ void ReplicaGenerator::readReplicaPhaseSpaceHeader(SubDomain& subDomain) { else if("ICRV" == strMoleculeFormat) _nMoleculeFormat = ICRV; else { - global_log->error() << "Not a valid molecule format: " << strMoleculeFormat << ", program exit ..." << endl; + Log::global_log->error() << "Not a valid molecule format: " << strMoleculeFormat << ", program exit ..." << std::endl; Simulation::exit(1); } } @@ -102,17 +101,17 @@ void ReplicaGenerator::readReplicaPhaseSpaceData(SubDomain& subDomain, DomainDec if(domainDecomp->getRank() == 0) { #endif subDomain.strFilePathData = string_utils::trim(subDomain.strFilePathData); - global_log->info() << "Opening phase space file " << subDomain.strFilePathData << endl; + Log::global_log->info() << "Opening phase space file " << subDomain.strFilePathData << std::endl; std::ifstream ifs; - ifs.open(subDomain.strFilePathData.c_str(), ios::binary | ios::in); + ifs.open(subDomain.strFilePathData.c_str(), std::ios::binary | std::ios::in); if(!ifs.is_open()) { - global_log->error() << "Could not open phaseSpaceFile " << subDomain.strFilePathData << endl; + Log::global_log->error() << "Could not open phaseSpaceFile " << subDomain.strFilePathData << std::endl; Simulation::exit(1); } - global_log->info() << "Reading phase space file " << subDomain.strFilePathData << endl; + Log::global_log->info() << "Reading phase space file " << subDomain.strFilePathData << std::endl; - vector& components = *(_simulation.getEnsemble()->getComponents()); + std::vector& components = *(_simulation.getEnsemble()->getComponents()); // Select appropriate reader switch (_nMoleculeFormat) { @@ -152,7 +151,7 @@ void ReplicaGenerator::readReplicaPhaseSpaceData(SubDomain& subDomain, DomainDec ParticleData::MoleculeToParticleData(particle_buff[particle_buff_pos], subDomain.vecParticles[i]); particle_buff_pos++; if ((particle_buff_pos >= PARTICLE_BUFFER_SIZE) || (i == num_particles - 1)) { - global_log->debug() << "broadcasting(sending) particles" << endl; + Log::global_log->debug() << "broadcasting(sending) particles" << std::endl; MPI_Bcast(particle_buff, PARTICLE_BUFFER_SIZE, mpi_Particle, 0, domainDecomp->getCommunicator()); particle_buff_pos = 0; } @@ -160,7 +159,7 @@ void ReplicaGenerator::readReplicaPhaseSpaceData(SubDomain& subDomain, DomainDec } else { for(unsigned long i = 0; i < num_particles; ++i) { if(i % PARTICLE_BUFFER_SIZE == 0) { - global_log->debug() << "broadcasting(receiving) particles" << endl; + Log::global_log->debug() << "broadcasting(receiving) particles" << std::endl; MPI_Bcast(particle_buff, PARTICLE_BUFFER_SIZE, mpi_Particle, 0, domainDecomp->getCommunicator()); particle_buff_pos = 0; } @@ -170,13 +169,13 @@ void ReplicaGenerator::readReplicaPhaseSpaceData(SubDomain& subDomain, DomainDec subDomain.vecParticles.push_back(m); } } - global_log->debug() << "broadcasting(sending/receiving) particles complete" << endl; + Log::global_log->debug() << "broadcasting(sending/receiving) particles complete" << std::endl; #endif - global_log->info() << "Reading Molecules done" << endl; + Log::global_log->info() << "Reading Molecules done" << std::endl; } void ReplicaGenerator::readXML(XMLfileUnits& xmlconfig) { - global_log->debug() << "Reading config for ReplicaGenerator" << endl; + Log::global_log->debug() << "Reading config for ReplicaGenerator" << std::endl; _nSystemType = ST_UNKNOWN; std::string strType = "unknown"; @@ -188,8 +187,8 @@ void ReplicaGenerator::readXML(XMLfileUnits& xmlconfig) { } else if("heterogeneous_LV" == strType) { _nSystemType = ST_HETEROGENEOUS_LIQUID_VAPOR; } else { - global_log->error() << "Specified wrong type at XML path: " << xmlconfig.getcurrentnodepath() << "/type" - << endl; + Log::global_log->error() << "Specified wrong type at XML path: " << xmlconfig.getcurrentnodepath() << "/type" + << std::endl; Simulation::exit(-1); } @@ -209,7 +208,7 @@ void ReplicaGenerator::readXML(XMLfileUnits& xmlconfig) { if(_nSystemType == ST_HETEROGENEOUS_VAPOR_LIQUID_VAPOR || _nSystemType == ST_HETEROGENEOUS_LIQUID_VAPOR) xmlconfig.getNodeValue("numblocks/liquid", _numBlocksLiqY); - global_log->info() << "Replicating " << _numBlocksXZ << " x " << _numBlocksXZ << " boxes in XZ layers." + Log::global_log->info() << "Replicating " << _numBlocksXZ << " x " << _numBlocksXZ << " boxes in XZ layers." << std::endl; if(_nSystemType == ST_HETEROGENEOUS_VAPOR_LIQUID_VAPOR) { @@ -218,7 +217,7 @@ void ReplicaGenerator::readXML(XMLfileUnits& xmlconfig) { _nIndexLiqEndY = _numBlocksVapY + _numBlocksLiqY - 1; xmlconfig.getNodeValue("diameter", _dMoleculeDiameter); - global_log->info() << "Using molecule diameter: " << _dMoleculeDiameter + Log::global_log->info() << "Using molecule diameter: " << _dMoleculeDiameter << " for spacing between liquid and vapour phase. " << std::endl; } else if(_nSystemType == ST_HETEROGENEOUS_LIQUID_VAPOR) { // liquid blocks begin/end index @@ -226,21 +225,21 @@ void ReplicaGenerator::readXML(XMLfileUnits& xmlconfig) { _nIndexLiqEndY = _numBlocksLiqY - 1; xmlconfig.getNodeValue("diameter", _dMoleculeDiameter); - global_log->info() << "Using molecule diameter: " << _dMoleculeDiameter + Log::global_log->info() << "Using molecule diameter: " << _dMoleculeDiameter << " for spacing between liquid and vapour phase. " << std::endl; } // change identity of molecules by component ID (zero based)) { // vapor system - string oldpath = xmlconfig.getcurrentnodepath(); + std::string oldpath = xmlconfig.getcurrentnodepath(); if(xmlconfig.changecurrentnode("componentIDs/vapor")) { uint8_t numChanges = 0; XMLfile::Query query = xmlconfig.query("change"); numChanges = query.card(); - global_log->info() << "Number of components to change: " << (uint32_t) numChanges << endl; + Log::global_log->info() << "Number of components to change: " << (uint32_t) numChanges << std::endl; if(numChanges < 1) { - global_log->error() << "No component change defined in XML-config file. Program exit ..." << endl; + Log::global_log->error() << "No component change defined in XML-config file. Program exit ..." << std::endl; Simulation::exit(-1); } XMLfile::Query::const_iterator changeIter; @@ -261,9 +260,9 @@ void ReplicaGenerator::readXML(XMLfileUnits& xmlconfig) { uint8_t numChanges = 0; XMLfile::Query query = xmlconfig.query("change"); numChanges = query.card(); - global_log->info() << "Number of components to change: " << (uint32_t) numChanges << endl; + Log::global_log->info() << "Number of components to change: " << (uint32_t) numChanges << std::endl; if(numChanges < 1) { - global_log->error() << "No component change defined in XML-config file. Program exit ..." << endl; + Log::global_log->error() << "No component change defined in XML-config file. Program exit ..." << std::endl; Simulation::exit(-1); } XMLfile::Query::const_iterator changeIter; @@ -284,7 +283,7 @@ void ReplicaGenerator::readXML(XMLfileUnits& xmlconfig) { void ReplicaGenerator::init() { DomainDecompBase* domainDecomp = &global_simulation->domainDecomposition(); - global_log->info() << domainDecomp->getRank() << ": Init Replica VLE ..." << endl; + Log::global_log->info() << domainDecomp->getRank() << ": Init Replica VLE ..." << std::endl; for(auto&& sd : _vecSubDomains) { this->readReplicaPhaseSpaceHeader(sd); @@ -330,7 +329,7 @@ void ReplicaGenerator::init() { dLength[2] = _numBlocksXZ * _vecSubDomains.at(0).arrBoxLength.at(2); for(uint8_t di = 0; di < 3; ++di) global_simulation->getDomain()->setGlobalLength(di, dLength[di]); - global_log->info() << "Domain box length = " << dLength[0] << ", " << dLength[1] << ", " << dLength[2] << endl; + Log::global_log->info() << "Domain box length = " << dLength[0] << ", " << dLength[1] << ", " << dLength[2] << std::endl; /* // Reset domain decomposition @@ -338,13 +337,13 @@ void ReplicaGenerator::init() { delete domainDecomp; } #ifndef ENABLE_MPI - global_log->info() << "Initializing the alibi domain decomposition ... " << endl; + Log::global_log->info() << "Initializing the alibi domain decomposition ... " << std::endl; domainDecomp = new DomainDecompBase(); #else - global_log->info() << "Initializing the standard domain decomposition ... " << endl; + Log::global_log->info() << "Initializing the standard domain decomposition ... " << std::endl; domainDecomp = (DomainDecompBase*) new DomainDecomposition(); #endif - global_log->info() << "Initialization done" << endl; + Log::global_log->info() << "Initialization done" << std::endl; domainDecomp->readXML(xmlconfig); */ @@ -407,24 +406,24 @@ ReplicaGenerator::readPhaseSpace(ParticleContainer* particleContainer, Domain* d } #ifndef NDEBUG - cout << domainDecomp->getRank() << ": bbMin = " << bbMin[0] << ", " << bbMin[1] << ", " << bbMin[2] << endl; - cout << domainDecomp->getRank() << ": bbMax = " << bbMax[0] << ", " << bbMax[1] << ", " << bbMax[2] << endl; - cout << domainDecomp->getRank() << ": bbLength = " << bbLength[0] << ", " << bbLength[1] << ", " << bbLength[2] - << endl; - cout << domainDecomp->getRank() << ": numBlocks = " << numBlocks[0] << ", " << numBlocks[1] << ", " << numBlocks[2] - << endl; - cout << domainDecomp->getRank() << ": startIndex = " << startIndex[0] << ", " << startIndex[1] << ", " - << startIndex[2] << endl; - cout << domainDecomp->getRank() << ": BoxLength = " << _vecSubDomains.at(0).arrBoxLength.at(0) << "," + std::cout << domainDecomp->getRank() << ": bbMin = " << bbMin[0] << ", " << bbMin[1] << ", " << bbMin[2] << std::endl; + std::cout << domainDecomp->getRank() << ": bbMax = " << bbMax[0] << ", " << bbMax[1] << ", " << bbMax[2] << std::endl; + std::cout << domainDecomp->getRank() << ": bbLength = " << bbLength[0] << ", " << bbLength[1] << ", " << bbLength[2] + << std::endl; + std::cout << domainDecomp->getRank() << ": numBlocks = " << numBlocks[0] << ", " << numBlocks[1] << ", " << numBlocks[2] + << std::endl; + std::cout << domainDecomp->getRank() << ": startIndex = " << startIndex[0] << ", " << startIndex[1] << ", " + << startIndex[2] << std::endl; + std::cout << domainDecomp->getRank() << ": BoxLength = " << _vecSubDomains.at(0).arrBoxLength.at(0) << "," " " << _vecSubDomains.at(0).arrBoxLength.at(1) << "," - " " << _vecSubDomains.at(0).arrBoxLength.at(2) << endl; - cout << domainDecomp->getRank() << ": bbLength/BoxLength = " + " " << _vecSubDomains.at(0).arrBoxLength.at(2) << std::endl; + std::cout << domainDecomp->getRank() << ": bbLength/BoxLength = " << bbLength[0] / _vecSubDomains.at(0).arrBoxLength.at(0) << "," " " << bbLength[1] / _vecSubDomains.at(0).arrBoxLength.at(1) << "," " " - << bbLength[2] / _vecSubDomains.at(0).arrBoxLength.at(2) << endl; + << bbLength[2] / _vecSubDomains.at(0).arrBoxLength.at(2) << std::endl; #endif std::array bl = _vecSubDomains.at(0).arrBoxLength; @@ -520,18 +519,18 @@ ReplicaGenerator::readPhaseSpace(ParticleContainer* particleContainer, Domain* d domainDecomp->collCommFinalize(); mardyn_assert(numParticlesGlobal == _numParticlesTotal - numAddedParticlesFreespaceGlobal); - global_log->info() << "Number of particles calculated by number of blocks : " << setw(24) << _numParticlesTotal - << endl; - global_log->info() << "Number of particles located in freespace (not added): " << setw(24) - << numAddedParticlesFreespaceGlobal << endl; - global_log->info() << "Number of particles added to particle container : " << setw(24) << numParticlesGlobal - << endl; + Log::global_log->info() << "Number of particles calculated by number of blocks : " << std::setw(24) << _numParticlesTotal + << std::endl; + Log::global_log->info() << "Number of particles located in freespace (not added): " << std::setw(24) + << numAddedParticlesFreespaceGlobal << std::endl; + Log::global_log->info() << "Number of particles added to particle container : " << std::setw(24) << numParticlesGlobal + << std::endl; if(domainDecomp->getRank() == 0 && numParticlesGlobal != _numParticlesTotal - numAddedParticlesFreespaceGlobal) { - global_log->info() << "Number of particles: " << numParticlesGlobal << " (added)" + Log::global_log->info() << "Number of particles: " << numParticlesGlobal << " (added)" " != " << (_numParticlesTotal - numAddedParticlesFreespaceGlobal) << " (expected). Program exit ..." - << endl; + << std::endl; Simulation::exit(-1); } @@ -540,7 +539,7 @@ ReplicaGenerator::readPhaseSpace(ParticleContainer* particleContainer, Domain* d Log::global_log->info() << "Initial IO took: " << global_simulation->timers()->getTime("REPLICA_GENERATOR_VLE_INPUT") << " sec" << std::endl; - global_log->info() << "------------------------------------------------------------------------" << std::endl; + Log::global_log->info() << "------------------------------------------------------------------------" << std::endl; return numParticlesGlobal; } diff --git a/src/io/ReplicaGenerator.h b/src/io/ReplicaGenerator.h index bfee0f2681..c1994f7a78 100755 --- a/src/io/ReplicaGenerator.h +++ b/src/io/ReplicaGenerator.h @@ -10,7 +10,6 @@ #include #include -using namespace std; enum SystemTypes : uint8_t { ST_UNKNOWN = 0, diff --git a/src/io/ResultWriter.cpp b/src/io/ResultWriter.cpp index abf522f28f..7f33ca1525 100644 --- a/src/io/ResultWriter.cpp +++ b/src/io/ResultWriter.cpp @@ -6,26 +6,25 @@ #include "utils/Logger.h" #include -using Log::global_log; void ResultWriter::readXML(XMLfileUnits& xmlconfig) { _writeFrequency = 1; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "[ResultWriter] Write frequency: " << _writeFrequency << endl; + Log::global_log->info() << "[ResultWriter] Write frequency: " << _writeFrequency << std::endl; _outputPrefix = "mardyn"; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "[ResultWriter] Output prefix: " << _outputPrefix << endl; + Log::global_log->info() << "[ResultWriter] Output prefix: " << _outputPrefix << std::endl; size_t acc_steps = 1000; xmlconfig.getNodeValue("accumulation_steps", acc_steps); _U_pot_acc = new Accumulator(acc_steps); _p_acc = new Accumulator(acc_steps); - global_log->info() << "[ResultWriter] Accumulation steps: " << acc_steps << endl; + Log::global_log->info() << "[ResultWriter] Accumulation steps: " << acc_steps << std::endl; _writePrecision = 5; xmlconfig.getNodeValue("writeprecision", _writePrecision); - global_log->info() << "[ResultWriter] Write precision: " << _writePrecision << endl; + Log::global_log->info() << "[ResultWriter] Write precision: " << _writePrecision << std::endl; } void ResultWriter::init(ParticleContainer * /*particleContainer*/, @@ -35,11 +34,11 @@ void ResultWriter::init(ParticleContainer * /*particleContainer*/, const auto now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); tm unused{}; const auto nowStr = std::put_time(localtime_r(&now, &unused), "%c"); - string resultfile(_outputPrefix+".res"); + std::string resultfile(_outputPrefix+".res"); _resultStream.open(resultfile.c_str(), std::ios::out); - _resultStream << "# ls1 MarDyn simulation started at " << nowStr << endl; - _resultStream << "# Averages are the accumulated values over " << _U_pot_acc->getWindowLength() << " time steps."<< endl; - _resultStream << std::setw(10) << "# step" << std::setw(_writePrecision+15) << "time" + _resultStream << "# ls1 MarDyn simulation started at " << nowStr << std::endl; + _resultStream << "# Averages are the accumulated values over " << _U_pot_acc->getWindowLength() << " time steps."<< std::endl; + _resultStream << std::setw(10) << "# step" << std::setw(_writePrecision+15) << "time" << std::setw(_writePrecision+15) << "U_pot" << std::setw(_writePrecision+15) << "U_pot_avg" << std::setw(_writePrecision+15) << "p" @@ -48,7 +47,7 @@ void ResultWriter::init(ParticleContainer * /*particleContainer*/, << std::setw(_writePrecision+15) << "beta_rot" << std::setw(_writePrecision+15) << "c_v" << std::setw(_writePrecision+15) << "N" - << endl; + << std::endl; } } @@ -72,7 +71,7 @@ void ResultWriter::endStep(ParticleContainer *particleContainer, DomainDecompBas << std::setw(_writePrecision+15) << std::scientific << std::setprecision(_writePrecision) << domain->getGlobalBetaRot() << std::setw(_writePrecision+15) << std::scientific << std::setprecision(_writePrecision) << cv << std::setw(_writePrecision+15) << std::scientific << std::setprecision(_writePrecision) << globalNumMolecules - << endl; + << std::endl; } } @@ -83,7 +82,7 @@ void ResultWriter::finish(ParticleContainer * /*particleContainer*/, const auto now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); tm unused{}; const auto nowStr = std::put_time(localtime_r(&now, &unused), "%c"); - _resultStream << "# ls1 mardyn simulation finished at " << nowStr << endl; + _resultStream << "# ls1 mardyn simulation finished at " << nowStr << std::endl; _resultStream.close(); } } diff --git a/src/io/ResultWriter.h b/src/io/ResultWriter.h index 8c24892fb9..bd5d39d630 100644 --- a/src/io/ResultWriter.h +++ b/src/io/ResultWriter.h @@ -53,7 +53,7 @@ class ResultWriter : public PluginBase { void finish(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain); - + std::string getPluginName() { return std::string("ResultWriter"); } diff --git a/src/io/SysMonOutput.cpp b/src/io/SysMonOutput.cpp index 0cbac87cd9..639915cc30 100644 --- a/src/io/SysMonOutput.cpp +++ b/src/io/SysMonOutput.cpp @@ -6,8 +6,6 @@ #include "utils/SysMon.h" #include "utils/xmlfileUnits.h" -using Log::global_log; -using namespace std; SysMonOutput::SysMonOutput() : _writeFrequency(1) {} @@ -16,15 +14,15 @@ SysMonOutput::SysMonOutput() : _writeFrequency(1) {} void SysMonOutput::readXML(XMLfileUnits& xmlconfig) { _writeFrequency = 1; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "Write frequency: " << _writeFrequency << endl; + Log::global_log->info() << "Write frequency: " << _writeFrequency << std::endl; SysMon* sysmon = SysMon::getSysMon(); XMLfile::Query query = xmlconfig.query("expression"); //string oldpath = xmlconfig.getcurrentnodepath(); for(XMLfile::Query::const_iterator exprIter = query.begin(); exprIter; exprIter++ ) { xmlconfig.changecurrentnode(exprIter); - string expr(xmlconfig.getNodeValue_string(".")); - string label(xmlconfig.getNodeValue_string(string("@label"))); + std::string expr(xmlconfig.getNodeValue_string(".")); + std::string label(xmlconfig.getNodeValue_string(std::string("@label"))); if(label.empty()) { sysmon->addExpression(expr); @@ -33,7 +31,7 @@ void SysMonOutput::readXML(XMLfileUnits& xmlconfig) { } } //xmlconfig.changecurrentnode(oldpath); - + //sysmon->updateExpressionValues(); //global_log->info() << sysmon->InfoString("System Monitor\n","\t"); } @@ -42,7 +40,7 @@ void SysMonOutput::init(ParticleContainer * /*particleContainer*/, DomainDecompB Domain * /*domain*/){ SysMon* sysmon = SysMon::getSysMon(); sysmon->updateExpressionValues(); - global_log->info() << sysmon->InfoString("System Monitor (initial)\n","\t"); + Log::global_log->info() << sysmon->InfoString("System Monitor (initial)\n","\t"); } void SysMonOutput::endStep(ParticleContainer * /*particleContainer*/, DomainDecompBase * /*domainDecomp*/, @@ -51,9 +49,9 @@ void SysMonOutput::endStep(ParticleContainer * /*particleContainer*/, DomainDeco if((simstep % _writeFrequency) == 0) { SysMon* sysmon = SysMon::getSysMon(); sysmon->updateExpressionValues(); - ostringstream oss; - oss << "System Monitor (simulation step " << simstep << ")" << endl; - global_log->info() << sysmon->InfoString(oss.str(),"\t"); + std::ostringstream oss; + oss << "System Monitor (simulation step " << simstep << ")" << std::endl; + Log::global_log->info() << sysmon->InfoString(oss.str(),"\t"); } } @@ -61,5 +59,5 @@ void SysMonOutput::finish(ParticleContainer * /*particleContainer*/, DomainDecom Domain * /*domain*/){ SysMon* sysmon = SysMon::getSysMon(); sysmon->updateExpressionValues(); - global_log->info() << sysmon->InfoString("System Monitor (final)\n","\t"); + Log::global_log->info() << sysmon->InfoString("System Monitor (final)\n","\t"); } diff --git a/src/io/SysMonOutput.h b/src/io/SysMonOutput.h index 3fc6c51a72..ffd43c66a9 100644 --- a/src/io/SysMonOutput.h +++ b/src/io/SysMonOutput.h @@ -18,7 +18,7 @@ class SysMonOutput : public PluginBase { void endStep(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain, unsigned long simstep); - + //! @todo comment void finish(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain); diff --git a/src/io/TaskTimingProfiler.cpp b/src/io/TaskTimingProfiler.cpp index 3075cf815a..548453a540 100644 --- a/src/io/TaskTimingProfiler.cpp +++ b/src/io/TaskTimingProfiler.cpp @@ -46,7 +46,7 @@ void TaskTimingProfiler::stop(unsigned long start, int taskId) { } void TaskTimingProfiler::dump(std::string filename) { - global_log->info() << "Writing task timings to " << filename << " ... " << std::flush; + Log::global_log->info() << "Writing task timings to " << filename << " ... " << std::flush; // find first tick to subtract from all others unsigned long startTick = ULLONG_MAX; @@ -75,32 +75,32 @@ void TaskTimingProfiler::dump(std::string filename) { std::cout << "done!" << std::endl; #ifdef QUICKSCHED - global_log->info() << "Task ids:" << endl + Log::global_log->info() << "Task ids:" << std::endl << std::setw(42) << "" << "P2PPreprocessSingleCell = " - << bhfmm::FastMultipoleMethod::taskType::P2PPreprocessSingleCell << endl + << bhfmm::FastMultipoleMethod::taskType::P2PPreprocessSingleCell << std::endl << std::setw(42) << "" << "P2Pc08StepBlock = " - << bhfmm::FastMultipoleMethod::taskType::P2Pc08StepBlock << endl + << bhfmm::FastMultipoleMethod::taskType::P2Pc08StepBlock << std::endl << std::setw(42) << "" << "P2PPostprocessSingleCell = " - << bhfmm::FastMultipoleMethod::taskType::P2PPostprocessSingleCell << endl + << bhfmm::FastMultipoleMethod::taskType::P2PPostprocessSingleCell << std::endl << std::setw(42) << "" << "P2MCompleteCell = " - << bhfmm::FastMultipoleMethod::taskType::P2MCompleteCell << endl + << bhfmm::FastMultipoleMethod::taskType::P2MCompleteCell << std::endl << std::setw(42) << "" << "M2MCompleteCell = " - << bhfmm::FastMultipoleMethod::taskType::M2MCompleteCell << endl + << bhfmm::FastMultipoleMethod::taskType::M2MCompleteCell << std::endl << std::setw(42) << "" << "M2LInitializeCell = " - << bhfmm::FastMultipoleMethod::taskType::M2LInitializeCell << endl + << bhfmm::FastMultipoleMethod::taskType::M2LInitializeCell << std::endl << std::setw(42) << "" << "M2LInitializeSource = " - << bhfmm::FastMultipoleMethod::taskType::M2LInitializeSource << endl + << bhfmm::FastMultipoleMethod::taskType::M2LInitializeSource << std::endl << std::setw(42) << "" << "M2LTranslation = " - << bhfmm::FastMultipoleMethod::taskType::M2LTranslation << endl + << bhfmm::FastMultipoleMethod::taskType::M2LTranslation << std::endl << std::setw(42) << "" << "M2LPair2Way = " - << bhfmm::FastMultipoleMethod::taskType::M2LPair2Way << endl + << bhfmm::FastMultipoleMethod::taskType::M2LPair2Way << std::endl << std::setw(42) << "" << "M2LFinalizeCell = " - << bhfmm::FastMultipoleMethod::taskType::M2LFinalizeCell << endl + << bhfmm::FastMultipoleMethod::taskType::M2LFinalizeCell << std::endl << std::setw(42) << "" << "L2LCompleteCell = " - << bhfmm::FastMultipoleMethod::taskType::L2LCompleteCell << endl + << bhfmm::FastMultipoleMethod::taskType::L2LCompleteCell << std::endl << std::setw(42) << "" << "L2PCompleteCell = " - << bhfmm::FastMultipoleMethod::taskType::L2PCompleteCell << endl; + << bhfmm::FastMultipoleMethod::taskType::L2PCompleteCell << std::endl; #endif /* QUICKSCHED */ } -#endif /* TASKTIMINGPROFILE */ \ No newline at end of file +#endif /* TASKTIMINGPROFILE */ diff --git a/src/io/TcTS.cpp b/src/io/TcTS.cpp index 995c126309..a78471a162 100644 --- a/src/io/TcTS.cpp +++ b/src/io/TcTS.cpp @@ -12,8 +12,6 @@ #include "utils/Logger.h" #include "utils/Random.h" -using namespace std; -using Log::global_log; #define PRECISION 5 #define VARFRACTION 0.125 @@ -26,13 +24,13 @@ void MkTcTSGenerator::readXML(XMLfileUnits& xmlconfig) { //has to be between 0 and 1 l1_offset = 0.3; xmlconfig.getNodeValue("layer1/l1_ratio", l1_ratio); - global_log->info() << "Layer 1, ratio: " << l1_ratio << endl; + Log::global_log->info() << "Layer 1, ratio: " << l1_ratio << std::endl; xmlconfig.getNodeValue("layer1/l1_offset", l1_offset); xmlconfig.getNodeValue("layer1/density", rho1); - global_log->info() << "Layer 1, density: " << rho1 << endl; + Log::global_log->info() << "Layer 1, density: " << rho1 << std::endl; rho2 = rho1; xmlconfig.getNodeValue("layer2/density", rho2); - global_log->info() << "Layer 2, density: " << rho2 << endl; + Log::global_log->info() << "Layer 2, density: " << rho2 << std::endl; } void MkTcTSGenerator::readPhaseSpaceHeader(Domain* domain, double /*timestep*/) { @@ -41,7 +39,7 @@ void MkTcTSGenerator::readPhaseSpaceHeader(Domain* domain, double /*timestep*/) unsigned long MkTcTSGenerator::readPhaseSpace(ParticleContainer* particleContainer, Domain* domain, DomainDecompBase*) { // Mixing coefficients - vector& dmixcoeff = domain->getmixcoeff(); + std::vector& dmixcoeff = domain->getmixcoeff(); dmixcoeff.clear(); unsigned int numcomponents = _simulation.getEnsemble()->getComponents()->size(); @@ -79,8 +77,8 @@ MkTcTSGenerator::readPhaseSpace(ParticleContainer* particleContainer, Domain* do if(fl_units[0][i] == 0ul) fl_units[0][i] = 1; fl_units[2][i] = static_cast(ceil(bxbz_id / fl_units[0][i])); for(int d = 0; d < 3; d++) fl_unit[d][i] = ((d == 1) ? curr_ratio : 1.0) * box[d] / static_cast(fl_units[d][i]); - global_log->debug() << "Elementary cell " << i << ": " << fl_unit[0][i] << " x " << fl_unit[1][i] << " x " - << fl_unit[2][i] << endl; + Log::global_log->debug() << "Elementary cell " << i << ": " << fl_unit[0][i] << " x " << fl_unit[1][i] << " x " + << fl_unit[2][i] << std::endl; } Random* rnd = new Random(); @@ -140,9 +138,9 @@ MkTcTSGenerator::readPhaseSpace(ParticleContainer* particleContainer, Domain* do } } } - global_log->debug() << "Filling " << N[l] << " of 3*" + Log::global_log->debug() << "Filling " << N[l] << " of 3*" << fl_units[0][l] << "*" << fl_units[1][l] << "*" << fl_units[2][l] - << " = " << slots[l] << " slots (ideally " << N_id[l] << ")" << endl; + << " = " << slots[l] << " slots (ideally " << N_id[l] << ")" << std::endl; } double loffset[3][2]; @@ -166,7 +164,7 @@ MkTcTSGenerator::readPhaseSpace(ParticleContainer* particleContainer, Domain* do std::vector* components = _simulation.getEnsemble()->getComponents(); if(components->size() > 2) { - global_log->warning() << "MkTcTs only supports 2 components but " << components->size() << "where given!"; + Log::global_log->warning() << "MkTcTs only supports 2 components but " << components->size() << "where given!"; } Component* component1 = &(*components)[0]; Component* component2 = components->size() >= 2 ? &(*components)[1] : &(*components)[0]; diff --git a/src/io/TimerProfiler.cpp b/src/io/TimerProfiler.cpp index 6b1eb470e9..ed6a1539e7 100644 --- a/src/io/TimerProfiler.cpp +++ b/src/io/TimerProfiler.cpp @@ -1,278 +1,277 @@ -/* - * TimerProfiler.cpp - * - * Created on: Apr 9, 2017 - * Author: Andrei Costinescu - */ - -#include -#include - -#include "TimerProfiler.h" -#include "utils/Logger.h" -#include "utils/String_utils.h" -#include "utils/mardyn_assert.h" -#include "utils/xmlfileUnits.h" - -using namespace std; -using Log::global_log; - -const string TimerProfiler::_baseTimerName = "_baseTimer"; - -TimerProfiler::TimerProfiler(): _numElapsedIterations(0), _displayMode(Displaymode::ALL) { - _timers[_baseTimerName] = _Timer(_baseTimerName); - readInitialTimersFromFile(""); -} - -void TimerProfiler::readXML(XMLfileUnits& xmlconfig) { - std::string displayMode; - if(xmlconfig.getNodeValue("displaymode", displayMode)) { - global_log->info() << "Timer display mode: " << displayMode << endl; - if(displayMode == "all") { - setDisplayMode(Displaymode::ALL); - } else if (displayMode == "active") { - setDisplayMode(Displaymode::ACTIVE); - } else if (displayMode == "non-zero") { - setDisplayMode(Displaymode::NON_ZERO); - } else if (displayMode == "none") { - setDisplayMode(Displaymode::NONE); - } else { - global_log->error() << "Unknown display mode: " << displayMode << endl; - } - } -} - - -Timer* TimerProfiler::getTimer(string timerName){ - auto timerProfiler = _timers.find(timerName); - if(timerProfiler != _timers.end()) { - return (timerProfiler->second)._timer.get(); - } - return nullptr; -} - -void TimerProfiler::registerTimer(string timerName, vector parentTimerNames, Timer *timer, bool activate){ - global_log->debug() << "Registering timer: " << timerName << " [parents: " << string_utils::join(parentTimerNames, string(", ")) << "]" << endl; - - if (!activate && timer){ - timer->deactivateTimer(); - } - _timers[timerName] = _Timer(timerName, timer); - - if (parentTimerNames.empty()) { - parentTimerNames.push_back(_baseTimerName); - } - for (const auto& parentTimerName : parentTimerNames) { - _timers[timerName]._parentTimerNames.push_back(parentTimerName); - _timers[parentTimerName]._childTimerNames.push_back(timerName); - } -} - -void TimerProfiler::activateTimer(string timerName){ - if (!_timers.count(timerName)) return ; - _timers[timerName]._timer->activateTimer(); -} - -void TimerProfiler::deactivateTimer(string timerName){ - if (!_timers.count(timerName)) return ; - _timers[timerName]._timer->deactivateTimer(); -} - -void TimerProfiler::setSyncTimer(string timerName, bool sync){ - if (!_timers.count(timerName)) return ; - _timers[timerName]._timer->set_sync(sync); -} - -void TimerProfiler::print(string timerName, string outputPrefix){ - if ( ! _checkTimer(timerName, false)) { - _debugMessage(timerName); - return; - } - if( (getDisplayMode() == Displaymode::ALL) || - (getDisplayMode() == Displaymode::ACTIVE && getTimer(timerName)->isActive()) || - (getDisplayMode() == Displaymode::NON_ZERO && getTimer(timerName)->get_etime() > 0) - ) { - global_log->info() << outputPrefix << getOutputString(timerName) << getTime(timerName) << " sec" << endl; - } -} - -void TimerProfiler::printTimers(string timerName, string outputPrefix){ - if (!_timers.count(timerName)) return ; - if (_checkTimer(timerName)){ - print(timerName, outputPrefix); - outputPrefix += "\t"; - } - for(const auto& childTimerName : _timers[timerName]._childTimerNames){ - printTimers(childTimerName, outputPrefix); - } -} - -void TimerProfiler::start(string timerName){ - #ifdef _OPENMP - #pragma omp critical - #endif - { - if (_checkTimer(timerName)) { - getTimer(timerName)->start(); - } else { - _debugMessage(timerName); - } - } -} - -void TimerProfiler::stop(string timerName){ - #ifdef _OPENMP - #pragma omp critical - #endif - { - if (_checkTimer(timerName)) { - getTimer(timerName)->stop(); - } else { - _debugMessage(timerName); - } - } -} - -void TimerProfiler::reset(string timerName){ - if (_checkTimer(timerName)){ - getTimer(timerName)->reset(); - } - else{ - _debugMessage(timerName); - } -} - -void TimerProfiler::resetTimers(string startingTimerName){ - if (startingTimerName.compare(_baseTimerName)) { - _numElapsedIterations = 0; - } - - if (!_timers.count(startingTimerName)) return ; - reset(startingTimerName); - for(auto childTimerName : _timers[startingTimerName]._childTimerNames){ - resetTimers(childTimerName); - } -} - -void TimerProfiler::readInitialTimersFromFile(string fileName){ - //temporary until read from .xml file is implemented - - //timer classes for grouping timers -> easier printing and resetting - vector timerClasses = { - "COMMUNICATION_PARTNER", - "SIMULATION", - "UNIFORM_PSEUDO_PARTICLE_CONTAINER", - "GENERATORS", - "CELL_PROCESSORS", - "TUNERS", - "IO" - }; - - /************************************************************** - * There are 4 unused timers in UniformPseudoParticleContainer - * 1) UNIFORM_PSEUDO_PARTICLE_CONTAINER_PROCESS_CELLS -> there were calls to set_sync and to reset, but no start/stop - * 2) UNIFORM_PSEUDO_PARTICLE_CONTAINER_PROCESS_FAR_FIELD -> there were calls to set_sync and to reset, but no start/stop - * 3) UNIFORM_PSEUDO_PARTICLE_CONTAINER_GATHER_EVAL_M -> not used at all... - * 4) UNIFORM_PSEUDO_PARTICLE_CONTAINER_GATHER_EVAL_LM -> not used at all... - **************************************************************/ - vector, bool>> timerAttrs = { - make_tuple("VECTORIZATION_TUNER_TUNER", vector{"TUNERS"}, true), - make_tuple("AQUEOUS_NA_CL_GENERATOR_INPUT", vector{"GENERATORS"}, true), - make_tuple("CRYSTAL_LATTICE_GENERATOR_INPUT", vector{"GENERATORS"}, true), - make_tuple("CUBIC_GRID_GENERATOR_INPUT", vector{"GENERATORS"}, true), - make_tuple("DROPLET_GENERATOR_INPUT", vector{"GENERATORS"}, true), - make_tuple("MS2RST_GENERATOR_INPUT", vector{"GENERATORS"}, true), - make_tuple("REYLEIGH_TAYLOR_GENERATOR_INPUT", vector{"GENERATORS"}, true), - make_tuple("REPLICA_GENERATOR_VLE_INPUT", vector{"GENERATORS"}, true), - make_tuple("L2P_CELL_PROCESSOR_L2P", vector{"CELL_PROCESSORS"}, true), - make_tuple("P2M_CELL_PROCESSOR_P2M", vector{"CELL_PROCESSORS"}, true), - make_tuple("VECTORIZED_CHARGE_P2P_CELL_PROCESSOR_VCP2P", vector{"CELL_PROCESSORS"}, true), - make_tuple("VECTORIZED_LJP2P_CELL_PROCESSOR_VLJP2P", vector{"CELL_PROCESSORS"}, true), - make_tuple("BINARY_READER_INPUT", vector{"IO"}, true), - make_tuple("INPUT_OLDSTYLE_INPUT", vector{"IO"}, true), - make_tuple("MPI_IO_READER_INPUT", vector{"IO"}, true), - make_tuple("MPI_CHECKPOINT_WRITER_INPUT", vector{"IO"}, true), - make_tuple("SIMULATION_LOOP", vector{"SIMULATION"}, true), - make_tuple("SIMULATION_DECOMPOSITION", vector{"SIMULATION_LOOP"}, true), - make_tuple("SIMULATION_COMPUTATION", vector{"SIMULATION_LOOP"}, true), -#ifdef QUICKSCHED - make_tuple("QUICKSCHED", vector{"SIMULATION_LOOP"}, true), -#endif - make_tuple("SIMULATION_PER_STEP_IO", vector{"SIMULATION_LOOP"}, true), - make_tuple("SIMULATION_IO", vector{"SIMULATION"}, true), - make_tuple("SIMULATION_UPDATE_CONTAINER", vector{"SIMULATION_DECOMPOSITION"}, true), - make_tuple("SIMULATION_MPI_OMP_COMMUNICATION", vector{"SIMULATION_DECOMPOSITION"}, true), - make_tuple("SIMULATION_UPDATE_CACHES", vector{"SIMULATION_DECOMPOSITION"}, true), - make_tuple("SIMULATION_FORCE_CALCULATION", vector{"SIMULATION_COMPUTATION"}, true), - make_tuple("COMMUNICATION_PARTNER_INIT_SEND", vector{"COMMUNICATION_PARTNER", "SIMULATION_MPI_OMP_COMMUNICATION"}, true), - make_tuple("COMMUNICATION_PARTNER_TEST_RECV", vector{"COMMUNICATION_PARTNER", "SIMULATION_MPI_OMP_COMMUNICATION"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_PROCESS_CELLS", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_ALL_REDUCE", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_GATHER_WELL_SEP_LO_GLOBAL", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_PROPAGATE_CELL_LO_GLOBAL", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_COMBINE_MP_CELL_GLOBAL", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_COMBINE_MP_CELL_LOKAL", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_GATHER_WELL_SEP_LO_LOKAL", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_PROPAGATE_CELL_LO_LOKAL", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_PROCESS_FAR_FIELD", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_COMMUNICATION_HALOS", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_HALO_GATHER", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_BUSY_WAITING", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_FMM_COMPLETE", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_GLOBAL_M2M_CALCULATION", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_GLOBAL_M2M_INIT", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_GLOBAL_M2M_FINALIZE", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_GLOBAL_M2M_TRAVERSAL", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_GATHER_EVAL_M", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_GATHER_EVAL_LM", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_ALL_REDUCE_ME", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_STOP_LEVEL", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true) - }; - - for (auto timerClass : timerClasses){ - registerTimer(timerClass, vector()); - } - for (auto timerAttr : timerAttrs){ - registerTimer(get<0>(timerAttr), get<1>(timerAttr), new Timer(), get<2>(timerAttr)); - } -} - -void TimerProfiler::setOutputString(string timerName, string outputString){ - if (!_timers.count(timerName)) return ; - if (outputString[outputString.length() - 1] != ' ') { - outputString += " "; - } - _timers[timerName]._outputString = outputString; -} - -string TimerProfiler::getOutputString(string timerName){ - if (!_timers.count(timerName)) return string(""); - string output = _timers[timerName]._outputString; - if (output.compare("") == 0){ - output = "Timer "+timerName+" took: "; - } - return output; -} - -double TimerProfiler::getTime(string timerName){ - auto timer = getTimer(timerName); - if(timer != nullptr) { - return timer->get_etime(); - } - return 0.0; -} - -/* private Methods */ - -bool TimerProfiler::_checkTimer(string timerName, bool checkActive){ - return _timers.count(timerName) && _timers[timerName]._timer && (!checkActive || _timers[timerName]._timer->isActive()); -} - -void TimerProfiler::_debugMessage(string timerName){ - if(_timers.count(timerName)){ - global_log->debug()<<"Timer "<debug()<<"Timer "< +#include + +#include "TimerProfiler.h" +#include "utils/Logger.h" +#include "utils/String_utils.h" +#include "utils/mardyn_assert.h" +#include "utils/xmlfileUnits.h" + + + +const std::string TimerProfiler::_baseTimerName = "_baseTimer"; + +TimerProfiler::TimerProfiler(): _numElapsedIterations(0), _displayMode(Displaymode::ALL) { + _timers[_baseTimerName] = _Timer(_baseTimerName); + readInitialTimersFromFile(""); +} + +void TimerProfiler::readXML(XMLfileUnits& xmlconfig) { + std::string displayMode; + if(xmlconfig.getNodeValue("displaymode", displayMode)) { + Log::global_log->info() << "Timer display mode: " << displayMode << std::endl; + if(displayMode == "all") { + setDisplayMode(Displaymode::ALL); + } else if (displayMode == "active") { + setDisplayMode(Displaymode::ACTIVE); + } else if (displayMode == "non-zero") { + setDisplayMode(Displaymode::NON_ZERO); + } else if (displayMode == "none") { + setDisplayMode(Displaymode::NONE); + } else { + Log::global_log->error() << "Unknown display mode: " << displayMode << std::endl; + } + } +} + + +Timer* TimerProfiler::getTimer(std::string timerName){ + auto timerProfiler = _timers.find(timerName); + if(timerProfiler != _timers.end()) { + return (timerProfiler->second)._timer.get(); + } + return nullptr; +} + +void TimerProfiler::registerTimer(std::string timerName, std::vector parentTimerNames, Timer *timer, bool activate){ + Log::global_log->debug() << "Registering timer: " << timerName << " [parents: " << string_utils::join(parentTimerNames, std::string(", ")) << "]" << std::endl; + + if (!activate && timer){ + timer->deactivateTimer(); + } + _timers[timerName] = _Timer(timerName, timer); + + if (parentTimerNames.empty()) { + parentTimerNames.push_back(_baseTimerName); + } + for (const auto& parentTimerName : parentTimerNames) { + _timers[timerName]._parentTimerNames.push_back(parentTimerName); + _timers[parentTimerName]._childTimerNames.push_back(timerName); + } +} + +void TimerProfiler::activateTimer(std::string timerName){ + if (!_timers.count(timerName)) return ; + _timers[timerName]._timer->activateTimer(); +} + +void TimerProfiler::deactivateTimer(std::string timerName){ + if (!_timers.count(timerName)) return ; + _timers[timerName]._timer->deactivateTimer(); +} + +void TimerProfiler::setSyncTimer(std::string timerName, bool sync){ + if (!_timers.count(timerName)) return ; + _timers[timerName]._timer->set_sync(sync); +} + +void TimerProfiler::print(std::string timerName, std::string outputPrefix){ + if ( ! _checkTimer(timerName, false)) { + _debugMessage(timerName); + return; + } + if( (getDisplayMode() == Displaymode::ALL) || + (getDisplayMode() == Displaymode::ACTIVE && getTimer(timerName)->isActive()) || + (getDisplayMode() == Displaymode::NON_ZERO && getTimer(timerName)->get_etime() > 0) + ) { + Log::global_log->info() << outputPrefix << getOutputString(timerName) << getTime(timerName) << " sec" << std::endl; + } +} + +void TimerProfiler::printTimers(std::string timerName, std::string outputPrefix){ + if (!_timers.count(timerName)) return ; + if (_checkTimer(timerName)){ + print(timerName, outputPrefix); + outputPrefix += "\t"; + } + for(const auto& childTimerName : _timers[timerName]._childTimerNames){ + printTimers(childTimerName, outputPrefix); + } +} + +void TimerProfiler::start(std::string timerName){ + #ifdef _OPENMP + #pragma omp critical + #endif + { + if (_checkTimer(timerName)) { + getTimer(timerName)->start(); + } else { + _debugMessage(timerName); + } + } +} + +void TimerProfiler::stop(std::string timerName){ + #ifdef _OPENMP + #pragma omp critical + #endif + { + if (_checkTimer(timerName)) { + getTimer(timerName)->stop(); + } else { + _debugMessage(timerName); + } + } +} + +void TimerProfiler::reset(std::string timerName){ + if (_checkTimer(timerName)){ + getTimer(timerName)->reset(); + } + else{ + _debugMessage(timerName); + } +} + +void TimerProfiler::resetTimers(std::string startingTimerName){ + if (startingTimerName.compare(_baseTimerName)) { + _numElapsedIterations = 0; + } + + if (!_timers.count(startingTimerName)) return ; + reset(startingTimerName); + for(auto childTimerName : _timers[startingTimerName]._childTimerNames){ + resetTimers(childTimerName); + } +} + +void TimerProfiler::readInitialTimersFromFile(std::string fileName){ + //temporary until read from .xml file is implemented + + //timer classes for grouping timers -> easier printing and resetting + std::vector timerClasses = { + "COMMUNICATION_PARTNER", + "SIMULATION", + "UNIFORM_PSEUDO_PARTICLE_CONTAINER", + "GENERATORS", + "CELL_PROCESSORS", + "TUNERS", + "IO" + }; + + /************************************************************** + * There are 4 unused timers in UniformPseudoParticleContainer + * 1) UNIFORM_PSEUDO_PARTICLE_CONTAINER_PROCESS_CELLS -> there were calls to set_sync and to reset, but no start/stop + * 2) UNIFORM_PSEUDO_PARTICLE_CONTAINER_PROCESS_FAR_FIELD -> there were calls to set_sync and to reset, but no start/stop + * 3) UNIFORM_PSEUDO_PARTICLE_CONTAINER_GATHER_EVAL_M -> not used at all... + * 4) UNIFORM_PSEUDO_PARTICLE_CONTAINER_GATHER_EVAL_LM -> not used at all... + **************************************************************/ + std::vector, bool>> timerAttrs = { + std::make_tuple("VECTORIZATION_TUNER_TUNER", std::vector{"TUNERS"}, true), + std::make_tuple("AQUEOUS_NA_CL_GENERATOR_INPUT", std::vector{"GENERATORS"}, true), + std::make_tuple("CRYSTAL_LATTICE_GENERATOR_INPUT", std::vector{"GENERATORS"}, true), + std::make_tuple("CUBIC_GRID_GENERATOR_INPUT", std::vector{"GENERATORS"}, true), + std::make_tuple("DROPLET_GENERATOR_INPUT", std::vector{"GENERATORS"}, true), + std::make_tuple("MS2RST_GENERATOR_INPUT", std::vector{"GENERATORS"}, true), + std::make_tuple("REYLEIGH_TAYLOR_GENERATOR_INPUT", std::vector{"GENERATORS"}, true), + std::make_tuple("REPLICA_GENERATOR_VLE_INPUT", std::vector{"GENERATORS"}, true), + std::make_tuple("L2P_CELL_PROCESSOR_L2P", std::vector{"CELL_PROCESSORS"}, true), + std::make_tuple("P2M_CELL_PROCESSOR_P2M", std::vector{"CELL_PROCESSORS"}, true), + std::make_tuple("VECTORIZED_CHARGE_P2P_CELL_PROCESSOR_VCP2P", std::vector{"CELL_PROCESSORS"}, true), + std::make_tuple("VECTORIZED_LJP2P_CELL_PROCESSOR_VLJP2P", std::vector{"CELL_PROCESSORS"}, true), + std::make_tuple("BINARY_READER_INPUT", std::vector{"IO"}, true), + std::make_tuple("INPUT_OLDSTYLE_INPUT", std::vector{"IO"}, true), + std::make_tuple("MPI_IO_READER_INPUT", std::vector{"IO"}, true), + std::make_tuple("MPI_CHECKPOINT_WRITER_INPUT", std::vector{"IO"}, true), + std::make_tuple("SIMULATION_LOOP", std::vector{"SIMULATION"}, true), + std::make_tuple("SIMULATION_DECOMPOSITION", std::vector{"SIMULATION_LOOP"}, true), + std::make_tuple("SIMULATION_COMPUTATION", std::vector{"SIMULATION_LOOP"}, true), +#ifdef QUICKSCHED + std::make_tuple("QUICKSCHED", std::vector{"SIMULATION_LOOP"}, true), +#endif + std::make_tuple("SIMULATION_PER_STEP_IO", std::vector{"SIMULATION_LOOP"}, true), + std::make_tuple("SIMULATION_IO", std::vector{"SIMULATION"}, true), + std::make_tuple("SIMULATION_UPDATE_CONTAINER", std::vector{"SIMULATION_DECOMPOSITION"}, true), + std::make_tuple("SIMULATION_MPI_OMP_COMMUNICATION", std::vector{"SIMULATION_DECOMPOSITION"}, true), + std::make_tuple("SIMULATION_UPDATE_CACHES", std::vector{"SIMULATION_DECOMPOSITION"}, true), + std::make_tuple("SIMULATION_FORCE_CALCULATION", std::vector{"SIMULATION_COMPUTATION"}, true), + std::make_tuple("COMMUNICATION_PARTNER_INIT_SEND", std::vector{"COMMUNICATION_PARTNER", "SIMULATION_MPI_OMP_COMMUNICATION"}, true), + std::make_tuple("COMMUNICATION_PARTNER_TEST_RECV", std::vector{"COMMUNICATION_PARTNER", "SIMULATION_MPI_OMP_COMMUNICATION"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_PROCESS_CELLS", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_ALL_REDUCE", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_GATHER_WELL_SEP_LO_GLOBAL", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_PROPAGATE_CELL_LO_GLOBAL", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_COMBINE_MP_CELL_GLOBAL", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_COMBINE_MP_CELL_LOKAL", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_GATHER_WELL_SEP_LO_LOKAL", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_PROPAGATE_CELL_LO_LOKAL", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_PROCESS_FAR_FIELD", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_COMMUNICATION_HALOS", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_HALO_GATHER", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_BUSY_WAITING", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_FMM_COMPLETE", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_GLOBAL_M2M_CALCULATION", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_GLOBAL_M2M_INIT", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_GLOBAL_M2M_FINALIZE", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_GLOBAL_M2M_TRAVERSAL", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_GATHER_EVAL_M", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_GATHER_EVAL_LM", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_ALL_REDUCE_ME", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_STOP_LEVEL", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true) + }; + + for (auto timerClass : timerClasses){ + registerTimer(timerClass, std::vector()); + } + for (auto timerAttr : timerAttrs){ + registerTimer(std::get<0>(timerAttr), std::get<1>(timerAttr), new Timer(), std::get<2>(timerAttr)); + } +} + +void TimerProfiler::setOutputString(std::string timerName, std::string outputString){ + if (!_timers.count(timerName)) return ; + if (outputString[outputString.length() - 1] != ' ') { + outputString += " "; + } + _timers[timerName]._outputString = outputString; +} + +std::string TimerProfiler::getOutputString(std::string timerName){ + if (!_timers.count(timerName)) return std::string(""); + std::string output = _timers[timerName]._outputString; + if (output.compare("") == 0){ + output = "Timer "+timerName+" took: "; + } + return output; +} + +double TimerProfiler::getTime(std::string timerName){ + auto timer = getTimer(timerName); + if(timer != nullptr) { + return timer->get_etime(); + } + return 0.0; +} + +/* private Methods */ + +bool TimerProfiler::_checkTimer(std::string timerName, bool checkActive){ + return _timers.count(timerName) && _timers[timerName]._timer && (!checkActive || _timers[timerName]._timer->isActive()); +} + +void TimerProfiler::_debugMessage(std::string timerName){ + if(_timers.count(timerName)){ + Log::global_log->debug()<<"Timer "<debug()<<"Timer "<debug() information message about timer. + @brief Prints in Log::global_log->debug() information message about timer. @param timerName The name of the timer */ void _debugMessage(std::string timerName); diff --git a/src/io/TimerWriter.cpp b/src/io/TimerWriter.cpp index 5f24b03926..f027c196f0 100644 --- a/src/io/TimerWriter.cpp +++ b/src/io/TimerWriter.cpp @@ -13,9 +13,9 @@ void TimerWriter::readXML(XMLfileUnits& xmlconfig) { xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "Write frequency: " << _writeFrequency << endl; + Log::global_log->info() << "Write frequency: " << _writeFrequency << std::endl; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "Output prefix: " << _outputPrefix << endl; + Log::global_log->info() << "Output prefix: " << _outputPrefix << std::endl; XMLfile::Query query = xmlconfig.query("timers/timer"); std::string oldpath = xmlconfig.getcurrentnodepath(); @@ -29,11 +29,11 @@ void TimerWriter::readXML(XMLfileUnits& xmlconfig) { xmlconfig.getNodeValue("incremental", incrementalTimer); _incremental.push_back(incrementalTimer); - global_log->info() << "Added timer for LB monitoring: " << timername << ", incremental: " << incrementalTimer + Log::global_log->info() << "Added timer for LB monitoring: " << timername << ", incremental: " << incrementalTimer << std::endl; } if (_timerNames.empty()) { - global_log->error() << "TimerWriter: no timers given. make sure you specify them correctly." << std::endl; + Log::global_log->error() << "TimerWriter: no timers given. make sure you specify them correctly." << std::endl; Simulation::exit(242367); } xmlconfig.changecurrentnode(oldpath); @@ -43,12 +43,12 @@ void TimerWriter::init(ParticleContainer* /*particleContainer*/, DomainDecompBas auto rank = domainDecomp->getRank(); std::stringstream filename; - const auto time_tNow = std::chrono::system_clock::to_time_t(chrono::system_clock::now()); + const auto time_tNow = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); const auto maxRank = domainDecomp->getNumProcs(); const auto numDigitsMaxRank = std::to_string(maxRank).length(); tm unused{}; - filename << _outputPrefix << "-rank" << setfill('0') << setw(numDigitsMaxRank) << rank << "_" + filename << _outputPrefix << "-rank" << std::setfill('0') << std::setw(numDigitsMaxRank) << rank << "_" << std::put_time(localtime_r(&time_tNow, &unused), "%Y-%m-%d_%H-%M-%S") << ".dat"; _fileStream.open(filename.str(), std::ofstream::out); diff --git a/src/io/VISWriter.cpp b/src/io/VISWriter.cpp index ce9a029985..55e64e84d5 100644 --- a/src/io/VISWriter.cpp +++ b/src/io/VISWriter.cpp @@ -15,10 +15,8 @@ #include #endif -using Log::global_log; -using namespace std; -VISWriter::VISWriter(unsigned long writeFrequency, string outputPrefix) { +VISWriter::VISWriter(unsigned long writeFrequency, std::string outputPrefix) { _outputPrefix = outputPrefix; _writeFrequency = writeFrequency; _wroteVIS = false; @@ -36,24 +34,24 @@ VISWriter::~VISWriter(){} void VISWriter::readXML(XMLfileUnits& xmlconfig) { _writeFrequency = 1; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "Write frequency: " << _writeFrequency << endl; + Log::global_log->info() << "Write frequency: " << _writeFrequency << std::endl; _outputPrefix = "mardyn"; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "Output prefix: " << _outputPrefix << endl; - + Log::global_log->info() << "Output prefix: " << _outputPrefix << std::endl; + int appendTimestamp = 0; xmlconfig.getNodeValue("appendTimestamp", appendTimestamp); if(appendTimestamp > 0) { _appendTimestamp = true; } - global_log->info() << "Append timestamp: " << _appendTimestamp << endl; + Log::global_log->info() << "Append timestamp: " << _appendTimestamp << std::endl; } void VISWriter::init(ParticleContainer * /*particleContainer*/, DomainDecompBase * /*domainDecomp*/, Domain * /*domain*/) { - string filename = _outputPrefix + ".vis"; - ofstream fileout(filename.c_str(), ios::out); + std::string filename = _outputPrefix + ".vis"; + std::ofstream fileout(filename.c_str(), std::ios::out); fileout.close(); } @@ -61,14 +59,14 @@ void VISWriter::endStep(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain * /*domain*/, unsigned long simstep) { if (simstep % _writeFrequency == 0) { - stringstream filenamestream, outputstream; + std::stringstream filenamestream, outputstream; filenamestream << _outputPrefix; if(_appendTimestamp) { filenamestream << "-" << gettimestring(); } filenamestream << ".vis"; - + std::vector filename(filenamestream.str().size()+1); strcpy(filename.data(),filenamestream.str().c_str()); @@ -82,13 +80,13 @@ void VISWriter::endStep(ParticleContainer *particleContainer, _wroteVIS = true; } else - outputstream << "#" << endl; + outputstream << "#" << std::endl; #ifdef ENABLE_MPI } #endif // originally VIS files had a fixed width of 8 (and no t), here I use 12 (with 2 for t) - //ostrm << "t x y z q0 q1 q2 q3" << endl; + //ostrm << "t x y z q0 q1 q2 q3" << std::endl; for (auto pos = particleContainer->iterator(ParticleIterator::ONLY_INNER_AND_BOUNDARY); pos.isValid(); ++pos) { bool halo = false; for (unsigned short d = 0; d < 3; d++) { @@ -98,12 +96,12 @@ void VISWriter::endStep(ParticleContainer *particleContainer, } } if (!halo) { - outputstream << setiosflags(ios::fixed) << setw(8) << pos->getID() << setw(2) - << pos->componentid() << setprecision(3); - for (unsigned short d = 0; d < 3; d++) outputstream << setw(11) << pos->r(d); - outputstream << setprecision(3) << setw(7) << pos->q().qw() << setw(7) << pos->q().qx() - << setw(7) << pos->q().qy()<< setw(7) << pos->q().qz() - << setw(9) << right << 0 << "\n"; + outputstream << setiosflags(std::ios::fixed) << std::setw(8) << pos->getID() << std::setw(2) + << pos->componentid() << std::setprecision(3); + for (unsigned short d = 0; d < 3; d++) outputstream << std::setw(11) << pos->r(d); + outputstream << std::setprecision(3) << std::setw(7) << pos->q().qw() << std::setw(7) << pos->q().qx() + << std::setw(7) << pos->q().qy()<< std::setw(7) << pos->q().qz() + << std::setw(9) << std::right << 0 << "\n"; } } long outputsize = outputstream.str().size(); @@ -135,7 +133,7 @@ void VISWriter::endStep(ParticleContainer *particleContainer, MPI_File_write(fh, output.data(), outputsize, MPI_CHAR, &status); MPI_File_close(&fh); #else - ofstream fileout(filename.data(), ios::out|ios::app); + std::ofstream fileout(filename.data(), std::ios::out|std::ios::app); fileout << output.data(); fileout.close(); #endif diff --git a/src/io/VISWriter.h b/src/io/VISWriter.h index 727d6ad2d8..6ac9133144 100644 --- a/src/io/VISWriter.h +++ b/src/io/VISWriter.h @@ -7,7 +7,7 @@ #include class ParticleContainer; -class DomainDecompBase; +class DomainDecompBase; class Domain; class VISWriter : public PluginBase { @@ -40,7 +40,7 @@ class VISWriter : public PluginBase { ); void finish(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain); - + std::string getPluginName() { return std::string("VISWriter"); } diff --git a/src/io/XyzWriter.cpp b/src/io/XyzWriter.cpp index aad6966597..ee6a23f939 100644 --- a/src/io/XyzWriter.cpp +++ b/src/io/XyzWriter.cpp @@ -12,23 +12,20 @@ #include "Simulation.h" -using Log::global_log; -using namespace std; - void XyzWriter::readXML(XMLfileUnits& xmlconfig) { _writeFrequency = 1; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "Write frequency: " << _writeFrequency << std::endl; + Log::global_log->info() << "Write frequency: " << _writeFrequency << std::endl; _outputPrefix = "mardyn"; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "Output prefix: " << _outputPrefix << std::endl; + Log::global_log->info() << "Output prefix: " << _outputPrefix << std::endl; xmlconfig.getNodeValue("incremental", _incremental); - global_log->info() << "Incremental numbers: " << _incremental << std::endl; + Log::global_log->info() << "Incremental numbers: " << _incremental << std::endl; xmlconfig.getNodeValue("appendTimestamp", _appendTimestamp); - global_log->info() << "Append timestamp: " << _appendTimestamp << std::endl; + Log::global_log->info() << "Append timestamp: " << _appendTimestamp << std::endl; } void XyzWriter::init(ParticleContainer * /*particleContainer*/, DomainDecompBase * /*domainDecomp*/, @@ -37,8 +34,8 @@ void XyzWriter::init(ParticleContainer * /*particleContainer*/, DomainDecompBase void XyzWriter::endStep(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain * /*domain*/, unsigned long simstep) { if( simstep % _writeFrequency == 0) { - vector* components = _simulation.getEnsemble()->getComponents(); - stringstream filenamestream; + std::vector* components = _simulation.getEnsemble()->getComponents(); + std::stringstream filenamestream; filenamestream << _outputPrefix; if(_incremental) { @@ -51,10 +48,10 @@ void XyzWriter::endStep(ParticleContainer *particleContainer, DomainDecompBase * filenamestream << "-" << gettimestring(); } filenamestream << ".xyz"; - + int ownRank = domainDecomp->getRank(); if( ownRank == 0 ) { - ofstream xyzfilestream( filenamestream.str(). c_str() ); + std::ofstream xyzfilestream( filenamestream.str(). c_str() ); unsigned number = 0; for (unsigned i=0; i< components->size(); i++){ number += (*components)[i].getNumMolecules()*((*components)[i].numLJcenters() + (*components)[i].numDipoles() + (*components)[i].numCharges() + (*components)[i].numQuadrupoles()); @@ -66,7 +63,7 @@ void XyzWriter::endStep(ParticleContainer *particleContainer, DomainDecompBase * for( int process = 0; process < domainDecomp->getNumProcs(); process++ ){ domainDecomp->barrier(); if( ownRank == process ){ - ofstream xyzfilestream( filenamestream.str().c_str(), ios::app ); + std::ofstream xyzfilestream( filenamestream.str().c_str(), std::ios::app ); for(ParticleIterator tempMol = particleContainer->iterator(ParticleIterator::ONLY_INNER_AND_BOUNDARY); tempMol.isValid(); ++tempMol){ for (unsigned i=0; i< tempMol->numLJcenters(); i++){ if( tempMol->componentid() == 0) { xyzfilestream << "Ar ";} diff --git a/src/io/XyzWriter.h b/src/io/XyzWriter.h index 5a2d3dae19..76e80e0c92 100644 --- a/src/io/XyzWriter.h +++ b/src/io/XyzWriter.h @@ -45,7 +45,7 @@ class XyzWriter : public PluginBase { std::string getPluginName() override { return std::string("XyzWriter"); } - + static PluginBase* createInstance() { return new XyzWriter(); } private: std::string _outputPrefix; diff --git a/src/io/tests/Adios2IOTest.cpp b/src/io/tests/Adios2IOTest.cpp index db1054e030..94d64e7d57 100644 --- a/src/io/tests/Adios2IOTest.cpp +++ b/src/io/tests/Adios2IOTest.cpp @@ -53,7 +53,7 @@ void Adios2IOTest::initParticles() { // init ids std::iota(std::begin(_ids), std::end(_ids), 0); - + // init positions std::mt19937 rnd; rnd.seed(666); @@ -125,7 +125,7 @@ void Adios2IOTest::testWriteCheckpoint() { } particleContainer->addParticles(particles); - + auto adios2writer = std::make_shared(); adios2writer->init(nullptr, nullptr, nullptr); adios2writer->testInit(_comp ,_filename); @@ -133,18 +133,18 @@ void Adios2IOTest::testWriteCheckpoint() { std::shared_ptr domaindecomp; #ifdef ENABLE_MPI MPI_CHECK( MPI_Comm_rank(MPI_COMM_WORLD, &ownrank) ); - global_log->info() << "[Adios2IOTest] Creating standard domain decomposition ... " << endl; + Log::global_log->info() << "[Adios2IOTest] Creating standard domain decomposition ... " << std::endl; domaindecomp = std::make_shared(); #else - global_log->info() << "[Adios2IOTest] Creating alibi domain decomposition ... " << endl; + Log::global_log->info() << "[Adios2IOTest] Creating alibi domain decomposition ... " << std::endl; domaindecomp = std::make_shared(); #endif - global_log->info() << "[Adios2IOTest] ParticleContainer num particles:" + Log::global_log->info() << "[Adios2IOTest] ParticleContainer num particles:" << particleContainer->getNumberOfParticles() << std::endl; - + ASSERT_EQUAL(static_cast(NUM_PARTICLES), particleContainer->getNumberOfParticles()); - + auto domain = std::make_shared(ownrank); domain->setGlobalLength(0, _box_upper[0]); domain->setGlobalLength(1, _box_upper[1]); @@ -153,8 +153,8 @@ void Adios2IOTest::testWriteCheckpoint() { adios2writer->endStep(particleContainer.get(), domaindecomp.get(), domain.get(), 0); adios2writer->finish(nullptr, nullptr, nullptr); - global_log->info() << "[Adios2IOTest] Writing successful!" << std::endl; - + Log::global_log->info() << "[Adios2IOTest] Writing successful!" << std::endl; + ASSERT_EQUAL(true, std::filesystem::is_directory(_filename)); } @@ -171,15 +171,15 @@ void Adios2IOTest::testReadCheckpoint() { MPI_CHECK(MPI_Comm_size(MPI_COMM_WORLD, &num_procs)); MPI_CHECK(MPI_Comm_rank(MPI_COMM_WORLD, &ownrank)); #endif - + #ifdef MARDYN_AUTOPAS _inputPatricleContainer = std::make_shared(_cutoff); _inputPatricleContainer->rebuild(_box_lower.data(), _box_upper.data()); #else _inputPatricleContainer = std::make_shared(_box_lower.data(), _box_upper.data(), _cutoff); #endif - - + + _inputDomain = std::make_shared(ownrank); _inputDomain->setGlobalLength(0, _box_upper[0]); _inputDomain->setGlobalLength(1, _box_upper[1]); @@ -193,11 +193,11 @@ void Adios2IOTest::testReadCheckpoint() { pcount = adios2read->readPhaseSpace(_inputPatricleContainer.get(), _inputDomain.get(), _inputDomainDecomp.get()); } catch (const std::exception& e) { - global_log->error() << "[Adios2IOTest] exception: " << e.what() << std::endl; + Log::global_log->error() << "[Adios2IOTest] exception: " << e.what() << std::endl; } ASSERT_EQUAL(static_cast(NUM_PARTICLES * num_procs), pcount); - + for (auto it = _inputPatricleContainer->iterator(ParticleIterator::ONLY_INNER_AND_BOUNDARY); it.isValid(); ++it) { auto i = it->getID(); for (int j = 0; j < 3; ++j) { @@ -208,4 +208,4 @@ void Adios2IOTest::testReadCheckpoint() { } } -#endif \ No newline at end of file +#endif diff --git a/src/io/tests/Adios2IOTest.h b/src/io/tests/Adios2IOTest.h index 5f3dfcf499..53c36b2318 100644 --- a/src/io/tests/Adios2IOTest.h +++ b/src/io/tests/Adios2IOTest.h @@ -34,7 +34,7 @@ class Adios2IOTest : public utils::TestWithSimulationSetup { virtual ~Adios2IOTest() = default; void initParticles(); - + void testWriteCheckpoint(); void testReadCheckpoint(); @@ -59,7 +59,7 @@ class Adios2IOTest : public utils::TestWithSimulationSetup { double _cutoff = 2.5; std::string _filename = "adios2restart.bp"; - + }; #endif \ No newline at end of file diff --git a/src/io/tests/CheckpointRestartTest.cpp b/src/io/tests/CheckpointRestartTest.cpp index d7a8ff0e68..b393be2b81 100644 --- a/src/io/tests/CheckpointRestartTest.cpp +++ b/src/io/tests/CheckpointRestartTest.cpp @@ -14,8 +14,6 @@ #include "io/tests/CheckpointRestartTest.h" -using namespace std; - #if !defined(ENABLE_REDUCED_MEMORY_MODE) TEST_SUITE_REGISTRATION(CheckpointRestartTest); diff --git a/src/io/tests/RDFTest.cpp b/src/io/tests/RDFTest.cpp index 9d5e9bbb22..f9d2be4020 100644 --- a/src/io/tests/RDFTest.cpp +++ b/src/io/tests/RDFTest.cpp @@ -22,7 +22,6 @@ #include -using namespace std; #if !defined(ENABLE_REDUCED_MEMORY_MODE) && !defined(MARDYN_AUTOPAS) TEST_SUITE_REGISTRATION(RDFTest); @@ -62,7 +61,7 @@ void RDFTest::testRDFCountSequential12(ParticleContainer* moleculeContainer) { ParticlePairs2PotForceAdapter handler(*_domain); double cutoff = moleculeContainer->getCutoff(); - vector* components = global_simulation->getEnsemble()->getComponents(); + std::vector* components = global_simulation->getEnsemble()->getComponents(); ASSERT_EQUAL((size_t) 1, components->size()); moleculeContainer->update(); @@ -101,7 +100,7 @@ void RDFTest::testRDFCountSequential12(ParticleContainer* moleculeContainer) { for (int i = 0; i < 100; i++) { // std::cout << " i=" << i << " global = " <getCutoff(); - vector* components = global_simulation->getEnsemble()->getComponents(); + std::vector* components = global_simulation->getEnsemble()->getComponents(); ASSERT_EQUAL((size_t) 1, components->size()); _domainDecomposition->balanceAndExchange(1.0, true, moleculeContainer, _domain); diff --git a/src/io/vtk/VTKGridWriter.cpp b/src/io/vtk/VTKGridWriter.cpp index ed793d07a2..07f15fdfa0 100644 --- a/src/io/vtk/VTKGridWriter.cpp +++ b/src/io/vtk/VTKGridWriter.cpp @@ -16,7 +16,6 @@ #include "utils/Logger.h" #include "parallel/DomainDecompBase.h" -using namespace Log; VTKGridWriter::VTKGridWriter() : _numCells(0), _numVertices(0) { @@ -30,9 +29,9 @@ VTKGridWriter::~VTKGridWriter() { } void VTKGridWriter::readXML(XMLfileUnits& xmlconfig) { xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "VTKMoleculeWriter: Write frequency: " << _writeFrequency << std::endl; + Log::global_log->info() << "VTKMoleculeWriter: Write frequency: " << _writeFrequency << std::endl; xmlconfig.getNodeValue("outputprefix", _fileName); - global_log->info() << "VTKMoleculeWriter: Output prefix: " << _fileName << std::endl; + Log::global_log->info() << "VTKMoleculeWriter: Output prefix: " << _fileName << std::endl; if (_writeFrequency <= 0) { Log::global_log->error() << "VTKMoleculeWriter: writeFrequency must be > 0!" << std::endl; @@ -48,7 +47,7 @@ void VTKGridWriter::endStep( LinkedCells* container = dynamic_cast(particleContainer); #ifndef NDEBUG if (container == NULL) { - global_log->error() << "VTKGridWriter works only with plottable LinkedCells!" << std::endl; + Log::global_log->error() << "VTKGridWriter works only with plottable LinkedCells!" << std::endl; Simulation::exit(1); } #endif @@ -114,7 +113,7 @@ void VTKGridWriter::init(ParticleContainer *particleContainer, DomainDecompBase * /*domainDecomposition*/, Domain * /*domain*/) { #ifndef NDEBUG if (dynamic_cast(particleContainer) == NULL) { - global_log->error() << "VTKGridWriter works only with LinkCells!" << std::endl; + Log::global_log->error() << "VTKGridWriter works only with LinkCells!" << std::endl; Simulation::exit(1); } #endif diff --git a/src/io/vtk/VTKGridWriterImplementation.cpp b/src/io/vtk/VTKGridWriterImplementation.cpp index 77649e88f3..2f1bcc00d8 100644 --- a/src/io/vtk/VTKGridWriterImplementation.cpp +++ b/src/io/vtk/VTKGridWriterImplementation.cpp @@ -13,7 +13,6 @@ #include -using namespace Log; VTKGridWriterImplementation::VTKGridWriterImplementation(int rank, const std::vector* processorSpeeds) : _vtkFile(NULL), _parallelVTKFile(NULL), _numCellsPlotted(0), @@ -133,7 +132,7 @@ void VTKGridWriterImplementation::plotCell(VTKGridCell& cell) { void VTKGridWriterImplementation::writeVTKFile(const std::string& fileName) { #ifndef NDEBUG if (!isVTKFileInitialized()) { - global_log->error() << "VTKMoleculeWriterImplementation::writeVTKFile(): vtkFile not initialized!" << std::endl; + Log::global_log->error() << "VTKMoleculeWriterImplementation::writeVTKFile(): vtkFile not initialized!" << std::endl; return; } #endif @@ -190,7 +189,7 @@ void VTKGridWriterImplementation::initializeParallelVTKFile(const std::vectorerror() << "VTKMoleculeWriterImplementation::writeParallelVTKFile(): parallelVTKFile not initialized!" << std::endl; + Log::global_log->error() << "VTKMoleculeWriterImplementation::writeParallelVTKFile(): parallelVTKFile not initialized!" << std::endl; return; } #endif diff --git a/src/io/vtk/VTKMoleculeWriter.cpp b/src/io/vtk/VTKMoleculeWriter.cpp index f8f5159e15..98b64cd676 100644 --- a/src/io/vtk/VTKMoleculeWriter.cpp +++ b/src/io/vtk/VTKMoleculeWriter.cpp @@ -15,8 +15,6 @@ #include #include -using namespace std; -using namespace Log; #ifdef ENABLE_MPI #include @@ -26,16 +24,16 @@ using namespace Log; void VTKMoleculeWriter::readXML(XMLfileUnits& xmlconfig) { xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "VTKMoleculeWriter: Write frequency: " << _writeFrequency << std::endl; + Log::global_log->info() << "VTKMoleculeWriter: Write frequency: " << _writeFrequency << std::endl; xmlconfig.getNodeValue("writefrequencyOffset", _writeFrequencyOffset); - global_log->info() << "VTKMoleculeWriter: Write frequency offset: " << _writeFrequencyOffset << std::endl; + Log::global_log->info() << "VTKMoleculeWriter: Write frequency offset: " << _writeFrequencyOffset << std::endl; // _writeInitialState is only relevant if the offset is != 0 if (_writeFrequencyOffset != 0) { xmlconfig.getNodeValue("writeInitialState", _writeInitialState); - global_log->info() << "VTKMoleculeWriter: Write initial state: " << _writeInitialState << std::endl; + Log::global_log->info() << "VTKMoleculeWriter: Write initial state: " << _writeInitialState << std::endl; } xmlconfig.getNodeValue("outputprefix", _fileName); - global_log->info() << "VTKMoleculeWriter: Output prefix: " << _fileName << std::endl; + Log::global_log->info() << "VTKMoleculeWriter: Output prefix: " << _fileName << std::endl; if (_writeFrequency <= 0) { Log::global_log->error() << "VTKMoleculeWriter: writeFrequency must be > 0!" << std::endl; diff --git a/src/io/vtk/VTKMoleculeWriterImplementation.cpp b/src/io/vtk/VTKMoleculeWriterImplementation.cpp index f568c41b65..c8779f80bb 100644 --- a/src/io/vtk/VTKMoleculeWriterImplementation.cpp +++ b/src/io/vtk/VTKMoleculeWriterImplementation.cpp @@ -12,7 +12,6 @@ #include -using namespace Log; VTKMoleculeWriterImplementation::VTKMoleculeWriterImplementation(int rank, bool plotCenters) : _vtkFile(NULL), _parallelVTKFile(NULL), _numMoleculesPlotted(0), _rank(rank), _plotCenters(plotCenters) { @@ -75,7 +74,7 @@ void VTKMoleculeWriterImplementation::plotMolecule(Molecule& molecule) { #ifndef NDEBUG if (!isVTKFileInitialized()) { - global_log->error() << "VTKMoleculeWriterImplementation::plotMolecule(): vtkFile not initialized!" << std::endl; + Log::global_log->error() << "VTKMoleculeWriterImplementation::plotMolecule(): vtkFile not initialized!" << std::endl; return; } #endif @@ -163,7 +162,7 @@ void VTKMoleculeWriterImplementation::plotCenter(Molecule& molecule, int centerI void VTKMoleculeWriterImplementation::writeVTKFile(const std::string& fileName) { #ifndef NDEBUG if (!isVTKFileInitialized()) { - global_log->error() << "VTKMoleculeWriterImplementation::writeVTKFile(): vtkFile not initialized!" << std::endl; + Log::global_log->error() << "VTKMoleculeWriterImplementation::writeVTKFile(): vtkFile not initialized!" << std::endl; return; } #endif @@ -218,7 +217,7 @@ void VTKMoleculeWriterImplementation::initializeParallelVTKFile(const std::vecto void VTKMoleculeWriterImplementation::writeParallelVTKFile(const std::string& fileName) { #ifndef NDEBUG if (!isParallelVTKFileInitialized()) { - global_log->error() << "VTKMoleculeWriterImplementation::writeParallelVTKFile(): parallelVTKFile not initialized!" << std::endl; + Log::global_log->error() << "VTKMoleculeWriterImplementation::writeParallelVTKFile(): parallelVTKFile not initialized!" << std::endl; return; } #endif diff --git a/src/io/vtk/tests/VTKGridWriterTest.cpp b/src/io/vtk/tests/VTKGridWriterTest.cpp index 74f4003796..2f7caa98e0 100644 --- a/src/io/vtk/tests/VTKGridWriterTest.cpp +++ b/src/io/vtk/tests/VTKGridWriterTest.cpp @@ -78,4 +78,4 @@ void VTKGridWriterTest::testEmptyGrid() { } -#endif \ No newline at end of file +#endif diff --git a/src/io/vtk/tests/VTKMoleculeWriterTest.cpp b/src/io/vtk/tests/VTKMoleculeWriterTest.cpp index ae4f834958..74b4d35ffd 100644 --- a/src/io/vtk/tests/VTKMoleculeWriterTest.cpp +++ b/src/io/vtk/tests/VTKMoleculeWriterTest.cpp @@ -23,7 +23,6 @@ #include -using namespace Log; TEST_SUITE_REGISTRATION(VTKMoleculeWriterTest); diff --git a/src/io/vtk/vtk-custom-decimal.cpp b/src/io/vtk/vtk-custom-decimal.cpp index 0c3a46abc1..b0749c12fd 100644 --- a/src/io/vtk/vtk-custom-decimal.cpp +++ b/src/io/vtk/vtk-custom-decimal.cpp @@ -107,13 +107,13 @@ namespace xsd void operator<< (xml_schema::list_stream& ls, const xml_schema::as_decimal& d) { - + std::ostringstream os; os.imbue (std::locale::classic ()); os.precision (std::numeric_limits::digits10); os << std::fixed << d.x; - + // Remove the trailing zeros and the decimal point if necessary. // std::string s (os.str ()); @@ -126,7 +126,7 @@ namespace xsd if (n != size) s.resize (n); - + ls.os_ << s; } } diff --git a/src/io/vtk/vtk-custom-decimal.h b/src/io/vtk/vtk-custom-decimal.h index 282cda9ffb..e226630410 100644 --- a/src/io/vtk/vtk-custom-decimal.h +++ b/src/io/vtk/vtk-custom-decimal.h @@ -10,8 +10,8 @@ // Define decimal as long double // /** - * @brief Include 'long double' as valid data types - * + * @brief Include 'long double' as valid data types + * */ namespace xsd { @@ -32,7 +32,7 @@ namespace xsd // /** * @brief Enables the parsing of XML data to the 'long double' type. - * + * */ namespace xsd { @@ -40,16 +40,16 @@ namespace xsd { namespace tree { - + template <> struct traits { - + typedef long double type; /** * @brief Creates a long double instance from a DOM element. - * + * * @param e A DOM element to extract the data from. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new instance. @@ -63,7 +63,7 @@ namespace xsd /** * @brief Creates a long double instance from a DOM attribute. - * + * * @param a A DOM attribute to extract the data from. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new instance. @@ -74,12 +74,12 @@ namespace xsd { return create (xml::transcode (a.getValue ()), 0, f, c); } - + /** * @brief Creates a long double instance from a string fragment. - * + * * @param s A string fragment to extract the data from. - * @return type = long double + * @return type = long double */ static type create (const std::string& s, @@ -95,14 +95,14 @@ namespace xsd // /** * @brief Enables the serialization of the 'long double' type to XML. - * + * */ namespace XERCES_CPP_NAMESPACE { /** * @brief Insertion operator of a long double to a DOM element. - * + * * @param e Reference to a DOM element to serialize the data to. * @param d Reference to a decimal (= long double) supposed to be serialized. */ @@ -111,7 +111,7 @@ namespace XERCES_CPP_NAMESPACE /** * @brief Insertion operator of a long double to a DOM attribute. - * + * * @param a Reference to a DOM attribute to serialize the data to. * @param d Reference to a decimal (= long double) supposed to be serialized. */ @@ -127,7 +127,7 @@ namespace xsd { /** * @brief Insertion operator of a long double to a list stream (wrapper class around basic_ostringstream). - * + * * @param ls Reference to list_stream to serialize the data to. * @param d Reference to a decimal (= long double) supposed to be serialized. */ diff --git a/src/io/vtk/vtk-punstructured.cpp b/src/io/vtk/vtk-punstructured.cpp index caf1a202d2..be34b25a48 100644 --- a/src/io/vtk/vtk-punstructured.cpp +++ b/src/io/vtk/vtk-punstructured.cpp @@ -41,7 +41,7 @@ #include "vtk-punstructured.h" // PUnstructuredGrid_t -// +// const PUnstructuredGrid_t::PPointData_type& PUnstructuredGrid_t:: PPointData () const @@ -171,7 +171,7 @@ GhostLevel_default_value () // VTKFile_t -// +// const VTKFile_t::PUnstructuredGrid_optional& VTKFile_t:: PUnstructuredGrid () const @@ -283,7 +283,7 @@ byte_order_default_value () // PPointData -// +// const PPointData::PDataArray_sequence& PPointData:: PDataArray () const @@ -305,7 +305,7 @@ PDataArray (const PDataArray_sequence& s) // PCellData -// +// const PCellData::PDataArray_sequence& PCellData:: PDataArray () const @@ -327,7 +327,7 @@ PDataArray (const PDataArray_sequence& s) // PPoints -// +// const PPoints::PDataArray_sequence& PPoints:: PDataArray () const @@ -349,7 +349,7 @@ PDataArray (const PDataArray_sequence& s) // PCells -// +// const PCells::PDataArray_sequence& PCells:: PDataArray () const @@ -371,7 +371,7 @@ PDataArray (const PDataArray_sequence& s) // Piece -// +// const Piece::Source_type& Piece:: Source () const diff --git a/src/io/vtk/vtk-punstructured.h b/src/io/vtk/vtk-punstructured.h index 80c1fd6ab5..915247c1ec 100644 --- a/src/io/vtk/vtk-punstructured.h +++ b/src/io/vtk/vtk-punstructured.h @@ -387,8 +387,8 @@ class PUnstructuredGrid_t: public ::xml_schema::type * * @param s A sequence to copy elements from. * - * For each element in @a s this function makes a copy and adds it - * to the sequence. Note that this operation completely changes the + * For each element in @a s this function makes a copy and adds it + * to the sequence. Note that this operation completely changes the * sequence and all old elements will be lost. */ void @@ -515,7 +515,7 @@ class PUnstructuredGrid_t: public ::xml_schema::type /** * @brief Destructor. */ - virtual + virtual ~PUnstructuredGrid_t (); // Implementation. @@ -603,7 +603,7 @@ class VTKFile_t: public ::xml_schema::type * * @param x An optional container with the new value to set. * - * If the value is present in @a x then this function makes a copy + * If the value is present in @a x then this function makes a copy * of this value and sets it as the new value of the element. * Otherwise the element container is set the 'not present' state. */ @@ -679,7 +679,7 @@ class VTKFile_t: public ::xml_schema::type * * @param x An optional container with the new value to set. * - * If the value is present in @a x then this function makes a copy + * If the value is present in @a x then this function makes a copy * of this value and sets it as the new value of the element. * Otherwise the element container is set the 'not present' state. */ @@ -898,7 +898,7 @@ class VTKFile_t: public ::xml_schema::type /** * @brief Destructor. */ - virtual + virtual ~VTKFile_t (); // Implementation. @@ -986,8 +986,8 @@ class PPointData: public ::xml_schema::type * * @param s A sequence to copy elements from. * - * For each element in @a s this function makes a copy and adds it - * to the sequence. Note that this operation completely changes the + * For each element in @a s this function makes a copy and adds it + * to the sequence. Note that this operation completely changes the * sequence and all old elements will be lost. */ void @@ -1062,7 +1062,7 @@ class PPointData: public ::xml_schema::type /** * @brief Destructor. */ - virtual + virtual ~PPointData (); // Implementation. @@ -1144,8 +1144,8 @@ class PCellData: public ::xml_schema::type * * @param s A sequence to copy elements from. * - * For each element in @a s this function makes a copy and adds it - * to the sequence. Note that this operation completely changes the + * For each element in @a s this function makes a copy and adds it + * to the sequence. Note that this operation completely changes the * sequence and all old elements will be lost. */ void @@ -1220,7 +1220,7 @@ class PCellData: public ::xml_schema::type /** * @brief Destructor. */ - virtual + virtual ~PCellData (); // Implementation. @@ -1302,8 +1302,8 @@ class PPoints: public ::xml_schema::type * * @param s A sequence to copy elements from. * - * For each element in @a s this function makes a copy and adds it - * to the sequence. Note that this operation completely changes the + * For each element in @a s this function makes a copy and adds it + * to the sequence. Note that this operation completely changes the * sequence and all old elements will be lost. */ void @@ -1378,7 +1378,7 @@ class PPoints: public ::xml_schema::type /** * @brief Destructor. */ - virtual + virtual ~PPoints (); // Implementation. @@ -1460,8 +1460,8 @@ class PCells: public ::xml_schema::type * * @param s A sequence to copy elements from. * - * For each element in @a s this function makes a copy and adds it - * to the sequence. Note that this operation completely changes the + * For each element in @a s this function makes a copy and adds it + * to the sequence. Note that this operation completely changes the * sequence and all old elements will be lost. */ void @@ -1536,7 +1536,7 @@ class PCells: public ::xml_schema::type /** * @brief Destructor. */ - virtual + virtual ~PCells (); // Implementation. @@ -1688,7 +1688,7 @@ class Piece: public ::xml_schema::type /** * @brief Destructor. */ - virtual + virtual ~Piece (); // Implementation. @@ -1726,7 +1726,7 @@ class Piece: public ::xml_schema::type * * @param uri A URI or a local file name. * @param f Parsing flags. - * @param p Parsing properties. + * @param p Parsing properties. * @return A pointer to the root of the object model. * * This function uses exceptions to report parsing errors. @@ -1742,7 +1742,7 @@ VTKFile (const ::std::string& uri, * @param uri A URI or a local file name. * @param eh An error handler. * @param f Parsing flags. - * @param p Parsing properties. + * @param p Parsing properties. * @return A pointer to the root of the object model. * * This function reports parsing errors by calling the error handler. @@ -1760,7 +1760,7 @@ VTKFile (const ::std::string& uri, * @param uri A URI or a local file name. * @param eh A Xerces-C++ DOM error handler. * @param f Parsing flags. - * @param p Parsing properties. + * @param p Parsing properties. * @return A pointer to the root of the object model. * * This function reports parsing errors by calling the error handler. @@ -1776,7 +1776,7 @@ VTKFile (const ::std::string& uri, * * @param is A standrad input stream. * @param f Parsing flags. - * @param p Parsing properties. + * @param p Parsing properties. * @return A pointer to the root of the object model. * * This function uses exceptions to report parsing errors. @@ -1792,7 +1792,7 @@ VTKFile (::std::istream& is, * @param is A standrad input stream. * @param eh An error handler. * @param f Parsing flags. - * @param p Parsing properties. + * @param p Parsing properties. * @return A pointer to the root of the object model. * * This function reports parsing errors by calling the error handler. @@ -1810,7 +1810,7 @@ VTKFile (::std::istream& is, * @param is A standrad input stream. * @param eh A Xerces-C++ DOM error handler. * @param f Parsing flags. - * @param p Parsing properties. + * @param p Parsing properties. * @return A pointer to the root of the object model. * * This function reports parsing errors by calling the error handler. @@ -1827,7 +1827,7 @@ VTKFile (::std::istream& is, * @param is A standrad input stream. * @param id A resource id. * @param f Parsing flags. - * @param p Parsing properties. + * @param p Parsing properties. * @return A pointer to the root of the object model. * * The resource id is used to identify the document being parsed in @@ -1849,7 +1849,7 @@ VTKFile (::std::istream& is, * @param id A resource id. * @param eh An error handler. * @param f Parsing flags. - * @param p Parsing properties. + * @param p Parsing properties. * @return A pointer to the root of the object model. * * The resource id is used to identify the document being parsed in @@ -1872,7 +1872,7 @@ VTKFile (::std::istream& is, * @param id A resource id. * @param eh A Xerces-C++ DOM error handler. * @param f Parsing flags. - * @param p Parsing properties. + * @param p Parsing properties. * @return A pointer to the root of the object model. * * The resource id is used to identify the document being parsed in @@ -1892,7 +1892,7 @@ VTKFile (::std::istream& is, * * @param is A Xerces-C++ input source. * @param f Parsing flags. - * @param p Parsing properties. + * @param p Parsing properties. * @return A pointer to the root of the object model. * * This function uses exceptions to report parsing errors. @@ -1908,7 +1908,7 @@ VTKFile (::xercesc::InputSource& is, * @param is A Xerces-C++ input source. * @param eh An error handler. * @param f Parsing flags. - * @param p Parsing properties. + * @param p Parsing properties. * @return A pointer to the root of the object model. * * This function reports parsing errors by calling the error handler. @@ -1926,7 +1926,7 @@ VTKFile (::xercesc::InputSource& is, * @param is A Xerces-C++ input source. * @param eh A Xerces-C++ DOM error handler. * @param f Parsing flags. - * @param p Parsing properties. + * @param p Parsing properties. * @return A pointer to the root of the object model. * * This function reports parsing errors by calling the error handler. @@ -1942,7 +1942,7 @@ VTKFile (::xercesc::InputSource& is, * * @param d A Xerces-C++ DOM document. * @param f Parsing flags. - * @param p Parsing properties. + * @param p Parsing properties. * @return A pointer to the root of the object model. */ ::std::unique_ptr< ::VTKFile_t > @@ -1955,7 +1955,7 @@ VTKFile (const ::xercesc::DOMDocument& d, * * @param d A pointer to the Xerces-C++ DOM document. * @param f Parsing flags. - * @param p Parsing properties. + * @param p Parsing properties. * @return A pointer to the root of the object model. * * This function is normally used together with the keep_dom and @@ -2004,7 +2004,7 @@ operator<< (::xercesc::DOMElement&, const VTKFile_t&); */ void VTKFile (::std::ostream& os, - const ::VTKFile_t& x, + const ::VTKFile_t& x, const ::xml_schema::namespace_infomap& m = ::xml_schema::namespace_infomap (), const ::std::string& e = "UTF-8", ::xml_schema::flags f = 0); @@ -2024,7 +2024,7 @@ VTKFile (::std::ostream& os, */ void VTKFile (::std::ostream& os, - const ::VTKFile_t& x, + const ::VTKFile_t& x, ::xml_schema::error_handler& eh, const ::xml_schema::namespace_infomap& m = ::xml_schema::namespace_infomap (), const ::std::string& e = "UTF-8", @@ -2046,7 +2046,7 @@ VTKFile (::std::ostream& os, */ void VTKFile (::std::ostream& os, - const ::VTKFile_t& x, + const ::VTKFile_t& x, ::xercesc::DOMErrorHandler& eh, const ::xml_schema::namespace_infomap& m = ::xml_schema::namespace_infomap (), const ::std::string& e = "UTF-8", @@ -2065,7 +2065,7 @@ VTKFile (::std::ostream& os, */ void VTKFile (::xercesc::XMLFormatTarget& ft, - const ::VTKFile_t& x, + const ::VTKFile_t& x, const ::xml_schema::namespace_infomap& m = ::xml_schema::namespace_infomap (), const ::std::string& e = "UTF-8", ::xml_schema::flags f = 0); @@ -2086,7 +2086,7 @@ VTKFile (::xercesc::XMLFormatTarget& ft, */ void VTKFile (::xercesc::XMLFormatTarget& ft, - const ::VTKFile_t& x, + const ::VTKFile_t& x, ::xml_schema::error_handler& eh, const ::xml_schema::namespace_infomap& m = ::xml_schema::namespace_infomap (), const ::std::string& e = "UTF-8", @@ -2108,7 +2108,7 @@ VTKFile (::xercesc::XMLFormatTarget& ft, */ void VTKFile (::xercesc::XMLFormatTarget& ft, - const ::VTKFile_t& x, + const ::VTKFile_t& x, ::xercesc::DOMErrorHandler& eh, const ::xml_schema::namespace_infomap& m = ::xml_schema::namespace_infomap (), const ::std::string& e = "UTF-8", @@ -2139,7 +2139,7 @@ VTKFile (::xercesc::DOMDocument& d, * @return A pointer to the new Xerces-C++ DOM document. */ ::xml_schema::dom::unique_ptr< ::xercesc::DOMDocument > -VTKFile (const ::VTKFile_t& x, +VTKFile (const ::VTKFile_t& x, const ::xml_schema::namespace_infomap& m = ::xml_schema::namespace_infomap (), ::xml_schema::flags f = 0); diff --git a/src/io/vtk/vtk-unstructured.cpp b/src/io/vtk/vtk-unstructured.cpp index fba3464b54..e1249e3dfd 100644 --- a/src/io/vtk/vtk-unstructured.cpp +++ b/src/io/vtk/vtk-unstructured.cpp @@ -65,7 +65,7 @@ DataArrayList_t (const DataArrayList_t& o, } // DataArray_t -// +// const DataArray_t::type_type& DataArray_t:: type () const @@ -171,7 +171,7 @@ offset (const offset_optional& x) // PieceUnstructuredGrid_t -// +// const PieceUnstructuredGrid_t::PointData_type& PieceUnstructuredGrid_t:: PointData () const @@ -307,7 +307,7 @@ NumberOfCells (const NumberOfCells_type& x) // UnstructuredGrid_t -// +// const UnstructuredGrid_t::Piece_type& UnstructuredGrid_t:: Piece () const @@ -335,7 +335,7 @@ Piece (::std::unique_ptr< Piece_type > x) // type -// +// type:: type (value v) @@ -372,7 +372,7 @@ type (const type& v, type& type:: operator= (value v) { - static_cast< ::xml_schema::string& > (*this) = + static_cast< ::xml_schema::string& > (*this) = ::xml_schema::string (_xsd_type_literals_[v]); return *this; @@ -380,7 +380,7 @@ operator= (value v) // PointData -// +// const PointData::DataArray_sequence& PointData:: DataArray () const @@ -402,7 +402,7 @@ DataArray (const DataArray_sequence& s) // CellData -// +// const CellData::DataArray_sequence& CellData:: DataArray () const @@ -424,7 +424,7 @@ DataArray (const DataArray_sequence& s) // Points -// +// const Points::DataArray_sequence& Points:: DataArray () const @@ -446,7 +446,7 @@ DataArray (const DataArray_sequence& s) // Cells -// +// const Cells::DataArray_sequence& Cells:: DataArray () const @@ -1698,4 +1698,3 @@ operator<< (::xercesc::DOMElement& e, const Cells& i) // // // End epilogue. - diff --git a/src/io/vtk/vtk-unstructured.h b/src/io/vtk/vtk-unstructured.h index 429a65a972..c05ddf9cf8 100644 --- a/src/io/vtk/vtk-unstructured.h +++ b/src/io/vtk/vtk-unstructured.h @@ -204,7 +204,7 @@ class DataArrayList_t: public ::xml_schema::simple_type, /** * @brief Destructor. */ - virtual + virtual ~DataArrayList_t (); }; @@ -472,7 +472,7 @@ class DataArray_t: public ::DataArrayList_t * * @param x An optional container with the new value to set. * - * If the value is present in @a x then this function makes a copy + * If the value is present in @a x then this function makes a copy * of this value and sets it as the new value of the attribute. * Otherwise the attribute container is set the 'not present' state. */ @@ -487,7 +487,7 @@ class DataArray_t: public ::DataArrayList_t //@{ /** - * @brief Create an instance from initializers for required + * @brief Create an instance from initializers for required * elements and attributes. */ DataArray_t (const type_type&, @@ -559,7 +559,7 @@ class DataArray_t: public ::DataArrayList_t /** * @brief Destructor. */ - virtual + virtual ~DataArray_t (); // Implementation. @@ -1004,7 +1004,7 @@ class PieceUnstructuredGrid_t: public ::xml_schema::type /** * @brief Destructor. */ - virtual + virtual ~PieceUnstructuredGrid_t (); // Implementation. @@ -1171,7 +1171,7 @@ class UnstructuredGrid_t: public ::xml_schema::type /** * @brief Destructor. */ - virtual + virtual ~UnstructuredGrid_t (); // Implementation. @@ -1406,8 +1406,8 @@ class PointData: public ::xml_schema::type * * @param s A sequence to copy elements from. * - * For each element in @a s this function makes a copy and adds it - * to the sequence. Note that this operation completely changes the + * For each element in @a s this function makes a copy and adds it + * to the sequence. Note that this operation completely changes the * sequence and all old elements will be lost. */ void @@ -1482,7 +1482,7 @@ class PointData: public ::xml_schema::type /** * @brief Destructor. */ - virtual + virtual ~PointData (); // Implementation. @@ -1564,8 +1564,8 @@ class CellData: public ::xml_schema::type * * @param s A sequence to copy elements from. * - * For each element in @a s this function makes a copy and adds it - * to the sequence. Note that this operation completely changes the + * For each element in @a s this function makes a copy and adds it + * to the sequence. Note that this operation completely changes the * sequence and all old elements will be lost. */ void @@ -1640,7 +1640,7 @@ class CellData: public ::xml_schema::type /** * @brief Destructor. */ - virtual + virtual ~CellData (); // Implementation. @@ -1722,8 +1722,8 @@ class Points: public ::xml_schema::type * * @param s A sequence to copy elements from. * - * For each element in @a s this function makes a copy and adds it - * to the sequence. Note that this operation completely changes the + * For each element in @a s this function makes a copy and adds it + * to the sequence. Note that this operation completely changes the * sequence and all old elements will be lost. */ void @@ -1798,7 +1798,7 @@ class Points: public ::xml_schema::type /** * @brief Destructor. */ - virtual + virtual ~Points (); // Implementation. @@ -1880,8 +1880,8 @@ class Cells: public ::xml_schema::type * * @param s A sequence to copy elements from. * - * For each element in @a s this function makes a copy and adds it - * to the sequence. Note that this operation completely changes the + * For each element in @a s this function makes a copy and adds it + * to the sequence. Note that this operation completely changes the * sequence and all old elements will be lost. */ void @@ -1956,7 +1956,7 @@ class Cells: public ::xml_schema::type /** * @brief Destructor. */ - virtual + virtual ~Cells (); // Implementation. diff --git a/src/longRange/Homogeneous.cpp b/src/longRange/Homogeneous.cpp index 95d52659e8..b913eb7de5 100644 --- a/src/longRange/Homogeneous.cpp +++ b/src/longRange/Homogeneous.cpp @@ -7,9 +7,7 @@ //#include "LongRangeCorrection.h" #include "utils/Logger.h" -using Log::global_log; -using namespace std; Homogeneous::Homogeneous(double cutoffRadius, double cutoffRadiusLJ, Domain* domain, Simulation* simulation) { _cutoff = cutoffRadius; @@ -20,7 +18,7 @@ Homogeneous::Homogeneous(double cutoffRadius, double cutoffRadiusLJ, Domain* dom void Homogeneous::init() { _comp2params = _domain->getComp2Params(); - global_log->info() << "Long range correction for homogeneous systems is used " << endl; + Log::global_log->info() << "Long range correction for homogeneous systems is used " << std::endl; double UpotCorrLJ = 0.; double VirialCorrLJ = 0.; double MySelbstTerm = 0.; @@ -80,7 +78,7 @@ void Homogeneous::init() { double zj = cj.ljcenter(sj).rz(); double tau2 = sqrt(xj * xj + yj * yj + zj * zj); if (tau1 + tau2 >= _cutoffLJ) { - global_log->error() << "Error calculating cutoff corrections, rc too small" << endl; + Log::global_log->error() << "Error calculating cutoff corrections, rc too small" << std::endl; Simulation::exit(1); } double eps24; @@ -133,8 +131,8 @@ void Homogeneous::calculateLongRange() { double UpotCorr = UpotCorrLJ + MySelbstTerm; double VirialCorr = VirialCorrLJ + 3. * MySelbstTerm; - global_log->debug() << "Far field terms: U_pot_correction = " << UpotCorr << " virial_correction = " << VirialCorr - << endl; + Log::global_log->debug() << "Far field terms: U_pot_correction = " << UpotCorr << " virial_correction = " << VirialCorr + << std::endl; _domain->setUpotCorr(UpotCorr); _domain->setVirialCorr(VirialCorr); } diff --git a/src/longRange/Homogeneous.h b/src/longRange/Homogeneous.h index 2fd0ad6ae2..8f22b525d0 100644 --- a/src/longRange/Homogeneous.h +++ b/src/longRange/Homogeneous.h @@ -33,12 +33,12 @@ class Homogeneous: public LongRangeCorrection{ double _TICCv(int n,double rc,double sigma2); double _TICSv(int n,double rc,double sigma2,double tau); double _TISSv(int n,double rc,double sigma2,double tau1,double tau2); - + //! Components resp. molecule types std::vector* _components{nullptr}; //! parameter streams for each possible pair of molecule-types Comp2Param _comp2params; - + Domain* _domain{nullptr}; double _cutoff{std::numeric_limits::quiet_NaN()}; diff --git a/src/longRange/LongRangeCorrection.h b/src/longRange/LongRangeCorrection.h index 8031327fed..a01379a311 100644 --- a/src/longRange/LongRangeCorrection.h +++ b/src/longRange/LongRangeCorrection.h @@ -24,7 +24,7 @@ class LongRangeCorrection{ Planar* _planar; Homogeneous* _homogen; */ - + }; #endif /* __LONGRANGECORRECTION_H__ */ diff --git a/src/longRange/NoLRC.h b/src/longRange/NoLRC.h index bad1e0a408..f0fc4d9bf1 100644 --- a/src/longRange/NoLRC.h +++ b/src/longRange/NoLRC.h @@ -5,7 +5,6 @@ #include "LongRangeCorrection.h" #include "utils/Logger.h" -using Log::global_log; class Simulation; class Domain; @@ -22,7 +21,7 @@ class NoLRC: public LongRangeCorrection{ }; virtual ~NoLRC() {} - virtual void init() { global_log->info() << "No long range correction is used: UpotCorr = VirialCorr = 0" << std::endl; } + virtual void init() { Log::global_log->info() << "No long range correction is used: UpotCorr = VirialCorr = 0" << std::endl; } virtual void readXML(XMLfileUnits& /* xmlconfig */) {} virtual void calculateLongRange() { _domain->setUpotCorr(0.); diff --git a/src/longRange/Planar.cpp b/src/longRange/Planar.cpp index acc41eb7d9..991987a77d 100644 --- a/src/longRange/Planar.cpp +++ b/src/longRange/Planar.cpp @@ -15,13 +15,11 @@ #include "utils/xmlfileUnits.h" #include "utils/FileUtils.h" -using namespace std; -using Log::global_log; Planar::Planar(double /*cutoffT*/, double cutoffLJ, Domain* domain, DomainDecompBase* domainDecomposition, ParticleContainer* particleContainer, unsigned slabs, Simulation* simulation) { - global_log->info() << "Long Range Correction for planar interfaces is used" << endl; + Log::global_log->info() << "Long Range Correction for planar interfaces is used" << std::endl; _nStartWritingProfiles = 1; _nWriteFreqProfiles = 10; _nStopWritingProfiles = 100; @@ -41,8 +39,8 @@ void Planar::init() { //_smooth=true; // Deactivate this for transient simulations! _smooth=false; //true; <-- only applicable to static density profiles - - vector& components = *_simulation.getEnsemble()->getComponents(); + + std::vector& components = *_simulation.getEnsemble()->getComponents(); numComp=components.size(); resizeExactly(numLJ, numComp); resizeExactly(numDipole, numComp); @@ -82,7 +80,7 @@ void Planar::init() resizeExactly(rhoDipole, _slabs*numDipoleSum); resizeExactly(rhoDipoleL, _slabs*numDipoleSum); resizeExactly(eLong, numLJSum); - + unsigned counter=0; for (unsigned i =0; i< numComp; i++){ // Determination of the elongation of the Lennard-Jones sites for (unsigned j=0; j< components[i].numLJcenters(); j++){ @@ -104,7 +102,7 @@ void Planar::init() for (unsigned i=0; i < _slabs*numDipoleSum; i++){ rhoDipole[i]=0; } - + unsigned dpcount=0; for (unsigned i=0; igetGlobalLength(1); boxlength[0]=_domain->getGlobalLength(0); boxlength[2]=_domain->getGlobalLength(2); cutoff_slabs=cutoff*_slabs/ymax; // Number of slabs to cutoff - delta=ymax/_slabs; + delta=ymax/_slabs; V=ymax*_domain->getGlobalLength(0)*_domain->getGlobalLength(2); // Volume - + sint=_slabs; simstep = 0; - + temp=_domain->getTargetTemperature(0); if (_region.refPosID[0]+_region.refPosID[1] > 0) { @@ -148,9 +146,9 @@ void Planar::init() if (nullptr != _subject) { this->update(_subject); _subject->registerObserver(this); - global_log->info() << "Long Range Correction: Subject registered" << endl; + Log::global_log->info() << "Long Range Correction: Subject registered" << std::endl; } else { - global_log->error() << "Long Range Correction: Initialization of plugin DistControl is needed before! Program exit..." << endl; + Log::global_log->error() << "Long Range Correction: Initialization of plugin DistControl is needed before! Program exit..." << std::endl; Simulation::exit(-1); } } @@ -158,15 +156,15 @@ void Planar::init() void Planar::readXML(XMLfileUnits& xmlconfig) { - global_log->info() << "[Long Range Correction] Reading xml config" << endl; + Log::global_log->info() << "[Long Range Correction] Reading xml config" << std::endl; xmlconfig.getNodeValue("slabs", _slabs); xmlconfig.getNodeValue("smooth", _smooth); xmlconfig.getNodeValue("frequency", frequency); - + std::string strVal; _region.refPosID[0] = 0; _region.refPosID[1] = 0; - + // In some cases, like for density gradients in the bulk, the planar LRC may be wrong, since it was mainly developed for interfaces. // Therefore, a region can be specified wherein the LRC for the force is applied. // In order to still get correct state values in the bulks, the LRC for the virial and potential energy is also applied outside of the region. @@ -182,37 +180,37 @@ void Planar::readXML(XMLfileUnits& xmlconfig) _region.refPos[0] = _region.actPos[0] = 0.0; _region.refPos[1] = _region.actPos[1] = _domain->getGlobalLength(1); } - - global_log->info() << "Long Range Correction: using " << _slabs << " slabs for profiles to calculate LRC." << endl; - global_log->info() << "Long Range Correction: sampling profiles every " << frequency << "th simstep." << endl; - global_log->info() << "Long Range Correction: profiles are smoothed (averaged over time): " << std::boolalpha << _smooth << endl; - global_log->info() << "Long Range Correction: force corrections are applied to particles within yRef = " << _region.refPos[0] << " (refID: " << _region.refPosID[0] << ") and " << _region.refPos[1] << " (refID: " << _region.refPosID[1] << ")" << endl; - global_log->info() << "Long Range Correction: pot. energy and virial corrections are applied within whole domain" << endl; - + + Log::global_log->info() << "Long Range Correction: using " << _slabs << " slabs for profiles to calculate LRC." << std::endl; + Log::global_log->info() << "Long Range Correction: sampling profiles every " << frequency << "th simstep." << std::endl; + Log::global_log->info() << "Long Range Correction: profiles are smoothed (averaged over time): " << std::boolalpha << _smooth << std::endl; + Log::global_log->info() << "Long Range Correction: force corrections are applied to particles within yRef = " << _region.refPos[0] << " (refID: " << _region.refPosID[0] << ") and " << _region.refPos[1] << " (refID: " << _region.refPosID[1] << ")" << std::endl; + Log::global_log->info() << "Long Range Correction: pot. energy and virial corrections are applied within whole domain" << std::endl; + // write control bool bRet1 = xmlconfig.getNodeValue("writecontrol/start", _nStartWritingProfiles); bool bRet2 = xmlconfig.getNodeValue("writecontrol/frequency", _nWriteFreqProfiles); bool bRet3 = xmlconfig.getNodeValue("writecontrol/stop", _nStopWritingProfiles); if(_nWriteFreqProfiles < 1) { - global_log->error() << "Long Range Correction: Write frequency < 1! Programm exit ..." << endl; + Log::global_log->error() << "Long Range Correction: Write frequency < 1! Programm exit ..." << std::endl; Simulation::exit(-1); } if(_nStopWritingProfiles <= _nStartWritingProfiles) { - global_log->error() << "Long Range Correction: Writing profiles 'stop' <= 'start'! Programm exit ..." << endl; + Log::global_log->error() << "Long Range Correction: Writing profiles 'stop' <= 'start'! Programm exit ..." << std::endl; Simulation::exit(-1); } bool bInputIsValid = (bRet1 && bRet2 && bRet3); if(true == bInputIsValid) { - global_log->info() << "Long Range Correction->writecontrol: Start writing profiles at simstep: " << _nStartWritingProfiles << endl; - global_log->info() << "Long Range Correction->writecontrol: Writing profiles with frequency: " << _nWriteFreqProfiles << endl; - global_log->info() << "Long Range Correction->writecontrol: Stop writing profiles at simstep: " << _nStopWritingProfiles << endl; + Log::global_log->info() << "Long Range Correction->writecontrol: Start writing profiles at simstep: " << _nStartWritingProfiles << std::endl; + Log::global_log->info() << "Long Range Correction->writecontrol: Writing profiles with frequency: " << _nWriteFreqProfiles << std::endl; + Log::global_log->info() << "Long Range Correction->writecontrol: Stop writing profiles at simstep: " << _nStopWritingProfiles << std::endl; } else { - global_log->error() << "Long Range Correction: Write control parameters not valid! Programm exit ..." << endl; + Log::global_log->error() << "Long Range Correction: Write control parameters not valid! Programm exit ..." << std::endl; Simulation::exit(-1); } } @@ -255,7 +253,7 @@ void Planar::calculateLongRange() { rhoDipole[index] += slabsPerV; } } - } + } if (simstep % frequency == 0){ // The Density Profile is only calculated once in 10 simulation steps std::fill(rho_l.begin(), rho_l.end(), 0.0); @@ -263,7 +261,7 @@ void Planar::calculateLongRange() { std::fill(vNLJ.begin(), vNLJ.end(), 0.0); std::fill(vTLJ.begin(), vTLJ.end(), 0.0); std::fill(fLJ.begin(), fLJ.end(), 0.0); - + std::fill(fDipole.begin(), fDipole.end(), 0.0); std::fill(uDipole.begin(), uDipole.end(), 0.0); std::fill(vNDipole.begin(), vNDipole.end(), 0.0); @@ -315,7 +313,7 @@ void Planar::calculateLongRange() { rhoDipoleL[i]=rhoDipole[i]/(simstep+1); } } - + // Distribution of the Density Profile to every node _domainDecomposition->collCommInit(_slabs*(numLJSum+numDipoleSum)); for (unsigned i=0; i < _slabs*numLJSum; i++) { @@ -324,7 +322,7 @@ void Planar::calculateLongRange() { for (unsigned i=0; i< _slabs*numDipoleSum; i++){ _domainDecomposition->collCommAppendDouble(rhoDipoleL[i]); } - + _domainDecomposition->collCommAllreduceSum(); for (unsigned i=0; i < _slabs*numLJSum; i++) { rho_l[i] = _domainDecomposition->collCommGetDouble(); @@ -332,11 +330,11 @@ void Planar::calculateLongRange() { for (unsigned i=0; i< _slabs*numDipoleSum; i++){ rhoDipoleL[i] = _domainDecomposition->collCommGetDouble(); } - + _domainDecomposition->collCommFinalize(); - for (unsigned ci = 0; ci < numComp; ++ci){ - for (unsigned cj = 0; cj < numComp; ++cj){ + for (unsigned ci = 0; ci < numComp; ++ci){ + for (unsigned cj = 0; cj < numComp; ++cj){ ParaStrm& params = _domain->getComp2Params()(ci,cj); params.reset_read(); for (unsigned si = 0; si < numLJ[ci]; ++si) { // Long Range Correction for Lennard-Jones sites @@ -361,15 +359,15 @@ void Planar::calculateLongRange() { } } } - + for (unsigned si=0; si< numDipole[ci]; si++){ //Long Range Correction for Dipoles for (unsigned sj=0; sj< numDipole[cj]; sj++){ - dipoleDipole(ci,cj,si,sj); + dipoleDipole(ci,cj,si,sj); } } } - } - + } + // Distribution of the Force, Energy and Virial to every Node _domainDecomposition->collCommInit(_slabs*(4*numLJSum+4*numDipoleSum)); for (unsigned i=0; i<_slabs*numLJSum; i++){ @@ -383,7 +381,7 @@ void Planar::calculateLongRange() { _domainDecomposition->collCommAppendDouble(fDipole[i]); _domainDecomposition->collCommAppendDouble(vNDipole[i]); _domainDecomposition->collCommAppendDouble(vTDipole[i]); - } + } _domainDecomposition->collCommAllreduceSum(); for (unsigned i=0; i<_slabs*numLJSum; i++){ uLJ[i]=_domainDecomposition->collCommGetDouble(); @@ -471,7 +469,7 @@ void Planar::calculateLongRange() { // Setting the Energy and Virial correction _domain->setUpotCorr(Upot_c); _domain->setVirialCorr(Virial_c); - + simstep++; } @@ -521,7 +519,7 @@ void Planar::centerCenter(double sig, double eps,unsigned ci,unsigned cj,unsigne fLJ[index_i] += -termF*rhoJ*(r12-r6)/r; fLJ[index_j] += termF*rhoI*(r12-r6)/r; } - // Calculation of the Periodic boundary + // Calculation of the Periodic boundary for (unsigned j=slabsHalf+i; j<_slabs; j++){ const int index_j = j+sj*_slabs+_slabs*numLJSum2[cj]; @@ -661,7 +659,7 @@ void Planar::centerSite(double sig, double eps,unsigned ci,unsigned cj,unsigned fLJ[index_j]+=rhoI*termFRC*r; } } - // Calculation of the Periodic boundary + // Calculation of the Periodic boundary for (unsigned j=_slabs/2+i; j<_slabs; j++) { const int index_j = j+sj*_slabs+_slabs*numLJSum2[cj]; @@ -766,7 +764,7 @@ void Planar::siteSite(double sig, double eps,unsigned ci,unsigned cj,unsigned si double sig4=sig2*sig2; double t1 = eLong[numLJSum2[ci]+si]; double t2 = eLong[numLJSum2[cj]+sj]; - double tP = t1 + t2; // tau+ + double tP = t1 + t2; // tau+ double tM = t1 - t2; // tau- double rcPtP=sig/(cutoff+tP); double rcPtP2=rcPtP*rcPtP; @@ -858,7 +856,7 @@ void Planar::siteSite(double sig, double eps,unsigned ci,unsigned cj,unsigned si fLJ[index_j]+=rhoI*termFRC*r; } } - // Calculation of the Periodic boundary + // Calculation of the Periodic boundary for (unsigned j=_slabs/2+i; j<_slabs; j++) { const int index_j = j+sj*_slabs+_slabs*numLJSum2[cj]; @@ -1014,9 +1012,9 @@ void Planar::dipoleDipole(unsigned ci,unsigned cj,unsigned si,unsigned sj){ vNDipole[index_j]-= termVN*rhoI/r6 *r*r; vTDipole[index_i]-= termVT*rhoJ/r6 *(1.5*r2 - r*r); vTDipole[index_j]-= termVT*rhoI/r6 *(1.5*r2 - r*r); - + } - // Calculation of the Periodic boundary + // Calculation of the Periodic boundary for (unsigned j=_slabs/2+i; j<_slabs; j++){ const int index_j = j+sj*_slabs+_slabs*numDipoleSum2[cj]; @@ -1074,7 +1072,7 @@ void Planar::dipoleDipole(unsigned ci,unsigned cj,unsigned si,unsigned sj){ vTDipole[index_i]-= termVT*rhoJ/r6 *(1.5*r2 - r*r); vTDipole[index_j]-= termVT*rhoI/r6 *(1.5*r2 - r*r); } - } + } } double Planar::lrcLJ(Molecule* mol){ @@ -1134,7 +1132,7 @@ void Planar::writeProfiles(DomainDecompBase* domainDecomp, Domain* domain, unsig outputstream << " F_LRC[" << si << "]"; outputstream << " u_LRC[" << si << "]"; } - outputstream << endl; + outputstream << std::endl; // data for(uint32_t pi=0; pi<_slabs; ++pi) @@ -1156,7 +1154,7 @@ void Planar::writeProfiles(DomainDecompBase* domainDecomp, Domain* domain, unsig // open file for writing // scalar - ofstream fileout(filenamestream.str().c_str(), ios::out); + std::ofstream fileout(filenamestream.str().c_str(), std::ios::out); fileout << outputstream.str(); fileout.close(); } diff --git a/src/longRange/Planar.h b/src/longRange/Planar.h index f06b767e6e..408fda5726 100644 --- a/src/longRange/Planar.h +++ b/src/longRange/Planar.h @@ -68,7 +68,7 @@ class Planar : public LongRangeCorrection, public ObserverBase, public ControlIn v.resize(numElements); } - void centerCenter(double sig,double eps,unsigned ci,unsigned cj,unsigned si, unsigned sj); + void centerCenter(double sig,double eps,unsigned ci,unsigned cj,unsigned si, unsigned sj); void centerSite(double sig,double eps,unsigned ci,unsigned cj,unsigned si, unsigned sj); void siteSite(double sig,double eps,unsigned ci,unsigned cj,unsigned si, unsigned sj); void dipoleDipole(unsigned ci,unsigned cj,unsigned si,unsigned sj); @@ -113,11 +113,11 @@ class Planar : public LongRangeCorrection, public ObserverBase, public ControlIn int sint; double temp; unsigned simstep; - + ParticleContainer* _particleContainer; Domain* _domain; DomainDecompBase* _domainDecomposition; - + // write control uint64_t _nStartWritingProfiles; uint64_t _nWriteFreqProfiles; diff --git a/src/molecules/AutoPasSimpleMolecule.cpp b/src/molecules/AutoPasSimpleMolecule.cpp index c8ca00f915..dc1cf66198 100644 --- a/src/molecules/AutoPasSimpleMolecule.cpp +++ b/src/molecules/AutoPasSimpleMolecule.cpp @@ -18,7 +18,7 @@ AutoPasSimpleMolecule::AutoPasSimpleMolecule(unsigned long id, Component* compon if (_component == nullptr) { _component = component; } else if (_component != component and component != nullptr) { - global_log->debug() << "AutoPasSimpleMolecule can only handle one component" << std::endl; + Log::global_log->debug() << "AutoPasSimpleMolecule can only handle one component" << std::endl; _component = component; // Simulation::exit(32); } @@ -44,7 +44,7 @@ void AutoPasSimpleMolecule::upd_postF(double dt_halve, double& summv2, double& s _v[d] += dtInv2m * _f[d]; v2 += _v[d] * _v[d]; } - mardyn_assert(!isnan(v2)); // catches NaN + mardyn_assert(!std::isnan(v2)); // catches NaN summv2 += mass * v2; } @@ -57,4 +57,4 @@ std::ostream& operator<<( std::ostream& os, const AutoPasSimpleMolecule& m ) { os << "w: (" << m.D(0) << ", " << m.D(1) << ", " << m.D(2) << ")\n"; os << "Vi: (" << m.Vi(0) << ", " << m.Vi(1) << ", " << m.Vi(2) << ")" ; return os; -} \ No newline at end of file +} diff --git a/src/molecules/Comp2Param.cpp b/src/molecules/Comp2Param.cpp index c322a2c221..722382043d 100644 --- a/src/molecules/Comp2Param.cpp +++ b/src/molecules/Comp2Param.cpp @@ -4,18 +4,16 @@ #include "utils/Logger.h" -using Log::global_log; -using namespace std; void Comp2Param::initialize( - const vector& components, const vector& mixcoeff, + const std::vector& components, const std::vector& mixcoeff, double epsRF, double rc, double rcLJ) { m_numcomp = components.size(); m_ssparatbl.redim(m_numcomp, m_numcomp); // interaction between LJ centers - vector::const_iterator mixpos = mixcoeff.begin(); + std::vector::const_iterator mixpos = mixcoeff.begin(); for (unsigned int compi = 0; compi < m_numcomp; ++compi) { ParaStrm& pstrmii = m_ssparatbl(compi, compi); unsigned int nci = components[compi].numLJcenters(); @@ -47,7 +45,7 @@ void Comp2Param::initialize( double eta = *mixpos; ++mixpos; #ifndef NDEBUG - global_log->info() << "cid+1(compi)=" << compi+1 << " <--> cid+1(compj)=" << compj+1 << ": xi=" << xi << ", eta=" << eta << endl; + Log::global_log->info() << "cid+1(compi)=" << compi+1 << " <--> cid+1(compj)=" << compj+1 << ": xi=" << xi << ", eta=" << eta << std::endl; #endif double shift6combined, sigperrc2, sigperrc6; for (unsigned int centeri = 0; centeri < nci; ++centeri) { @@ -68,7 +66,7 @@ void Comp2Param::initialize( pstrmij << sigma2; pstrmij << shift6combined; #ifndef NDEBUG - global_log->debug() << "Component " << compi << ": eps24=" << epsilon24 << " sig2=" << sigma2 << " shift6=" << shift6combined << endl; + Log::global_log->debug() << "Component " << compi << ": eps24=" << epsilon24 << " sig2=" << sigma2 << " shift6=" << shift6combined << std::endl; #endif } } diff --git a/src/molecules/Comp2Param.h b/src/molecules/Comp2Param.h index 8758325783..02ae68155b 100644 --- a/src/molecules/Comp2Param.h +++ b/src/molecules/Comp2Param.h @@ -17,11 +17,11 @@ class Comp2Param { /** Create a new empty parameter stream. */ Comp2Param() : m_numcomp(0), m_ssparatbl(0,0) {} - /** Create a new interaction parameter hash table initialized with + /** Create a new interaction parameter hash table initialized with * the given components and parameters. */ - Comp2Param(const std::vector& components, - const std::vector& mixcoeff, + Comp2Param(const std::vector& components, + const std::vector& mixcoeff, double epsRF, double rc, double rcLJ) : m_numcomp(components.size()), m_ssparatbl(m_numcomp,m_numcomp) { diff --git a/src/molecules/Component.cpp b/src/molecules/Component.cpp index 6ddc431b3e..cf90eca06a 100644 --- a/src/molecules/Component.cpp +++ b/src/molecules/Component.cpp @@ -7,8 +7,6 @@ #include "utils/Logger.h" #include "Simulation.h" -using namespace std; -using Log::global_log; Component::Component(unsigned int id) { _id = id; @@ -23,21 +21,21 @@ Component::Component(unsigned int id) { _E_rot=0.; _isStockmayer = false; - _ljcenters = vector (); - _charges = vector (); - _quadrupoles = vector (); - _dipoles = vector (); + _ljcenters = std::vector (); + _charges = std::vector (); + _quadrupoles = std::vector (); + _dipoles = std::vector (); } void Component::readXML(XMLfileUnits& xmlconfig) { - global_log->info() << "Reading in component" << endl; + Log::global_log->info() << "Reading in component" << std::endl; unsigned int cid = 0; xmlconfig.getNodeValue( "@id", cid ); - global_log->info() << "Component ID:" << cid << endl; + Log::global_log->info() << "Component ID:" << cid << std::endl; setID(cid - 1); - string name; + std::string name; xmlconfig.getNodeValue( "@name", name ); - global_log->info() << "Component name:" << name << endl; + Log::global_log->info() << "Component name:" << name << std::endl; setName(name); XMLfile::Query query = xmlconfig.query( "site" ); @@ -47,7 +45,7 @@ void Component::readXML(XMLfileUnits& xmlconfig) { std::string siteType; xmlconfig.getNodeValue("@type", siteType); - global_log->info() << "Adding site of type " << siteType << endl; + Log::global_log->info() << "Adding site of type " << siteType << std::endl; if (siteType == "LJ126") { LJcenter ljSite; @@ -69,19 +67,19 @@ void Component::readXML(XMLfileUnits& xmlconfig) { _Ipa[1] = 1.0; _Ipa[2] = 0.0; - global_log->info() << "Rotation enabled with [Ixx Iyy Izz] = [" << _Ipa[0] << " " << _Ipa[1] << " " + Log::global_log->info() << "Rotation enabled with [Ixx Iyy Izz] = [" << _Ipa[0] << " " << _Ipa[1] << " " << _Ipa[2] << "]. Dipole direction vector of the Stockmayer fluid should be [0 0 1]." - << endl; + << std::endl; } else if (siteType == "Quadrupole") { Quadrupole quadrupoleSite; quadrupoleSite.readXML(xmlconfig); addQuadrupole(quadrupoleSite); } else if (siteType == "Tersoff") { - global_log->error() << "Tersoff no longer supported:" << siteType << endl; + Log::global_log->error() << "Tersoff no longer supported:" << siteType << std::endl; Simulation::exit(-1); } else { - global_log->error() << "Unknown site type:" << siteType << endl; + Log::global_log->error() << "Unknown site type:" << siteType << std::endl; Simulation::exit(-1); } // go back to initial level, to be consistent, even if no site information is found. @@ -93,10 +91,10 @@ void Component::readXML(XMLfileUnits& xmlconfig) { if(xmlconfig.getNodeValueReduced("Ixx", II[0]) > 0) { setI11(II[0]); } if(xmlconfig.getNodeValueReduced("Iyy", II[1]) > 0) { setI22(II[1]); } if(xmlconfig.getNodeValueReduced("Izz", II[2]) > 0) { setI33(II[2]); } - global_log->info() << "Using moments of inertia set in xml config: Ixx = " << I11() << " ; Iyy = " << I22() << " ; Izz = " << I33() << std::endl; + Log::global_log->info() << "Using moments of inertia set in xml config: Ixx = " << I11() << " ; Iyy = " << I22() << " ; Izz = " << I33() << std::endl; xmlconfig.changecurrentnode(".."); } else { - global_log->info() << "Using calculated moments of inertia: Ixx = " << I11() << " ; Iyy = " << I22() << " ; Izz = " << I33() << std::endl; + Log::global_log->info() << "Using calculated moments of inertia: Ixx = " << I11() << " ; Iyy = " << I22() << " ; Izz = " << I33() << std::endl; } } @@ -152,7 +150,7 @@ void Component::updateMassInertia(Site& site) { _m += site.m(); // assume the input is already transformed to the principal axes system // (and therefore the origin is the center of mass) - + if ( not _isStockmayer){ //if the component is a Stockmayer fluid, the moments of inertia are fixed at [1 1 0] // _I[0] += m * (y * y + z * z); _I[0] += site.m() * (site.ry() * site.ry() + site.rz() * site.rz()); @@ -168,8 +166,8 @@ void Component::updateMassInertia(Site& site) { _I[5] -= site.m() * site.ry() * site.rz(); _rot_dof = 3; - - + + for (unsigned short d = 0; d < 3; ++d) { _Ipa[d] = _I[d]; if (_Ipa[d] == 0.) --_rot_dof; @@ -221,30 +219,30 @@ void Component::write(std::ostream& ostrm) const { << 0 << "\n"; // the 0 indicates a zero amount of tersoff sites. for (auto pos = _ljcenters.cbegin(); pos != _ljcenters.end(); ++pos) { pos->write(ostrm); - ostrm << endl; + ostrm << std::endl; } for (auto pos = _charges.cbegin(); pos != _charges.end(); ++pos) { pos->write(ostrm); - ostrm << endl; + ostrm << std::endl; } for (auto pos = _dipoles.cbegin(); pos != _dipoles.end(); ++pos) { pos->write(ostrm); - ostrm << endl; + ostrm << std::endl; } for (auto pos = _quadrupoles.cbegin(); pos != _quadrupoles.end(); ++pos) { pos->write(ostrm); - ostrm << endl; + ostrm << std::endl; } - ostrm << _Ipa[0] << " " << _Ipa[1] << " " << _Ipa[2] << endl; + ostrm << _Ipa[0] << " " << _Ipa[1] << " " << _Ipa[2] << std::endl; } void Component::writeVIM(std::ostream& ostrm) { for (auto pos = _ljcenters.cbegin(); pos != _ljcenters.end(); ++pos) { - ostrm << "~ " << this->_id + 1 << " LJ " << setw(7) << pos->rx() << ' ' - << setw(7) << pos->ry() << ' ' << setw(7) << pos->rz() << ' ' - << setw(6) << pos->sigma() << ' ' << setw(2) << (1 + (this->_id % 9)) << "\n"; + ostrm << "~ " << this->_id + 1 << " LJ " << std::setw(7) << pos->rx() << ' ' + << std::setw(7) << pos->ry() << ' ' << std::setw(7) << pos->rz() << ' ' + << std::setw(6) << pos->sigma() << ' ' << std::setw(2) << (1 + (this->_id % 9)) << "\n"; } - ostrm << flush; + ostrm << std::flush; } std::ostream& operator<<(std::ostream& stream, const Component& component) { diff --git a/src/molecules/Component.h b/src/molecules/Component.h index f295bb05f7..f12f8c3c8e 100644 --- a/src/molecules/Component.h +++ b/src/molecules/Component.h @@ -75,7 +75,7 @@ class Component { const Quadrupole& quadrupole(unsigned int i) const { return _quadrupoles[i]; } void setNumMolecules(unsigned long num) { _numMolecules = num; } /**< set the number of molecules for this component */ - void incNumMolecules() { ++_numMolecules; } /**< increase the number of molecules for this component by 1 */ + void incNumMolecules() { ++_numMolecules; } /**< increase the number of molecules for this component by 1 */ void incNumMolecules(int N) { _numMolecules += N; } /**< increase the number of molecules for this component by N */ unsigned long getNumMolecules() const { return _numMolecules; } /**< get the number of molecules (global) of the component */ @@ -163,9 +163,9 @@ class Component { double _E_trans; // translational energy double _E_rot; // rotational energy double _T; // temperature - + bool _isStockmayer; //Checks whether component is a Stockmayer fluid to determine moments of inertia - + std::string _name; /**< name of the component/molecule type */ /** diff --git a/src/molecules/FullMolecule.cpp b/src/molecules/FullMolecule.cpp index a7472867e7..0e263fa77e 100644 --- a/src/molecules/FullMolecule.cpp +++ b/src/molecules/FullMolecule.cpp @@ -7,9 +7,6 @@ #include "utils/Logger.h" -using namespace std; -using Log::global_log; - FullMolecule::FullMolecule(unsigned long id, Component *component, double rx, double ry, double rz, @@ -375,7 +372,7 @@ void FullMolecule::upd_postF(double dt_halve, double& summv2, double& sumIw2) { v2 += _v[d] * _v[d]; _L[d] += dt_halve * _M[d]; } - mardyn_assert(!isnan(v2)); // catches NaN + mardyn_assert(!std::isnan(v2)); // catches NaN summv2 += _m * v2; std::array w = _q.rotateinv(D_arr()); // L = D = Iw @@ -384,7 +381,7 @@ void FullMolecule::upd_postF(double dt_halve, double& summv2, double& sumIw2) { w[d] *= _invI[d]; Iw2 += _I[d] * w[d] * w[d]; } - mardyn_assert(!isnan(Iw2)); // catches NaN + mardyn_assert(!std::isnan(Iw2)); // catches NaN sumIw2 += Iw2; } @@ -439,7 +436,7 @@ std::string FullMolecule::getWriteFormat(){ return std::string("ICRVQD"); } -void FullMolecule::write(ostream& ostrm) const { +void FullMolecule::write(std::ostream& ostrm) const { ostrm << _id << "\t" << (_component->ID() + 1) << "\t" << _r[0] << " " << _r[1] << " " << _r[2] << "\t" << _v[0] << " " << _v[1] << " " << _v[2] << "\t" @@ -531,12 +528,12 @@ void FullMolecule::calcFM_site(const std::array& dsite, const std::ar * catches NaN assignments */ for (int d = 0; d < 3; d++) { - if (isnan(dsite[d])) { - global_log->error() << "Severe dsite[" << d << "] error for site of m" << _id << endl; + if (std::isnan(dsite[d])) { + Log::global_log->error() << "Severe dsite[" << d << "] error for site of m" << _id << std::endl; mardyn_assert(false); } - if (isnan(Fsite[d])) { - global_log->error() << "Severe Fsite[" << d << "] error for site of m" << _id << endl; + if (std::isnan(Fsite[d])) { + Log::global_log->error() << "Severe Fsite[" << d << "] error for site of m" << _id << std::endl; mardyn_assert(false); } } @@ -621,9 +618,9 @@ void FullMolecule::calcFM() { temp_Vi[0] *= 0.5; temp_Vi[1] *= 0.5; temp_Vi[2] *= 0.5; - mardyn_assert(!isnan(temp_Vi[0])); - mardyn_assert(!isnan(temp_Vi[1])); - mardyn_assert(!isnan(temp_Vi[2])); + mardyn_assert(!std::isnan(temp_Vi[0])); + mardyn_assert(!std::isnan(temp_Vi[1])); + mardyn_assert(!std::isnan(temp_Vi[2])); Viadd(temp_Vi); Madd(temp_M); } @@ -646,13 +643,13 @@ void FullMolecule::check(unsigned long id) { mardyn_assert(isfinite(_F[d])); mardyn_assert(isfinite(_M[d])); mardyn_assert(isfinite(_I[d])); - // mardyn_assert(!isnan(_Vi[d])); + // mardyn_assert(!std::isnan(_Vi[d])); mardyn_assert(isfinite(_invI[d])); } _q.check(); if (!isfinite(_Vi[0]) || !isfinite(_Vi[1]) || !isfinite(_Vi[2])) { - cout << "\talert: molecule id " << id << " (internal cid " << this->_component->ID() << ") has virial _Vi = (" - << _Vi[0] << ", " << _Vi[1] << ", " << _Vi[2] << ")" << endl; + std::cout << "\talert: molecule id " << id << " (internal cid " << this->_component->ID() << ") has virial _Vi = (" + << _Vi[0] << ", " << _Vi[1] << ", " << _Vi[2] << ")" << std::endl; _Vi[0] = 0.0; _Vi[1] = 0.0; _Vi[2] = 0.0; diff --git a/src/molecules/FullMolecule.h b/src/molecules/FullMolecule.h index a834e221ce..0a2621a606 100644 --- a/src/molecules/FullMolecule.h +++ b/src/molecules/FullMolecule.h @@ -57,7 +57,7 @@ class FullMolecule : public MoleculeInterface { void setv(unsigned short d, double v) override { _v[d] = v; } /** get molecule's mass */ double mass() const override { return _m; } - + void setF(unsigned short d, double F) override { _F[d] = F; } /** get coordinate of current force onto molecule */ double F(unsigned short d) const override {return _F[d]; } @@ -102,7 +102,7 @@ class FullMolecule : public MoleculeInterface { /** calculate and return the square velocity */ double v2() const override {return _v[0]*_v[0]+_v[1]*_v[1]+_v[2]*_v[2]; } - + /** calculate and return the square angular momentum */ double L2() const override {return _L[0]*_L[0]+_L[1]*_L[1]+_L[2]*_L[2]; } @@ -120,7 +120,7 @@ class FullMolecule : public MoleculeInterface { double U_rot_2() override ; /** return total kinetic energy of the molecule */ double U_kin() override { return U_trans() + U_rot(); } - + void setupSoACache(CellDataSoABase * s, unsigned iLJ, unsigned iC, unsigned iD, unsigned iQ) override; void setSoA(CellDataSoABase * s) override; @@ -129,7 +129,7 @@ class FullMolecule : public MoleculeInterface { void setStartIndexSoA_D(unsigned i) override {_soa_index_d = i;} void setStartIndexSoA_Q(unsigned i) override {_soa_index_q = i;} - /* TODO: Maybe we should better do this using the component directly? + /* TODO: Maybe we should better do this using the component directly? * In the GNU STL vector.size() causes two memory accesses and one subtraction! */ /** get number of sites */ @@ -261,13 +261,13 @@ class FullMolecule : public MoleculeInterface { } return d2; } - + /** set force acting on molecule * @param[out] F force vector (x,y,z) */ void setF(double F[3]) override { for(int d = 0; d < 3; d++ ) { _F[d] = F[d]; } } - /** set momentum acting on molecule + /** set momentum acting on molecule * @param M force vector (x,y,z) */ void setM(double M[3]) override { for(int d = 0; d < 3; d++ ) { _M[d] = M[d]; } } @@ -319,7 +319,7 @@ class FullMolecule : public MoleculeInterface { void clearFM() override; /** calculate forces and moments for already given site forces */ void calcFM() override; - + /** perform data consistency check for the molecule (only debug mode) */ void check(unsigned long id) override; diff --git a/src/molecules/MoleculeInterface.cpp b/src/molecules/MoleculeInterface.cpp index bc150b6b65..e946f5f1f3 100644 --- a/src/molecules/MoleculeInterface.cpp +++ b/src/molecules/MoleculeInterface.cpp @@ -14,9 +14,6 @@ #include "utils/Logger.h" #include "Simulation.h" -using namespace std; -using Log::global_log; - bool MoleculeInterface::isLessThan(const MoleculeInterface& m2) const { if (r(2) < m2.r(2)) @@ -34,7 +31,7 @@ bool MoleculeInterface::isLessThan(const MoleculeInterface& m2) const { else if (r(0) > m2.r(0)) return false; else { - global_log->error() << "LinkedCells::isFirstParticle: both Particles have the same position" << endl; + Log::global_log->error() << "LinkedCells::isFirstParticle: both Particles have the same position" << std::endl; Simulation::exit(1); } } diff --git a/src/molecules/MoleculeInterface.h b/src/molecules/MoleculeInterface.h index fcee364c12..197a2b0a54 100644 --- a/src/molecules/MoleculeInterface.h +++ b/src/molecules/MoleculeInterface.h @@ -87,7 +87,7 @@ class MoleculeInterface { virtual void setD(unsigned short d, double D) = 0; inline virtual void move(int d, double dr) = 0; - + //by Stefan Becker virtual double getI(unsigned short d) const = 0; @@ -165,30 +165,30 @@ class MoleculeInterface { //calculates orientation angle for ARDF double orientationAngle(const MoleculeInterface& molecule2, double dr[3], double d2) const { - + double cosPhi = 0.; double orientationVector[3]; double orientationVectorSquared = 0.; double roundingThreshold = 0.0001; - + orientationVector[0] = 2. * (q().qx() * q().qz() + q().qw() * q().qy()); orientationVector[1] = 2. * (q().qy() * q().qz() - q().qw() * q().qx()); orientationVector[2] = 1. - 2. * (q().qx() * q().qx() + q().qy() * q().qy()); - - + + for (unsigned short d = 0; d < 3; d++) { dr[d] = molecule2.r(d) - r(d); orientationVectorSquared += orientationVector[d] * orientationVector[d]; } - + for (unsigned short d = 0; d < 3; d++) { cosPhi += orientationVector[d] * dr[d] / sqrt(orientationVectorSquared) / sqrt(d2); } return cosPhi; - + } - + virtual void setF(double F[3]) = 0; virtual void setM(double M[3]) = 0; virtual void setVi(double Vi[3]) = 0; diff --git a/src/molecules/MoleculeRMM.h b/src/molecules/MoleculeRMM.h index 6ece45d5b6..8acd124aef 100644 --- a/src/molecules/MoleculeRMM.h +++ b/src/molecules/MoleculeRMM.h @@ -215,7 +215,7 @@ class MoleculeRMM : public MoleculeInterface { mardyn_assert(false); return sizeof(*this); } - + void setF(double /*F*/ [3]) override {} void setM(double /*M*/[3]) override {} void setVi(double /*Vi*/[3]) override {} @@ -284,7 +284,7 @@ class MoleculeRMM : public MoleculeInterface { StorageState getStorageState() const { return _state; } - + void buildOwnSoA() override { mardyn_assert(_state == STORAGE_AOS); diff --git a/src/molecules/Site.h b/src/molecules/Site.h index f84381758a..411d961040 100644 --- a/src/molecules/Site.h +++ b/src/molecules/Site.h @@ -9,7 +9,7 @@ #include #include -using Log::global_log; + /** @brief The Site class is the basis for the implementation of physical interactions. * @@ -55,9 +55,9 @@ class Site { xmlconfig.getNodeValueReduced("coords/y", _r[1]); xmlconfig.getNodeValueReduced("coords/z", _r[2]); xmlconfig.getNodeValueReduced("mass", _m); - + if (!xmlconfig.getNodeValue("@name", _name)) { - global_log->error() << "Cannot find site name. Defaulting to type." << std::endl; + Log::global_log->error() << "Cannot find site name. Defaulting to type." << std::endl; xmlconfig.getNodeValue("@type", _name); } @@ -87,7 +87,7 @@ class Site { /** @brief Lennard-Jones 12-6 center * - * Lennard-Jones 12-6 interaction site. The potential between two LJ centers of the same type is + * Lennard-Jones 12-6 interaction site. The potential between two LJ centers of the same type is * given by * \f[ * U_\text{LJ} = \epsilon \left[ \left(\frac{r}{\sigma}\right)^{6} - \left(\frac{r}{\sigma}\right)^{12} \right] @@ -128,7 +128,7 @@ class LJcenter : public Site { xmlconfig.getNodeValueReduced("sigma", _sigma); xmlconfig.getNodeValue("shifted", _shiftRequested); } - + /// write to stream void write(std::ostream& ostrm) const { Site::write(ostrm); diff --git a/src/molecules/mixingrules/LorentzBerthelot.cpp b/src/molecules/mixingrules/LorentzBerthelot.cpp index 594eaa8bda..e461a9c21d 100644 --- a/src/molecules/mixingrules/LorentzBerthelot.cpp +++ b/src/molecules/mixingrules/LorentzBerthelot.cpp @@ -3,13 +3,12 @@ #include "utils/Logger.h" #include "utils/xmlfileUnits.h" -using namespace std; -using Log::global_log; + void LorentzBerthelotMixingRule::readXML(XMLfileUnits& xmlconfig) { MixingRuleBase::readXML(xmlconfig); xmlconfig.getNodeValue("eta", _eta); xmlconfig.getNodeValue("xi", _xi); - global_log->info() << "Mixing coefficients: (eta, xi) = (" << _eta << ", " << _xi << ")" << endl; + Log::global_log->info() << "Mixing coefficients: (eta, xi) = (" << _eta << ", " << _xi << ")" << std::endl; } diff --git a/src/molecules/mixingrules/MixingRuleBase.cpp b/src/molecules/mixingrules/MixingRuleBase.cpp index cbe82ea51a..df2f6b07ca 100644 --- a/src/molecules/mixingrules/MixingRuleBase.cpp +++ b/src/molecules/mixingrules/MixingRuleBase.cpp @@ -3,13 +3,12 @@ #include "utils/Logger.h" #include "utils/xmlfileUnits.h" -using namespace std; -using Log::global_log; + void MixingRuleBase::readXML(XMLfileUnits& xmlconfig) { xmlconfig.getNodeValue("@cid1", _cid1); xmlconfig.getNodeValue("@cid2", _cid2); - global_log->info() << "Component id1: " << _cid1 << endl; - global_log->info() << "Component id2: " << _cid2 << endl; + Log::global_log->info() << "Component id1: " << _cid1 << std::endl; + Log::global_log->info() << "Component id2: " << _cid2 << std::endl; } diff --git a/src/molecules/potforce.h b/src/molecules/potforce.h index c4cf83d570..132b9c3bdc 100644 --- a/src/molecules/potforce.h +++ b/src/molecules/potforce.h @@ -184,7 +184,7 @@ inline void PotForceDiQuadrupole(const double dr[3], const double& dr2, const do } -/** @brief Calculate potential and force between two point charges. +/** @brief Calculate potential and force between two point charges. * Coulomb's law. */ inline void PotForce2Charge(const double dr[3], const double& dr2, @@ -497,7 +497,7 @@ inline void PotForce(Molecule& mi, Molecule& mj, ParaStrm& params, double drm[3] mi.Viadd(Virial); mj.Viadd(Virial); - + // check whether all parameters were used mardyn_assert(params.eos()); } diff --git a/src/parallel/CollectiveCommBase.h b/src/parallel/CollectiveCommBase.h index e9a56912bf..46645ebf97 100644 --- a/src/parallel/CollectiveCommBase.h +++ b/src/parallel/CollectiveCommBase.h @@ -13,7 +13,7 @@ //! have to care whether the program will be executed in parallel or sequentially. //! The only thing that the application developer should know that there might //! be several processes and at some point in the simulation those have to do a -//! collective communication to broadcast or reduce values. Those values are +//! collective communication to broadcast or reduce values. Those values are //! given to the domain decomposition method, the communication command is executed //! by the domain decomp and the values can be read again. This class just has to //! ensure that this also works if there is no real domain decomposition but the diff --git a/src/parallel/CollectiveCommBaseInterface.h b/src/parallel/CollectiveCommBaseInterface.h index e35452696c..7259c28d95 100644 --- a/src/parallel/CollectiveCommBaseInterface.h +++ b/src/parallel/CollectiveCommBaseInterface.h @@ -16,7 +16,7 @@ enum ReduceType { //! have to care whether the program will be executed in parallel or sequentially. //! The only thing that the application developer should know that there might //! be several processes and at some point in the simulation those have to do a -//! collective communication to broadcast or reduce values. Those values are +//! collective communication to broadcast or reduce values. Those values are //! given to the domain decomposition method, the communication command is executed //! by the domain decomp and the values can be read again. This class just has to //! ensure that this also works if there is no real domain decomposition but the diff --git a/src/parallel/CollectiveCommunicationNonBlocking.h b/src/parallel/CollectiveCommunicationNonBlocking.h index cdb998b9f2..3582472c25 100644 --- a/src/parallel/CollectiveCommunicationNonBlocking.h +++ b/src/parallel/CollectiveCommunicationNonBlocking.h @@ -15,7 +15,6 @@ #if MPI_VERSION >= 3 -using Log::global_log; /** * CollectiveCommunicationNonBlocking provides an interface to access multiple CollectiveCommunicationSingleNonBlocking objects. * This allows the use of multiple different collective calls, which is needed for the different ensembles. @@ -40,7 +39,7 @@ class CollectiveCommunicationNonBlocking: public CollectiveCommunicationInterfac //! @param numValues number of values that shall be communicated void init(MPI_Comm communicator, int numValues, int key = 0) override { if (_currentKey != -1) { - global_log->error() << "CollectiveCommunicationNonBlocking: previous communication with key " << _currentKey + Log::global_log->error() << "CollectiveCommunicationNonBlocking: previous communication with key " << _currentKey << " not yet finalized" << std::endl; Simulation::exit(234); } @@ -50,15 +49,15 @@ class CollectiveCommunicationNonBlocking: public CollectiveCommunicationInterfac // add the key, if it is not yet existent: if (_comms.count(_currentKey) == 1) { // this happens, if the key is already existent. - global_log->debug() << "CollectiveCommunicationNonBlocking: key " << _currentKey + Log::global_log->debug() << "CollectiveCommunicationNonBlocking: key " << _currentKey << " already existent. Reusing information." << std::endl; } else { - global_log->debug() << "CollectiveCommunicationNonBlocking: key " << _currentKey + Log::global_log->debug() << "CollectiveCommunicationNonBlocking: key " << _currentKey << " not existent. Cannot reuse information." << std::endl; // Creates the CollectiveCommunicationSingleNonBlocking object auto [_, inserted] = _comms.try_emplace(_currentKey); if (not inserted) { - global_log->error() << "CollectiveCommunicationNonBlocking: key " << _currentKey + Log::global_log->error() << "CollectiveCommunicationNonBlocking: key " << _currentKey << " could not be inserted. Aborting!" << std::endl; Simulation::exit(498789); } @@ -71,7 +70,7 @@ class CollectiveCommunicationNonBlocking: public CollectiveCommunicationInterfac void finalize() override { _comms.at(_currentKey).finalize(); if (_currentKey == 0) { - global_log->debug() << "CollectiveCommunicationNonBlocking: finalizing with key " << _currentKey + Log::global_log->debug() << "CollectiveCommunicationNonBlocking: finalizing with key " << _currentKey << ", thus the entry is removed." << std::endl; _comms.erase(_currentKey); } diff --git a/src/parallel/CommunicationBuffer.cpp b/src/parallel/CommunicationBuffer.cpp index 2a2a65e12c..5bd946f986 100644 --- a/src/parallel/CommunicationBuffer.cpp +++ b/src/parallel/CommunicationBuffer.cpp @@ -68,7 +68,7 @@ void CommunicationBuffer::resizeForReceivingMolecules(unsigned long& numLeaving, void CommunicationBuffer::resizeForReceivingMolecules(unsigned long& numForces) { // message has been received - + // read _numForces size_t i_runningByte = 0; //i_runningByte = readValue(i_runningByte, _numForces); @@ -76,7 +76,7 @@ void CommunicationBuffer::resizeForReceivingMolecules(unsigned long& numForces) numForces = _numForces; } -void CommunicationBuffer::resizeForAppendingLeavingMolecules(unsigned long numLeaving) { +void CommunicationBuffer::resizeForAppendingLeavingMolecules(unsigned long numLeaving) { _numLeaving += numLeaving; mardyn_assert(_numHalo == 0ul); // assumption: add leaving, add leaving, then add halo, halo, halo, ... but not intertwined. size_t numBytes = sizeof(_numHalo) + sizeof(_numLeaving) + @@ -89,7 +89,7 @@ void CommunicationBuffer::resizeForAppendingLeavingMolecules(unsigned long numLe i_runningByte = emplaceValue(i_runningByte, _numLeaving); } -void CommunicationBuffer::resizeForAppendingHaloMolecules(unsigned long numHalo) { +void CommunicationBuffer::resizeForAppendingHaloMolecules(unsigned long numHalo) { // _numLeaving stays _numHalo += numHalo; size_t numBytes = sizeof(_numHalo) + sizeof(_numLeaving) + @@ -111,7 +111,7 @@ void CommunicationBuffer::resizeForAppendingForceMolecules(unsigned long numForc // Do NOT write the number of force molecules, here! It is assumed at other places, that they are NOT exchanged! } -void CommunicationBuffer::addLeavingMolecule(size_t indexOfMolecule, const Molecule& m) { +void CommunicationBuffer::addLeavingMolecule(size_t indexOfMolecule, const Molecule& m) { mardyn_assert(indexOfMolecule < _numLeaving); size_t i_firstByte = getStartPosition(ParticleType_t::LEAVING, indexOfMolecule); @@ -183,9 +183,9 @@ void CommunicationBuffer::addForceMolecule(size_t indexOfMolecule, const Molecul // some MarDynAssert? size_t i_firstByte = getStartPosition(ParticleType_t::FORCE, indexOfMolecule); // adjust getStartPosition etc. // some MarDynAssert? - + size_t i_runningByte = i_firstByte; - + // add force molecule #ifdef ENABLE_REDUCED_MEMORY_MODE i_runningByte = emplaceValue(i_runningByte, m.getID()); @@ -194,7 +194,7 @@ void CommunicationBuffer::addForceMolecule(size_t indexOfMolecule, const Molecul i_runningByte = emplaceValue(i_runningByte, static_cast(m.r(2))); i_runningByte = emplaceValue(i_runningByte, static_cast(m.F(0))); i_runningByte = emplaceValue(i_runningByte, static_cast(m.F(1))); - i_runningByte = emplaceValue(i_runningByte, static_cast(m.F(2))); + i_runningByte = emplaceValue(i_runningByte, static_cast(m.F(2))); #else i_runningByte = emplaceValue(i_runningByte, m.getID()); i_runningByte = emplaceValue(i_runningByte, m.r(0)); @@ -323,21 +323,21 @@ void CommunicationBuffer::readForceMolecule(size_t indexOfMolecule, Molecule& m) // some mardyn assert size_t i_firstByte = getStartPosition(ParticleType_t::FORCE, indexOfMolecule); // some mardyn assert - + size_t i_runningByte = i_firstByte; - + #ifdef ENABLE_REDUCED_MEMORY_MODE - vcp_real_calc rbuf[3]; + vcp_real_calc rbuf[3]; vcp_real_accum Fbuf[3]; unsigned long idbuf; - + i_runningByte = readValue(i_runningByte, idbuf); i_runningByte = readValue(i_runningByte, rbuf[0]); i_runningByte = readValue(i_runningByte, rbuf[1]); i_runningByte = readValue(i_runningByte, rbuf[2]); i_runningByte = readValue(i_runningByte, Fbuf[0]); i_runningByte = readValue(i_runningByte, Fbuf[1]); - i_runningByte = readValue(i_runningByte, Fbuf[2]); + i_runningByte = readValue(i_runningByte, Fbuf[2]); m.setid(idbuf); for(int d = 0; d < 3; d++) { m.setr(d, rbuf[d]); @@ -345,11 +345,11 @@ void CommunicationBuffer::readForceMolecule(size_t indexOfMolecule, Molecule& m) for(int d = 0; d < 3; d++) { m.setF(d, Fbuf[d]); } - + #else double rbuf[3], Fbuf[3], Mbuf[3], Vibuf[3]; unsigned long idbuf; - + i_runningByte = readValue(i_runningByte, idbuf); i_runningByte = readValue(i_runningByte, rbuf[0]); i_runningByte = readValue(i_runningByte, rbuf[1]); diff --git a/src/parallel/CommunicationBuffer.h b/src/parallel/CommunicationBuffer.h index b23e0f8b2c..04ce2b3fef 100644 --- a/src/parallel/CommunicationBuffer.h +++ b/src/parallel/CommunicationBuffer.h @@ -8,8 +8,8 @@ #ifndef SRC_PARALLEL_COMMUNICATIONBUFFER_H_ #define SRC_PARALLEL_COMMUNICATIONBUFFER_H_ -#include "molecules/MoleculeForwardDeclaration.h" -#include "utils/mardyn_assert.h" +#include "molecules/MoleculeForwardDeclaration.h" +#include "utils/mardyn_assert.h" #include #include @@ -64,7 +64,7 @@ class CommunicationBuffer { void readHaloMolecule(size_t indexOfMolecule, Molecule& m) const; void readForceMolecule(size_t indexOfMolecule, Molecule& m) const; - void resizeForReceivingMolecules(unsigned long& numLeaving, unsigned long& numHalo); + void resizeForReceivingMolecules(unsigned long& numLeaving, unsigned long& numHalo); void resizeForReceivingMolecules(unsigned long& numForces); size_t getNumHalo() const { @@ -74,7 +74,7 @@ class CommunicationBuffer { size_t getNumLeaving() const { return _numLeaving; } - + size_t getNumForces() const { return _numForces; } diff --git a/src/parallel/CommunicationPartner.cpp b/src/parallel/CommunicationPartner.cpp index 9f5a31e65d..de7141bf55 100644 --- a/src/parallel/CommunicationPartner.cpp +++ b/src/parallel/CommunicationPartner.cpp @@ -145,7 +145,7 @@ void CommunicationPartner::initSend(ParticleContainer* moleculeContainer, const const unsigned int numHaloInfo = _haloInfo.size(); switch (msgType){ case MessageType::LEAVING_AND_HALO_COPIES: { - global_log->debug() << "sending halo and boundary particles together" << std::endl; + Log::global_log->debug() << "sending halo and boundary particles together" << std::endl; // first leaving particles: for (unsigned int p = 0; p < numHaloInfo; p++) { if (moleculeContainer->isInvalidParticleReturner() and mightUseInvalidParticles) { @@ -165,7 +165,7 @@ void CommunicationPartner::initSend(ParticleContainer* moleculeContainer, const break; } case MessageType::LEAVING_ONLY: { - global_log->debug() << "sending leaving particles only" << std::endl; + Log::global_log->debug() << "sending leaving particles only" << std::endl; for(unsigned int p = 0; p < numHaloInfo; p++){ if (moleculeContainer->isInvalidParticleReturner() and mightUseInvalidParticles) { collectLeavingMoleculesFromInvalidParticles(invalidParticles, _haloInfo[p]._leavingLow, @@ -178,7 +178,7 @@ void CommunicationPartner::initSend(ParticleContainer* moleculeContainer, const break; } case MessageType::HALO_COPIES: { - global_log->debug() << "sending halo particles only" << std::endl; + Log::global_log->debug() << "sending halo particles only" << std::endl; for(unsigned int p = 0; p < numHaloInfo; p++){ collectMoleculesInRegion(moleculeContainer, _haloInfo[p]._copiesLow, _haloInfo[p]._copiesHigh, _haloInfo[p]._shift, false, HALO, doHaloPositionCheck); @@ -186,7 +186,7 @@ void CommunicationPartner::initSend(ParticleContainer* moleculeContainer, const break; } case MessageType::FORCES: { - global_log->debug() << "sending forces" << std::endl; + Log::global_log->debug() << "sending forces" << std::endl; for(unsigned int p = 0; p < numHaloInfo; p++){ collectMoleculesInRegion(moleculeContainer, _haloInfo[p]._leavingLow, _haloInfo[p]._leavingHigh, _haloInfo[p]._shift, false, FORCES); @@ -194,30 +194,30 @@ void CommunicationPartner::initSend(ParticleContainer* moleculeContainer, const break; } default: - global_log->error() << "[CommunicationPartner] MessageType unknown!" << std::endl; + Log::global_log->error() << "[CommunicationPartner] MessageType unknown!" << std::endl; Simulation::exit(1); } #ifndef NDEBUG const int numLeaving = _sendBuf.getNumLeaving(); const int numHalo = _sendBuf.getNumHalo(); - global_log->debug() << "Buffer contains " << numLeaving << " leaving particles with IDs " << std::endl; + Log::global_log->debug() << "Buffer contains " << numLeaving << " leaving particles with IDs " << std::endl; std::ostringstream buf1; for (int i = 0; i < numLeaving; ++i) { Molecule m; _sendBuf.readLeavingMolecule(i, m); buf1 << m.getID() << " "; } - global_log->debug() << buf1.str() << std::endl; + Log::global_log->debug() << buf1.str() << std::endl; - global_log->debug() << "and " << numHalo << " halo particles with IDs " << std::endl; + Log::global_log->debug() << "and " << numHalo << " halo particles with IDs " << std::endl; std::ostringstream buf2; for (int i = 0; i < numHalo; ++i) { Molecule m; _sendBuf.readHaloMolecule(i, m); buf2 << m.getID() << " "; } - global_log->debug() << buf2.str() << std::endl; + Log::global_log->debug() << buf2.str() << std::endl; #endif @@ -255,8 +255,8 @@ bool CommunicationPartner::iprobeCount(const MPI_Comm& comm, const MPI_Datatype& int numrecv; MPI_CHECK(MPI_Get_count(_recvStatus, _sendBuf.getMPIDataType(), &numrecv)); #ifndef NDEBUG - global_log->debug() << "Received byteCount from " << _rank << std::endl; - global_log->debug() << "Preparing to receive " << numrecv << " bytes." << std::endl; + Log::global_log->debug() << "Received byteCount from " << _rank << std::endl; + Log::global_log->debug() << "Preparing to receive " << numrecv << " bytes." << std::endl; #endif _recvBuf.resizeForRawBytes(numrecv); MPI_CHECK(MPI_Irecv(_recvBuf.getDataForSending(), numrecv, _sendBuf.getMPIDataType(), _rank, 99, comm, _recvRequest)); @@ -265,8 +265,7 @@ bool CommunicationPartner::iprobeCount(const MPI_Comm& comm, const MPI_Datatype& return _countReceived; } bool CommunicationPartner::testRecv(ParticleContainer* moleculeContainer, bool removeRecvDuplicates, bool force) { - using Log::global_log; - if (_countReceived and not _msgReceived) { + if (_countReceived and not _msgReceived) { int flag = 1; if (_countTested > 10) { // some MPI (Intel, IBM) implementations can produce deadlocks using MPI_Test without any MPI_Wait @@ -287,24 +286,24 @@ bool CommunicationPartner::testRecv(ParticleContainer* moleculeContainer, bool r _recvBuf.resizeForReceivingMolecules(numLeaving, numHalo); #ifndef NDEBUG - global_log->debug() << "Receiving particles from " << _rank << std::endl; - global_log->debug() << "Buffer contains " << numLeaving << " leaving particles with IDs " << std::endl; + Log::global_log->debug() << "Receiving particles from " << _rank << std::endl; + Log::global_log->debug() << "Buffer contains " << numLeaving << " leaving particles with IDs " << std::endl; std::ostringstream buf1; for (unsigned long i = 0; i < numLeaving; ++i) { Molecule m; _recvBuf.readLeavingMolecule(i, m); buf1 << m.getID() << " "; } - global_log->debug() << buf1.str() << std::endl; + Log::global_log->debug() << buf1.str() << std::endl; - global_log->debug() << "and " << numHalo << " halo particles with IDs " << std::endl; + Log::global_log->debug() << "and " << numHalo << " halo particles with IDs " << std::endl; std::ostringstream buf2; for (unsigned long i = 0; i < numHalo; ++i) { Molecule m; _recvBuf.readHaloMolecule(i, m); buf2 << m.getID() << " "; } - global_log->debug() << buf2.str() << std::endl; + Log::global_log->debug() << buf2.str() << std::endl; #endif global_simulation->timers()->start("COMMUNICATION_PARTNER_TEST_RECV"); @@ -339,8 +338,8 @@ bool CommunicationPartner::testRecv(ParticleContainer* moleculeContainer, bool r #ifndef NDEBUG - global_log->debug() << "Receiving particles from " << _rank << std::endl; - global_log->debug() << "Buffer contains " << numForces << " force particles with IDs " << std::endl; + Log::global_log->debug() << "Receiving particles from " << _rank << std::endl; + Log::global_log->debug() << "Buffer contains " << numForces << " force particles with IDs " << std::endl; std::ostringstream buf1; for(unsigned long i = 0; i < numForces; ++i) { @@ -348,7 +347,7 @@ bool CommunicationPartner::testRecv(ParticleContainer* moleculeContainer, bool r _recvBuf.readForceMolecule(i, m); buf1 << m.getID() << " "; } - global_log->debug() << buf1.str() << std::endl; + Log::global_log->debug() << buf1.str() << std::endl; #endif @@ -402,19 +401,18 @@ void CommunicationPartner::initRecv(int numParticles, const MPI_Comm& comm, cons } void CommunicationPartner::deadlockDiagnosticSendRecv() { - using Log::global_log; deadlockDiagnosticSend(); if (not _countReceived and _isReceiving) { - global_log->warning() << "Probe request to " << _rank << " not yet completed" << std::endl; + Log::global_log->warning() << "Probe request to " << _rank << " not yet completed" << std::endl; } deadlockDiagnosticRecv(); } void CommunicationPartner::deadlockDiagnosticSend() { - // intentionally using std::cout instead of global_log, we want the messages from all processes + // intentionally using std::cout instead of Log::global_log, we want the messages from all processes if (not _msgSent and _isSending) { Log::global_log->warning() << "Send request to " << _rank << " not yet completed" << std::endl; } @@ -438,8 +436,8 @@ void CommunicationPartner::collectMoleculesInRegion(ParticleContainer* moleculeC bool doHaloPositionCheck) { using std::vector; global_simulation->timers()->start("COMMUNICATION_PARTNER_INIT_SEND"); - vector> threadData; - vector prefixArray; + std::vector> threadData; + std::vector prefixArray; // compute how many molecules are already in of this type: - adjust for Forces unsigned long numMolsAlreadyIn = 0; @@ -600,7 +598,7 @@ void CommunicationPartner::collectLeavingMoleculesFromInvalidParticles(std::vect // it will add the given molecule to _sendBuf with the necessary shift. auto shiftAndAdd = [domain, lowCorner, highCorner, shift, this, &numMolsAlreadyIn](Molecule& m) { if (not m.inBox(lowCorner, highCorner)) { - global_log->error() << "trying to remove a particle that is not in the halo region" << std::endl; + Log::global_log->error() << "trying to remove a particle that is not in the halo region" << std::endl; Simulation::exit(456); } for (int dim = 0; dim < 3; dim++) { @@ -658,7 +656,6 @@ void CommunicationPartner::print(std::ostream& stream) const { << " [" << region._copiesLow[2] << ", " << region._copiesHigh[2] << ")" << std::endl; stream << " offset: (" << region._offset[0] << ", " << region._offset[1] << ", " << region._offset[2] << ")" << std::endl; stream << " shift: (" << region._shift[0] << ", " << region._shift[1] << ", "<< region._shift[2] << ")" << std::endl; - } } diff --git a/src/parallel/CommunicationPartner.h b/src/parallel/CommunicationPartner.h index 5e061b2519..b4591cf971 100644 --- a/src/parallel/CommunicationPartner.h +++ b/src/parallel/CommunicationPartner.h @@ -134,7 +134,7 @@ class CommunicationPartner { // technical variables MPI_Request *_sendRequest, *_recvRequest; MPI_Status *_sendStatus, *_recvStatus; - CommunicationBuffer _sendBuf, _recvBuf; // used to be ParticleData and + CommunicationBuffer _sendBuf, _recvBuf; // used to be ParticleData and bool _msgSent, _countReceived, _msgReceived, _isSending, _isReceiving; void collectLeavingMoleculesFromInvalidParticles(std::vector& invalidParticles, double lowCorner [3], double highCorner [3], double shift [3]); diff --git a/src/parallel/DomainDecompBase.cpp b/src/parallel/DomainDecompBase.cpp index 279a76f9c4..da4e876af4 100644 --- a/src/parallel/DomainDecompBase.cpp +++ b/src/parallel/DomainDecompBase.cpp @@ -52,7 +52,7 @@ void DomainDecompBase::addLeavingMolecules(std::vector& invalidMolecul void DomainDecompBase::exchangeMolecules(ParticleContainer* moleculeContainer, Domain* domain) { if (moleculeContainer->isInvalidParticleReturner()) { // autopas mode! - global_log->debug() << "DDBase: Adding + shifting invalid particles." << std::endl; + Log::global_log->debug() << "DDBase: Adding + shifting invalid particles." << std::endl; // in case the molecule container returns invalid particles using getInvalidParticlesRef(), we have to handle them directly. addLeavingMolecules(moleculeContainer->getInvalidParticlesRef(), moleculeContainer); // now use direct scheme to transfer the rest! @@ -66,7 +66,7 @@ void DomainDecompBase::exchangeMolecules(ParticleContainer* moleculeContainer, D HaloRegion ownRegion = {rmin[0], rmin[1], rmin[2], rmax[0], rmax[1], rmax[2], 0, 0, 0, 0.}; bool coversWholeDomain[3]; double cellLengthDummy[3]{}; - global_log->debug() << "DDBase: Populating halo." << std::endl; + Log::global_log->debug() << "DDBase: Populating halo." << std::endl; auto haloExportRegions = fs.getHaloExportForceImportRegions(ownRegion, moleculeContainer->getCutoff(), coversWholeDomain, cellLengthDummy); @@ -232,7 +232,7 @@ void DomainDecompBase::handleDomainLeavingParticlesDirect(const HaloRegion& halo auto shiftAndAdd = [&moleculeContainer, haloRegion, shift](Molecule& m) { if (not m.inBox(haloRegion.rmin, haloRegion.rmax)) { - global_log->error() << "trying to remove a particle that is not in the halo region" << std::endl; + Log::global_log->error() << "trying to remove a particle that is not in the halo region" << std::endl; Simulation::exit(456); } for (int dim = 0; dim < 3; dim++) { @@ -431,7 +431,7 @@ void DomainDecompBase::assertDisjunctivity(ParticleContainer* /* moleculeContain } void DomainDecompBase::printDecomp(const std::string &filename, Domain *domain, ParticleContainer *particleContainer) { - global_log->warning() << "printDecomp useless in serial mode" << std::endl; + Log::global_log->warning() << "printDecomp useless in serial mode" << std::endl; } int DomainDecompBase::getRank() const { @@ -471,7 +471,7 @@ void DomainDecompBase::writeMoleculesToMPIFileBinary(const std::string& filename } uint64_t buffer_size = 32768; std::string __dummy(buffer_size, '\0'); // __dummy for preallocation of internal buffer with buffer_size. - std::ostringstream write_buffer(__dummy, ios_base::binary); + std::ostringstream write_buffer(__dummy, std::ios_base::binary); __dummy.clear(); __dummy.shrink_to_fit(); //char* write_buffer = new char[buffer_size]; diff --git a/src/parallel/DomainDecompBase.h b/src/parallel/DomainDecompBase.h index c1e0e50431..b5fc83d871 100644 --- a/src/parallel/DomainDecompBase.h +++ b/src/parallel/DomainDecompBase.h @@ -16,6 +16,8 @@ #include "molecules/MoleculeForwardDeclaration.h" #include "utils/Logger.h" // is this used? + + class Component; class Domain; class ParticleContainer; @@ -194,8 +196,7 @@ class DomainDecompBase: public MemoryProfilable { void updateSendLeavingWithCopies(bool sendTogether){ - using Log::global_log; - // Count all processes that need to send separately + // Count all processes that need to send separately collCommInit(1); collCommAppendInt(!sendTogether); collCommAllreduceSum(); @@ -203,7 +204,7 @@ class DomainDecompBase: public MemoryProfilable { collCommFinalize(); - global_log->info() << "Sending leaving particles and halo copies " + Log::global_log->info() << "Sending leaving particles and halo copies " << (sendLeavingWithCopies() ? "together" : "separately") << std::endl; } diff --git a/src/parallel/DomainDecompMPIBase.cpp b/src/parallel/DomainDecompMPIBase.cpp index ac939d2e74..173856045d 100644 --- a/src/parallel/DomainDecompMPIBase.cpp +++ b/src/parallel/DomainDecompMPIBase.cpp @@ -23,8 +23,6 @@ #include "parallel/CollectiveCommunication.h" #include "parallel/CollectiveCommunicationNonBlocking.h" -using Log::global_log; -using std::endl; DomainDecompMPIBase::DomainDecompMPIBase() : DomainDecompMPIBase(MPI_COMM_WORLD) {} @@ -59,7 +57,7 @@ DomainDecompMPIBase::~DomainDecompMPIBase() { void DomainDecompMPIBase::readXML(XMLfileUnits& xmlconfig) { // store current path - string oldPath(xmlconfig.getcurrentnodepath()); + std::string oldPath(xmlconfig.getcurrentnodepath()); #ifndef MARDYN_AUTOPAS std::string neighbourCommunicationScheme = "indirect"; @@ -68,7 +66,7 @@ void DomainDecompMPIBase::readXML(XMLfileUnits& xmlconfig) { std::string neighbourCommunicationScheme = "direct-pp"; #endif if(_forceDirectPP){ - global_log->info() + Log::global_log->info() << "Forcing direct-pp communication scheme, as _forceDirectPP is set (probably by a child class)." << std::endl; neighbourCommunicationScheme = "direct-pp"; @@ -76,7 +74,7 @@ void DomainDecompMPIBase::readXML(XMLfileUnits& xmlconfig) { std::string zonalMethod = "fs"; std::string traversal = "c08"; // currently useless, as traversal is set elsewhere - + xmlconfig.changecurrentnode("../datastructure"); xmlconfig.getNodeValue("traversalSelector", traversal); transform(traversal.begin(), @@ -84,20 +82,20 @@ void DomainDecompMPIBase::readXML(XMLfileUnits& xmlconfig) { traversal.begin(), ::tolower); // currently only checks, if traversal is valid - should check, if zonal method/traversal is valid - if(traversal.find("hs") != string::npos || traversal.find("mp") != string::npos || traversal.find("nt") != string::npos ) { + if(traversal.find("hs") != std::string::npos || traversal.find("mp") != std::string::npos || traversal.find("nt") != std::string::npos ) { zonalMethod = traversal; - } else if(traversal.find("es") != string::npos){ + } else if(traversal.find("es") != std::string::npos){ zonalMethod = "es"; } else{ - global_log->info() << "Defaulting to fs/c08" << std::endl; + Log::global_log->info() << "Defaulting to fs/c08" << std::endl; zonalMethod = "fs"; traversal = "c08"; } - - global_log->info() << "variable zonalMethod is: " << zonalMethod << std::endl; + + Log::global_log->info() << "variable zonalMethod is: " << zonalMethod << std::endl; // reset path xmlconfig.changecurrentnode(oldPath); @@ -105,9 +103,9 @@ void DomainDecompMPIBase::readXML(XMLfileUnits& xmlconfig) { bool useSequentialFallback = true; xmlconfig.getNodeValue("useSequentialFallback", useSequentialFallback); if (zonalMethod == "nt") { - global_log->info() << "Forcefully disabling sequential fallback, because Neutral Territory is used!" << std::endl; + Log::global_log->info() << "Forcefully disabling sequential fallback, because Neutral Territory is used!" << std::endl; useSequentialFallback = false; - global_log->info() << "Enforcing direct-pp neighborcommunicationscheme, because NT is used!" << std::endl; + Log::global_log->info() << "Enforcing direct-pp neighborcommunicationscheme, because NT is used!" << std::endl; neighbourCommunicationScheme = "direct-pp"; } setCommunicationScheme(neighbourCommunicationScheme, zonalMethod); @@ -116,17 +114,17 @@ void DomainDecompMPIBase::readXML(XMLfileUnits& xmlconfig) { bool overlappingCollectives = false; xmlconfig.getNodeValue("overlappingCollectives", overlappingCollectives); if(overlappingCollectives) { - global_log->info() << "DomainDecompMPIBase: Using Overlapping Collectives" << endl; + Log::global_log->info() << "DomainDecompMPIBase: Using Overlapping Collectives" << std::endl; #if MPI_VERSION >= 3 _collCommunication = std::unique_ptr(new CollectiveCommunicationNonBlocking()); #else - global_log->warning() << "DomainDecompMPIBase: Can not use overlapping collectives, as the MPI version is less than MPI 3." << endl; + Log::global_log->warning() << "DomainDecompMPIBase: Can not use overlapping collectives, as the MPI version is less than MPI 3." << std::endl; #endif xmlconfig.getNodeValue("overlappingStartAtStep", _overlappingStartAtStep); - global_log->info() << "DomainDecompMPIBase: Overlapping Collectives start at step " << _overlappingStartAtStep - << endl; + Log::global_log->info() << "DomainDecompMPIBase: Overlapping Collectives start at step " << _overlappingStartAtStep + << std::endl; } else { - global_log->info() << "DomainDecompMPIBase: NOT Using Overlapping Collectives" << endl; + Log::global_log->info() << "DomainDecompMPIBase: NOT Using Overlapping Collectives" << std::endl; } } @@ -150,23 +148,23 @@ void DomainDecompMPIBase::setCommunicationScheme(const std::string& scheme, cons } else if(zonalMethod=="nt") { zonalMethodP = new NeutralTerritory(); } else { - global_log->error() << "DomainDecompMPIBase: invalid zonal method specified. Valid values are 'fs', 'es', 'hs', 'mp' and 'nt'" + Log::global_log->error() << "DomainDecompMPIBase: invalid zonal method specified. Valid values are 'fs', 'es', 'hs', 'mp' and 'nt'" << std::endl; Simulation::exit(1); } - global_log->info() << "Using zonal method: " << zonalMethod << std::endl; + Log::global_log->info() << "Using zonal method: " << zonalMethod << std::endl; if (scheme=="direct") { - global_log->info() << "DomainDecompMPIBase: Using DirectCommunicationScheme without push-pull neighbors" << std::endl; + Log::global_log->info() << "DomainDecompMPIBase: Using DirectCommunicationScheme without push-pull neighbors" << std::endl; _neighbourCommunicationScheme = std::make_unique(zonalMethodP, false); } else if(scheme=="direct-pp") { - global_log->info() << "DomainDecompMPIBase: Using DirectCommunicationScheme with push-pull neighbors" << std::endl; + Log::global_log->info() << "DomainDecompMPIBase: Using DirectCommunicationScheme with push-pull neighbors" << std::endl; _neighbourCommunicationScheme = std::make_unique(zonalMethodP, true); } else if(scheme=="indirect") { - global_log->info() << "DomainDecompMPIBase: Using IndirectCommunicationScheme" << std::endl; + Log::global_log->info() << "DomainDecompMPIBase: Using IndirectCommunicationScheme" << std::endl; _neighbourCommunicationScheme = std::make_unique(zonalMethodP); } else { - global_log->error() << "DomainDecompMPIBase: invalid NeighbourCommunicationScheme specified. Valid values are 'direct' and 'indirect'" + Log::global_log->error() << "DomainDecompMPIBase: invalid NeighbourCommunicationScheme specified. Valid values are 'direct' and 'indirect'" << std::endl; Simulation::exit(1); } @@ -197,11 +195,11 @@ void DomainDecompMPIBase::assertIntIdentity(int IX) { for (int i = 1; i < _numProcs; i++) { MPI_CHECK(MPI_Recv(&recv, 1, MPI_INT, i, 2 * i + 17, _comm, &s)); if (recv != IX) { - global_log->error() << "IX is " << IX << " for rank 0, but " << recv << " for rank " << i << ".\n"; + Log::global_log->error() << "IX is " << IX << " for rank 0, but " << recv << " for rank " << i << ".\n"; MPI_Abort(_comm, 911); } } - global_log->info() << "IX = " << recv << " for all " << _numProcs << " ranks.\n"; + Log::global_log->info() << "IX = " << recv << " for all " << _numProcs << " ranks.\n"; } } @@ -218,14 +216,14 @@ void DomainDecompMPIBase::assertDisjunctivity(ParticleContainer* moleculeContain tids.push_back(m->getID()); } MPI_CHECK(MPI_Send(tids.data(), num_molecules, MPI_UNSIGNED_LONG, 0, 2674 + _rank, _comm)); - global_log->info() << "Data consistency checked: for results see rank 0." << endl; + Log::global_log->info() << "Data consistency checked: for results see rank 0." << std::endl; } else { /** @todo FIXME: This implementation does not scale. */ - map check; + std::map check; for (auto m = moleculeContainer->iterator(ParticleIterator::ONLY_INNER_AND_BOUNDARY); m.isValid(); ++m) { if(check.find(m->getID()) != check.end()){ - global_log->error() << "Rank 0 contains a duplicated particle with id " << m->getID() << std::endl; + Log::global_log->error() << "Rank 0 contains a duplicated particle with id " << m->getID() << std::endl; MPI_Abort(_comm, 1); } check[m->getID()] = 0; @@ -241,20 +239,20 @@ void DomainDecompMPIBase::assertDisjunctivity(ParticleContainer* moleculeContain MPI_CHECK(MPI_Recv(recv.data(), num_recv, MPI_UNSIGNED_LONG, i, 2674 + i, _comm, &status)); for (int j = 0; j < num_recv; j++) { if (check.find(recv[j]) != check.end()) { - global_log->error() << "Ranks " << check[recv[j]] << " and " << i << " both propagate ID " - << recv[j] << endl; + Log::global_log->error() << "Ranks " << check[recv[j]] << " and " << i << " both propagate ID " + << recv[j] << std::endl; isOk = false; } else check[recv[j]] = i; } } if (not isOk) { - global_log->error() << "Aborting because of duplicated partices." << endl; + Log::global_log->error() << "Aborting because of duplicated partices." << std::endl; MPI_Abort(_comm, 1); } - global_log->info() << "Data consistency checked: No duplicate IDs detected among " << check.size() - << " entries." << endl; + Log::global_log->info() << "Data consistency checked: No duplicate IDs detected among " << check.size() + << " entries." << std::endl; } } @@ -280,45 +278,45 @@ void DomainDecompMPIBase::finishNonBlockingStageImpl(ParticleContainer* molecule void DomainDecompMPIBase::exchangeMoleculesMPI(ParticleContainer* moleculeContainer, Domain* domain, MessageType msgType, bool doHaloPositionCheck, bool removeRecvDuplicates) { - global_log->set_mpi_output_all(); + Log::global_log->set_mpi_output_all(); _neighbourCommunicationScheme->exchangeMoleculesMPI(moleculeContainer, domain, msgType, removeRecvDuplicates, this, doHaloPositionCheck); - global_log->set_mpi_output_root(0); + Log::global_log->set_mpi_output_root(0); } -void DomainDecompMPIBase::exchangeForces(ParticleContainer* moleculeContainer, Domain* domain) { - global_log->set_mpi_output_all(); +void DomainDecompMPIBase::exchangeForces(ParticleContainer* moleculeContainer, Domain* domain) { + Log::global_log->set_mpi_output_all(); // Using molecule exchange method with the force message type _neighbourCommunicationScheme->exchangeMoleculesMPI(moleculeContainer, domain, FORCES, false, this); - global_log->set_mpi_output_root(0); + Log::global_log->set_mpi_output_root(0); } -size_t DomainDecompMPIBase::getTotalSize() { +size_t DomainDecompMPIBase::getTotalSize() { return DomainDecompBase::getTotalSize() + _neighbourCommunicationScheme->getDynamicSize() + _collCommunication->getTotalSize(); } void DomainDecompMPIBase::printDecomp(const std::string &filename, Domain *domain, ParticleContainer *particleContainer) { if (_rank == 0) { - ofstream povcfgstrm(filename); + std::ofstream povcfgstrm(filename); povcfgstrm << "size " << domain->getGlobalLength(0) << " " << domain->getGlobalLength(1) << " " - << domain->getGlobalLength(2) << endl; - povcfgstrm << "rank boxMin_x boxMin_y boxMin_z boxMax_x boxMax_y boxMax_z Configuration" << endl; + << domain->getGlobalLength(2) << std::endl; + povcfgstrm << "rank boxMin_x boxMin_y boxMin_z boxMax_x boxMax_y boxMax_z Configuration" << std::endl; povcfgstrm.close(); } - stringstream localCellInfo; + std::stringstream localCellInfo; localCellInfo << _rank << " " << getBoundingBoxMin(0, domain) << " " << getBoundingBoxMin(1, domain) << " " << getBoundingBoxMin(2, domain) << " " << getBoundingBoxMax(0, domain) << " " << getBoundingBoxMax(1, domain) << " " << getBoundingBoxMax(2, domain) << " " << particleContainer->getConfigurationAsString() << "\n"; - string localCellInfoStr = localCellInfo.str(); + std::string localCellInfoStr = localCellInfo.str(); #ifdef ENABLE_MPI MPI_File fh; @@ -338,7 +336,7 @@ void DomainDecompMPIBase::printDecomp(const std::string &filename, Domain *domai MPI_File_write_at(fh, static_cast(offset), localCellInfoStr.c_str(), static_cast(localCellInfoStr.size()), MPI_CHAR, MPI_STATUS_IGNORE); MPI_File_close(&fh); #else - ofstream povcfgstrm(filename.c_str(), ios::app); + std::ofstream povcfgstrm(filename.c_str(), std::ios::app); povcfgstrm << localCellInfoStr; povcfgstrm.close(); #endif @@ -349,9 +347,9 @@ void DomainDecompMPIBase::printSubInfo(int offset) { for (int i = 0; i < offset; i++) { offsetstream << "\t"; } - global_log->info() << offsetstream.str() << "own datastructures:\t" << sizeof(DomainDecompMPIBase) / 1.e6 << " MB" << std::endl; - global_log->info() << offsetstream.str() << "neighbourCommunicationScheme:\t\t" << _neighbourCommunicationScheme->getDynamicSize() / 1.e6 << " MB" << std::endl; - global_log->info() << offsetstream.str() << "collective Communication:\t\t" << _collCommunication->getTotalSize() / 1.e6 << " MB" << std::endl; + Log::global_log->info() << offsetstream.str() << "own datastructures:\t" << sizeof(DomainDecompMPIBase) / 1.e6 << " MB" << std::endl; + Log::global_log->info() << offsetstream.str() << "neighbourCommunicationScheme:\t\t" << _neighbourCommunicationScheme->getDynamicSize() / 1.e6 << " MB" << std::endl; + Log::global_log->info() << offsetstream.str() << "collective Communication:\t\t" << _collCommunication->getTotalSize() / 1.e6 << " MB" << std::endl; } diff --git a/src/parallel/DomainDecomposition.cpp b/src/parallel/DomainDecomposition.cpp index 2b4482cd05..2dc05349b2 100644 --- a/src/parallel/DomainDecomposition.cpp +++ b/src/parallel/DomainDecomposition.cpp @@ -9,8 +9,6 @@ #include "parallel/HaloRegion.h" #include "ParticleData.h" -using Log::global_log; -using namespace std; DomainDecomposition::DomainDecomposition() : DomainDecomposition(MPI_COMM_WORLD, {0,0,0}) {} @@ -25,11 +23,11 @@ void DomainDecomposition::initMPIGridDims() { { auto numProcsGridSize = _gridSize[0] * _gridSize[1] * _gridSize[2]; if (numProcsGridSize != _numProcs and numProcsGridSize != 0) { - global_log->error() << "DomainDecomposition: Wrong grid size given!" << std::endl; - global_log->error() << "\tnumProcs is " << _numProcs << "," << std::endl; - global_log->error() << "\tbut grid is " << _gridSize[0] << " x " << _gridSize[1] << " x " << _gridSize[2] << std::endl; - global_log->error() << "\tresulting in " << numProcsGridSize << " subdomains!" << std::endl; - global_log->error() << "\tplease check your input file!" << std::endl; + Log::global_log->error() << "DomainDecomposition: Wrong grid size given!" << std::endl; + Log::global_log->error() << "\tnumProcs is " << _numProcs << "," << std::endl; + Log::global_log->error() << "\tbut grid is " << _gridSize[0] << " x " << _gridSize[1] << " x " << _gridSize[2] << std::endl; + Log::global_log->error() << "\tresulting in " << numProcsGridSize << " subdomains!" << std::endl; + Log::global_log->error() << "\tplease check your input file!" << std::endl; Simulation::exit(2134); } } @@ -37,10 +35,10 @@ void DomainDecomposition::initMPIGridDims() { MPI_CHECK(MPI_Dims_create( _numProcs, DIMgeom, _gridSize.data())); MPI_CHECK(MPI_Cart_create(_comm, DIMgeom, _gridSize.data(), period, reorder, &_comm)); - global_log->info() << "MPI grid dimensions: " << _gridSize[0] << ", " << _gridSize[1] << ", " << _gridSize[2] << endl; + Log::global_log->info() << "MPI grid dimensions: " << _gridSize[0] << ", " << _gridSize[1] << ", " << _gridSize[2] << std::endl; MPI_CHECK(MPI_Comm_rank(_comm, &_rank)); MPI_CHECK(MPI_Cart_coords(_comm, _rank, DIMgeom, _coords)); - global_log->info() << "MPI coordinate of current process: " << _coords[0] << ", " << _coords[1] << ", " << _coords[2] << endl; + Log::global_log->info() << "MPI coordinate of current process: " << _coords[0] << ", " << _coords[1] << ", " << _coords[2] << std::endl; } DomainDecomposition::~DomainDecomposition() { @@ -61,7 +59,7 @@ void DomainDecomposition::prepareNonBlockingStage(bool /*forceRebalancing*/, Par LEAVING_AND_HALO_COPIES); } else { // Would first need to send leaving, then halo -> not good for overlapping! - global_log->error() << "nonblocking P2P using separate messages for leaving and halo is currently not " + Log::global_log->error() << "nonblocking P2P using separate messages for leaving and halo is currently not " "supported. Please use the indirect neighbor communication scheme!" << std::endl; Simulation::exit(235861); @@ -75,7 +73,7 @@ void DomainDecomposition::finishNonBlockingStage(bool /*forceRebalancing*/, Part LEAVING_AND_HALO_COPIES); } else { // Would first need to send leaving, then halo -> not good for overlapping! - global_log->error() + Log::global_log->error() << "nonblocking P2P using separate messages for leaving and halo is currently not supported." << std::endl; Simulation::exit(235861); } @@ -89,15 +87,15 @@ bool DomainDecomposition::queryBalanceAndExchangeNonBlocking(bool /*forceRebalan void DomainDecomposition::balanceAndExchange(double /*lastTraversalTime*/, bool /*forceRebalancing*/, ParticleContainer* moleculeContainer, Domain* domain) { if (sendLeavingWithCopies()) { - global_log->debug() << "DD: Sending Leaving and Halos." << std::endl; + Log::global_log->debug() << "DD: Sending Leaving and Halos." << std::endl; DomainDecompMPIBase::exchangeMoleculesMPI(moleculeContainer, domain, LEAVING_AND_HALO_COPIES); } else { - global_log->debug() << "DD: Sending Leaving." << std::endl; + Log::global_log->debug() << "DD: Sending Leaving." << std::endl; DomainDecompMPIBase::exchangeMoleculesMPI(moleculeContainer, domain, LEAVING_ONLY); #ifndef MARDYN_AUTOPAS moleculeContainer->deleteOuterParticles(); #endif - global_log->debug() << "DD: Sending Halos." << std::endl; + Log::global_log->debug() << "DD: Sending Halos." << std::endl; DomainDecompMPIBase::exchangeMoleculesMPI(moleculeContainer, domain, HALO_COPIES); } } diff --git a/src/parallel/DomainDecomposition.h b/src/parallel/DomainDecomposition.h index a7515393a3..6554c20906 100644 --- a/src/parallel/DomainDecomposition.h +++ b/src/parallel/DomainDecomposition.h @@ -51,7 +51,7 @@ class DomainDecomposition : public DomainDecompMPIBase { //returns a vector of the neighbour ranks in x y and z direction (only neighbours connected by an area to local area) std::vector getNeighbourRanks() override; - + //returns a vector of all 26 neighbour ranks in x y and z direction std::vector getNeighbourRanksFullShell() override; diff --git a/src/parallel/ForceHelper.cpp b/src/parallel/ForceHelper.cpp index 861a5ac85b..00c8aaec41 100644 --- a/src/parallel/ForceHelper.cpp +++ b/src/parallel/ForceHelper.cpp @@ -47,4 +47,4 @@ std::variant> addValuesAndGet }, originalIter); return originalIter; -} \ No newline at end of file +} diff --git a/src/parallel/GeneralDomainDecomposition.cpp b/src/parallel/GeneralDomainDecomposition.cpp index 8e7a655155..63e45876fc 100644 --- a/src/parallel/GeneralDomainDecomposition.cpp +++ b/src/parallel/GeneralDomainDecomposition.cpp @@ -13,6 +13,11 @@ #include "NeighbourCommunicationScheme.h" #include +#include +#include +#include +#include +#include GeneralDomainDecomposition::GeneralDomainDecomposition(double interactionLength, Domain* domain, bool forceGrid) : _boxMin{0.}, @@ -22,11 +27,11 @@ GeneralDomainDecomposition::GeneralDomainDecomposition(double interactionLength, _forceLatchingToLinkedCellsGrid{forceGrid} {} void GeneralDomainDecomposition::initializeALL() { - global_log->info() << "initializing ALL load balancer..." << std::endl; + Log::global_log->info() << "initializing ALL load balancer..." << std::endl; auto gridSize = getOptimalGrid(_domainLength, this->getNumProcs()); auto gridCoords = getCoordsFromRank(gridSize, _rank); - global_log->info() << "gridSize:" << gridSize[0] << ", " << gridSize[1] << ", " << gridSize[2] << std::endl; - global_log->info() << "gridCoords:" << gridCoords[0] << ", " << gridCoords[1] << ", " << gridCoords[2] << std::endl; + Log::global_log->info() << "gridSize:" << gridSize[0] << ", " << gridSize[1] << ", " << gridSize[2] << std::endl; + Log::global_log->info() << "gridCoords:" << gridCoords[0] << ", " << gridCoords[1] << ", " << gridCoords[2] << std::endl; std::tie(_boxMin, _boxMax) = initializeRegularGrid(_domainLength, gridSize, gridCoords); if (_forceLatchingToLinkedCellsGrid and not _gridSize.has_value()) { std::array forcedGridSize{}; @@ -50,10 +55,10 @@ void GeneralDomainDecomposition::initializeALL() { _loadBalancer = std::make_unique(_boxMin, _boxMax, 4 /*gamma*/, this->getCommunicator(), gridSize, gridCoords, minimalDomainSize); #else - global_log->error() << "ALL load balancing library not enabled. Aborting." << std::endl; + Log::global_log->error() << "ALL load balancing library not enabled. Aborting." << std::endl; Simulation::exit(24235); #endif - global_log->info() << "GeneralDomainDecomposition initial box: [" << _boxMin[0] << ", " << _boxMax[0] << "] x [" + Log::global_log->info() << "GeneralDomainDecomposition initial box: [" << _boxMin[0] << ", " << _boxMax[0] << "] x [" << _boxMin[1] << ", " << _boxMax[1] << "] x [" << _boxMin[2] << ", " << _boxMax[2] << "]" << std::endl; } @@ -88,17 +93,17 @@ void GeneralDomainDecomposition::balanceAndExchange(double lastTraversalTime, bo moleculeContainer->deleteOuterParticles(); // rebalance - global_log->info() << "rebalancing..." << std::endl; + Log::global_log->info() << "rebalancing..." << std::endl; - global_log->set_mpi_output_all(); - global_log->debug() << "work:" << lastTraversalTime << std::endl; - global_log->set_mpi_output_root(0); + Log::global_log->set_mpi_output_all(); + Log::global_log->debug() << "work:" << lastTraversalTime << std::endl; + Log::global_log->set_mpi_output_root(0); auto [newBoxMin, newBoxMax] = _loadBalancer->rebalance(lastTraversalTime); if (_gridSize.has_value()) { std::tie(newBoxMin, newBoxMax) = latchToGridSize(newBoxMin, newBoxMax); } // migrate the particles, this will rebuild the moleculeContainer! - global_log->info() << "migrating particles" << std::endl; + Log::global_log->info() << "migrating particles" << std::endl; migrateParticles(domain, moleculeContainer, newBoxMin, newBoxMax); #ifndef MARDYN_AUTOPAS @@ -111,9 +116,9 @@ void GeneralDomainDecomposition::balanceAndExchange(double lastTraversalTime, bo _boxMax = newBoxMax; // init communication partners - global_log->info() << "updating communication partners" << std::endl; + Log::global_log->info() << "updating communication partners" << std::endl; initCommPartners(moleculeContainer, domain); - global_log->info() << "rebalancing finished" << std::endl; + Log::global_log->info() << "rebalancing finished" << std::endl; DomainDecompMPIBase::exchangeMoleculesMPI(moleculeContainer, domain, HALO_COPIES); } else { if (sendLeavingWithCopies()) { @@ -129,7 +134,7 @@ void GeneralDomainDecomposition::balanceAndExchange(double lastTraversalTime, bo } void GeneralDomainDecomposition::migrateParticles(Domain* domain, ParticleContainer* particleContainer, - array newMin, array newMax) { + std::array newMin, std::array newMax) { std::array oldBoxMin{particleContainer->getBoundingBoxMin(0), particleContainer->getBoundingBoxMin(1), particleContainer->getBoundingBoxMin(2)}; std::array oldBoxMax{particleContainer->getBoundingBoxMax(0), particleContainer->getBoundingBoxMax(1), @@ -144,16 +149,16 @@ void GeneralDomainDecomposition::migrateParticles(Domain* domain, ParticleContai ownDomain.offset[i] = 0; newDomain.offset[i] = 0; } - global_log->set_mpi_output_all(); - global_log->debug() << "migrating from" + Log::global_log->set_mpi_output_all(); + Log::global_log->debug() << "migrating from" << " [" << oldBoxMin[0] << ", " << oldBoxMax[0] << "] x" << " [" << oldBoxMin[1] << ", " << oldBoxMax[1] << "] x" << " [" << oldBoxMin[2] << ", " << oldBoxMax[2] << "] " << std::endl; - global_log->debug() << "to" + Log::global_log->debug() << "to" << " [" << newMin[0] << ", " << newMax[0] << "] x" << " [" << newMin[1] << ", " << newMax[1] << "] x" << " [" << newMin[2] << ", " << newMax[2] << "]." << std::endl; - global_log->set_mpi_output_root(0); + Log::global_log->set_mpi_output_root(0); std::vector desiredDomain{newDomain}; std::vector sendNeighbors{}, recvNeighbors{}; @@ -176,7 +181,7 @@ void GeneralDomainDecomposition::migrateParticles(Domain* domain, ParticleContai ownMolecules.push_back(*iter); // TODO: This check should be in debug mode only if (not iter->inBox(newMin.data(), newMax.data())) { - global_log->error_always_output() + Log::global_log->error_always_output() << "Particle still in domain that should have been migrated." << "BoxMin: " << particleContainer->getBoundingBoxMin(0) << ", " @@ -215,7 +220,7 @@ void GeneralDomainDecomposition::migrateParticles(Domain* domain, ParticleContai // catch deadlocks double waitingTime = MPI_Wtime() - startTime; if (waitingTime > waitCounter) { - global_log->warning() << "KDDecomposition::migrateParticles: Deadlock warning: Rank " << _rank + Log::global_log->warning() << "KDDecomposition::migrateParticles: Deadlock warning: Rank " << _rank << " is waiting for more than " << waitCounter << " seconds" << std::endl; waitCounter += 1.0; for (auto& sender : sendNeighbors) { @@ -227,7 +232,7 @@ void GeneralDomainDecomposition::migrateParticles(Domain* domain, ParticleContai } if (waitingTime > deadlockTimeOut) { - global_log->error() << "KDDecomposition::migrateParticles: Deadlock error: Rank " << _rank + Log::global_log->error() << "KDDecomposition::migrateParticles: Deadlock error: Rank " << _rank << " is waiting for more than " << deadlockTimeOut << " seconds" << std::endl; for (auto& sender : sendNeighbors) { sender.deadlockDiagnosticSend(); @@ -258,30 +263,30 @@ void GeneralDomainDecomposition::readXML(XMLfileUnits& xmlconfig) { DomainDecompMPIBase::readXML(xmlconfig); #ifdef MARDYN_AUTOPAS - global_log->info() << "AutoPas only supports FS, so setting it." << std::endl; + Log::global_log->info() << "AutoPas only supports FS, so setting it." << std::endl; setCommunicationScheme("direct-pp", "fs"); #endif xmlconfig.getNodeValue("updateFrequency", _rebuildFrequency); - global_log->info() << "GeneralDomainDecomposition update frequency: " << _rebuildFrequency << endl; + Log::global_log->info() << "GeneralDomainDecomposition update frequency: " << _rebuildFrequency << std::endl; xmlconfig.getNodeValue("initialPhaseTime", _initPhase); - global_log->info() << "GeneralDomainDecomposition time for initial rebalancing phase: " << _initPhase << endl; + Log::global_log->info() << "GeneralDomainDecomposition time for initial rebalancing phase: " << _initPhase << std::endl; xmlconfig.getNodeValue("initialPhaseFrequency", _initFrequency); - global_log->info() << "GeneralDomainDecomposition frequency for initial rebalancing phase: " << _initFrequency - << endl; + Log::global_log->info() << "GeneralDomainDecomposition frequency for initial rebalancing phase: " << _initFrequency + << std::endl; std::string gridSizeString; if (xmlconfig.getNodeValue("gridSize", gridSizeString)) { - global_log->info() << "GeneralDomainDecomposition grid size: " << gridSizeString << endl; + Log::global_log->info() << "GeneralDomainDecomposition grid size: " << gridSizeString << std::endl; if (gridSizeString.find(',') != std::string::npos) { auto strings = string_utils::split(gridSizeString, ','); if (strings.size() != 3) { - global_log->error() + Log::global_log->error() << "GeneralDomainDecomposition's gridSize should have three entries if a list is given, but has " - << strings.size() << "!" << endl; + << strings.size() << "!" << std::endl; Simulation::exit(8134); } _gridSize = {std::stod(strings[0]), std::stod(strings[1]), std::stod(strings[2])}; @@ -291,9 +296,9 @@ void GeneralDomainDecomposition::readXML(XMLfileUnits& xmlconfig) { } for (auto gridSize : *_gridSize) { if (gridSize < _interactionLength) { - global_log->error() << "GeneralDomainDecomposition's gridSize (" << gridSize + Log::global_log->error() << "GeneralDomainDecomposition's gridSize (" << gridSize << ") is smaller than the interactionLength (" << _interactionLength - << "). This is forbidden, as it leads to errors! " << endl; + << "). This is forbidden, as it leads to errors! " << std::endl; Simulation::exit(8136); } } @@ -302,20 +307,20 @@ void GeneralDomainDecomposition::readXML(XMLfileUnits& xmlconfig) { if (xmlconfig.changecurrentnode("loadBalancer")) { std::string loadBalancerString = "None"; xmlconfig.getNodeValue("@type", loadBalancerString); - global_log->info() << "Chosen Load Balancer: " << loadBalancerString << std::endl; + Log::global_log->info() << "Chosen Load Balancer: " << loadBalancerString << std::endl; std::transform(loadBalancerString.begin(), loadBalancerString.end(), loadBalancerString.begin(), ::tolower); if (loadBalancerString.find("all") != std::string::npos) { initializeALL(); } else { - global_log->error() << "GeneralDomainDecomposition: Unknown load balancer " << loadBalancerString + Log::global_log->error() << "GeneralDomainDecomposition: Unknown load balancer " << loadBalancerString << ". Aborting! Please select a valid option! Valid options: ALL"; Simulation::exit(1); } _loadBalancer->readXML(xmlconfig); } else { - global_log->error() << "loadBalancer section missing! Aborting!" << std::endl; + Log::global_log->error() << "loadBalancer section missing! Aborting!" << std::endl; Simulation::exit(8466); } xmlconfig.changecurrentnode(".."); diff --git a/src/parallel/KDDStaticValues.cpp b/src/parallel/KDDStaticValues.cpp index b2437a2aa3..e7c8c11ccd 100644 --- a/src/parallel/KDDStaticValues.cpp +++ b/src/parallel/KDDStaticValues.cpp @@ -1,4 +1,4 @@ #include "KDDStaticValues.h" -unsigned int KDDStaticValues::minNumCellsPerDimension = 2u; \ No newline at end of file +unsigned int KDDStaticValues::minNumCellsPerDimension = 2u; diff --git a/src/parallel/KDDecomposition.cpp b/src/parallel/KDDecomposition.cpp index 3af1e02487..212cf76b05 100644 --- a/src/parallel/KDDecomposition.cpp +++ b/src/parallel/KDDecomposition.cpp @@ -28,8 +28,6 @@ #include "KDNode.h" #include "ParticleData.h" -using namespace std; -using Log::global_log; KDDecomposition::KDDecomposition(double cutoffRadius, int numParticleTypes, int updateFrequency, int fullSearchThreshold) @@ -66,9 +64,9 @@ void KDDecomposition::init(Domain* domain){ _decompTree = new KDNode(_numProcs, lowCorner, highCorner, 0, 0, coversWholeDomain, 0); if (!_decompTree->isResolvable()) { auto minCellCountPerProc = std::pow(KDDStaticValues::minNumCellsPerDimension, 3); - global_log->error() << "KDDecomposition not possible. Each process needs at least " << minCellCountPerProc - << " cells." << endl; - global_log->error() << "The number of Cells is only sufficient for " << _decompTree->getNumMaxProcs() << " Procs!" << endl; + Log::global_log->error() << "KDDecomposition not possible. Each process needs at least " << minCellCountPerProc + << " cells." << std::endl; + Log::global_log->error() << "The number of Cells is only sufficient for " << _decompTree->getNumMaxProcs() << " Procs!" << std::endl; Simulation::exit(-1); } _decompTree->buildKDTree(); @@ -77,10 +75,10 @@ void KDDecomposition::init(Domain* domain){ // initialize the mpi data type for particles once in the beginning KDNode::initMPIDataType(); - global_log->info() << "Created KDDecomposition with updateFrequency=" << _frequency << ", fullSearchThreshold=" << _fullSearchThreshold << endl; + Log::global_log->info() << "Created KDDecomposition with updateFrequency=" << _frequency << ", fullSearchThreshold=" << _fullSearchThreshold << std::endl; #ifdef DEBUG_DECOMP - global_log->info() << "Initial Decomposition: " << endl; + Log::global_log->info() << "Initial Decomposition: " << std::endl; if (_rank == 0) { _decompTree->printTree("", std::cout); } @@ -88,7 +86,7 @@ void KDDecomposition::init(Domain* domain){ } KDDecomposition::~KDDecomposition() { -// _decompTree->serialize(string("kddecomp.dat")); +// _decompTree->serialize(std::string("kddecomp.dat")); if (_rank == 0) { _decompTree->plotNode("kddecomp.vtu", &_processorSpeeds); } @@ -101,20 +99,20 @@ KDDecomposition::~KDDecomposition() { void KDDecomposition::readXML(XMLfileUnits& xmlconfig) { /* TODO: Maybe add decomposition dimensions, default auto. */ xmlconfig.getNodeValue("minNumCellsPerDimension", KDDStaticValues::minNumCellsPerDimension); - global_log->info() << "KDDecomposition minNumCellsPerDimension: " << KDDStaticValues::minNumCellsPerDimension - << endl; + Log::global_log->info() << "KDDecomposition minNumCellsPerDimension: " << KDDStaticValues::minNumCellsPerDimension + << std::endl; if(KDDStaticValues::minNumCellsPerDimension==0u){ - global_log->error() << "KDDecomposition minNumCellsPerDimension has to be bigger than zero!" << std::endl; + Log::global_log->error() << "KDDecomposition minNumCellsPerDimension has to be bigger than zero!" << std::endl; Simulation::exit(43); } xmlconfig.getNodeValue("updateFrequency", _frequency); - global_log->info() << "KDDecomposition update frequency: " << _frequency << endl; + Log::global_log->info() << "KDDecomposition update frequency: " << _frequency << std::endl; xmlconfig.getNodeValue("fullSearchThreshold", _fullSearchThreshold); - global_log->info() << "KDDecomposition full search threshold: " << _fullSearchThreshold << endl; + Log::global_log->info() << "KDDecomposition full search threshold: " << _fullSearchThreshold << std::endl; xmlconfig.getNodeValue("heterogeneousSystems", _heterogeneousSystems); - global_log->info() << "KDDecomposition for heterogeneous computing systems (old version, not compatible with new " + Log::global_log->info() << "KDDecomposition for heterogeneous computing systems (old version, not compatible with new " "VecTuner version)?: " - << (_heterogeneousSystems ? "yes" : "no") << endl; + << (_heterogeneousSystems ? "yes" : "no") << std::endl; { std::string deviationReductionOperation; @@ -125,45 +123,45 @@ void KDDecomposition::readXML(XMLfileUnits& xmlconfig) { } else if (deviationReductionOperation == "max") { _deviationReductionOperation = MPI_MAX; } else { - global_log->fatal() << "Wrong deviationReductionOperation given: " << _deviationReductionOperation + Log::global_log->fatal() << "Wrong deviationReductionOperation given: " << _deviationReductionOperation << ". Should be 'max' or 'sum'." << std::endl; Simulation::exit(45681); } } - global_log->info() << "KDDecomposition uses " << deviationReductionOperation - << " to reduce the deviation within the decompose step." << endl; + Log::global_log->info() << "KDDecomposition uses " << deviationReductionOperation + << " to reduce the deviation within the decompose step." << std::endl; } bool useVecTuner = false; xmlconfig.getNodeValue("useVectorizationTuner", useVecTuner); - global_log->info() << "KDDecomposition using vectorization tuner: " << (useVecTuner?"yes":"no") << endl; + Log::global_log->info() << "KDDecomposition using vectorization tuner: " << (useVecTuner?"yes":"no") << std::endl; if (useVecTuner){ delete _loadCalc; _loadCalc = new TunerLoad(); } xmlconfig.getNodeValue("clusterHetSys", _clusteredHeterogeneouseSystems); - global_log->info() << "KDDecomposition for clustered heterogeneous systems?: " << (_clusteredHeterogeneouseSystems?"yes":"no") << endl; + Log::global_log->info() << "KDDecomposition for clustered heterogeneous systems?: " << (_clusteredHeterogeneouseSystems?"yes":"no") << std::endl; //TODO remove this check if the heterogenous Decomposition is updated to the vectorization tuner. if(_heterogeneousSystems){ - global_log->warning() << "The old version of the heterogeneous KDDecomposition shouldn't be used with the vectorization tuner!" << endl; + Log::global_log->warning() << "The old version of the heterogeneous KDDecomposition shouldn't be used with the vectorization tuner!" << std::endl; } xmlconfig.getNodeValue("splitBiggestDimension", _splitBiggest); - global_log->info() << "KDDecomposition splits along biggest domain?: " << (_splitBiggest?"yes":"no") << endl; + Log::global_log->info() << "KDDecomposition splits along biggest domain?: " << (_splitBiggest?"yes":"no") << std::endl; xmlconfig.getNodeValue("forceRatio", _forceRatio); - global_log->info() << "KDDecomposition forces load/performance ratio?: " << (_forceRatio?"yes":"no") << endl; + Log::global_log->info() << "KDDecomposition forces load/performance ratio?: " << (_forceRatio?"yes":"no") << std::endl; xmlconfig.getNodeValue("rebalanceLimit", _rebalanceLimit); if(_rebalanceLimit > 0) { - global_log->info() << "KDDecomposition automatic rebalancing: enabled" << endl; - global_log->info() << "KDDecomposition rebalance limit: " << _rebalanceLimit << endl; + Log::global_log->info() << "KDDecomposition automatic rebalancing: enabled" << std::endl; + Log::global_log->info() << "KDDecomposition rebalance limit: " << _rebalanceLimit << std::endl; } else { - global_log->info() << "KDDecomposition automatic rebalancing: disabled" << endl; + Log::global_log->info() << "KDDecomposition automatic rebalancing: disabled" << std::endl; } xmlconfig.getNodeValue("splitThreshold", _splitThreshold); if(!_splitBiggest){ - global_log->info() << "KDDecomposition threshold for splitting not only the biggest Domain: " << _splitThreshold << endl; + Log::global_log->info() << "KDDecomposition threshold for splitting not only the biggest Domain: " << _splitThreshold << std::endl; } /* @@ -171,33 +169,33 @@ void KDDecomposition::readXML(XMLfileUnits& xmlconfig) { */ for(int i = 0; i < _numParticleTypes; ++i){ xmlconfig.getNodeValue("particleCount" + std::to_string(i+1), _vecTunParticleNums.at(i)); - global_log->info() << "Maximum particle count in the vectorization tuner of type " << i+1 << ": " << _vecTunParticleNums.at(i) << endl; + Log::global_log->info() << "Maximum particle count in the vectorization tuner of type " << i+1 << ": " << _vecTunParticleNums.at(i) << std::endl; } xmlconfig.getNodeValue("generateNewFiles", _generateNewFiles); - global_log->info() << "Generate new vectorization tuner files: " << (_generateNewFiles?"yes":"no") << endl; + Log::global_log->info() << "Generate new vectorization tuner files: " << (_generateNewFiles?"yes":"no") << std::endl; xmlconfig.getNodeValue("useExistingFiles", _useExistingFiles); - global_log->info() << "Use existing vectorization tuner files (if available)?: " << (_useExistingFiles?"yes":"no") << endl; + Log::global_log->info() << "Use existing vectorization tuner files (if available)?: " << (_useExistingFiles?"yes":"no") << std::endl; xmlconfig.getNodeValue("vecTunerAllowMPIReduce", _vecTunerAllowMPIReduce); - global_log->info() << "Allow an MPI Reduce for the vectorization tuner?: " << (_vecTunerAllowMPIReduce?"yes":"no") << endl; + Log::global_log->info() << "Allow an MPI Reduce for the vectorization tuner?: " << (_vecTunerAllowMPIReduce?"yes":"no") << std::endl; xmlconfig.getNodeValue("doMeasureLoadCalc", _doMeasureLoadCalc); - global_log->info() << "Use measureLoadCalc? (requires compilation with armadillo): " << (_doMeasureLoadCalc?"yes":"no") << endl; + Log::global_log->info() << "Use measureLoadCalc? (requires compilation with armadillo): " << (_doMeasureLoadCalc?"yes":"no") << std::endl; xmlconfig.getNodeValue("measureLoadInterpolationStartsAt", _measureLoadInterpolationStartsAt); - global_log->info() << "measureLoad: Interpolation is performed for cells with at least " - << _measureLoadInterpolationStartsAt << " particles." << endl; + Log::global_log->info() << "measureLoad: Interpolation is performed for cells with at least " + << _measureLoadInterpolationStartsAt << " particles." << std::endl; xmlconfig.getNodeValue("measureLoadIncreasingTimeValues", _measureLoadIncreasingTimeValues); - global_log->info() << "measureLoad: Ensure that cells with more particles take longer ? " - << (_measureLoadIncreasingTimeValues ? "yes" : "no") << endl; + Log::global_log->info() << "measureLoad: Ensure that cells with more particles take longer ? " + << (_measureLoadIncreasingTimeValues ? "yes" : "no") << std::endl; DomainDecompMPIBase::readXML(xmlconfig); - string oldPath(xmlconfig.getcurrentnodepath()); + std::string oldPath(xmlconfig.getcurrentnodepath()); xmlconfig.changecurrentnode("../datastructure"); xmlconfig.getNodeValue("cellsInCutoffRadius", _cellsInCutoffRadius); - global_log->info() << "KDDecomposition using cellsInCutoffRadius: " << _cellsInCutoffRadius << endl; + Log::global_log->info() << "KDDecomposition using cellsInCutoffRadius: " << _cellsInCutoffRadius << std::endl; // reset path xmlconfig.changecurrentnode(oldPath); @@ -248,7 +246,7 @@ bool KDDecomposition::checkNeedRebalance(double lastTraversalTime) const { MPI_CHECK(MPI_Allreduce(localTraversalTimes, globalTraversalTimes, 2, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD)); globalTraversalTimes[0] *= -1.0; double timerCoeff = globalTraversalTimes[1] / globalTraversalTimes[0]; - global_log->info() << "KDDecomposition timerCoeff: " << timerCoeff << endl; + Log::global_log->info() << "KDDecomposition timerCoeff: " << timerCoeff << std::endl; if (timerCoeff > _rebalanceLimit) { needsRebalance = true; } @@ -267,7 +265,7 @@ void KDDecomposition::balanceAndExchange(double lastTraversalTime, bool forceReb size_t measureLoadInitTimers = 2; if (_steps == measureLoadInitTimers and _doMeasureLoadCalc) { if(global_simulation->getEnsemble()->getComponents()->size() > 1){ - global_log->warning() << "MeasureLoad is designed to work with one component. Using it with more than one " + Log::global_log->warning() << "MeasureLoad is designed to work with one component. Using it with more than one " "component might produce bad results if their force calculation differs." << std::endl; } @@ -277,9 +275,9 @@ void KDDecomposition::balanceAndExchange(double lastTraversalTime, bool forceReb if (_steps == measureLoadStart and _doMeasureLoadCalc) { bool faulty = _measureLoadCalc->prepareLoads(this, _comm); if (faulty) { - global_log->info() << "Not using MeasureLoad as it failed. No rebalance forced." << std::endl; + Log::global_log->info() << "Not using MeasureLoad as it failed. No rebalance forced." << std::endl; } else { - global_log->info() << "Start using MeasureLoad, will force rebalance." << std::endl; + Log::global_log->info() << "Start using MeasureLoad, will force rebalance." << std::endl; delete _loadCalc; _loadCalc = _measureLoadCalc; _measureLoadCalc = nullptr; @@ -289,11 +287,11 @@ void KDDecomposition::balanceAndExchange(double lastTraversalTime, bool forceReb if (not rebalance) { if (sendLeavingWithCopies()) { - global_log->debug() << "kDD: Sending Leaving and Halos together." << std::endl; + Log::global_log->debug() << "kDD: Sending Leaving and Halos together." << std::endl; DomainDecompMPIBase::exchangeMoleculesMPI(moleculeContainer, domain, LEAVING_AND_HALO_COPIES, true /*doHaloPositionCheck*/, removeRecvDuplicates); } else { - global_log->debug() << "kDD: Sending Leaving, then Halos." << std::endl; + Log::global_log->debug() << "kDD: Sending Leaving, then Halos." << std::endl; DomainDecompMPIBase::exchangeMoleculesMPI(moleculeContainer, domain, LEAVING_ONLY, true /*doHaloPositionCheck*/, removeRecvDuplicates); #ifndef MARDYN_AUTOPAS @@ -303,7 +301,7 @@ void KDDecomposition::balanceAndExchange(double lastTraversalTime, bool forceReb true /*doHaloPositionCheck*/, removeRecvDuplicates); } } else { - global_log->info() << "KDDecomposition: rebalancing..." << endl; + Log::global_log->info() << "KDDecomposition: rebalancing..." << std::endl; if (_steps != 1) { DomainDecompMPIBase::exchangeMoleculesMPI(moleculeContainer, domain, LEAVING_ONLY, true /*doHaloPositionCheck*/, removeRecvDuplicates); @@ -317,8 +315,8 @@ void KDDecomposition::balanceAndExchange(double lastTraversalTime, bool forceReb constructNewTree(newDecompRoot, newOwnLeaf, moleculeContainer); bool migrationSuccessful = migrateParticles(*newDecompRoot, *newOwnLeaf, moleculeContainer, domain); if (not migrationSuccessful) { - global_log->error() << "A problem occurred during particle migration between old decomposition and new decomposition of the KDDecomposition." << endl; - global_log->error() << "Aborting. Please save your input files and last available checkpoint and contact TUM SCCS." << endl; + Log::global_log->error() << "A problem occurred during particle migration between old decomposition and new decomposition of the KDDecomposition." << std::endl; + Log::global_log->error() << "Aborting. Please save your input files and last available checkpoint and contact TUM SCCS." << std::endl; Simulation::exit(1); } delete _decompTree; @@ -356,21 +354,21 @@ bool KDDecomposition::migrateParticles(const KDNode& newRoot, const KDNode& newO // 4. issue Isend calls // 5. get all - vector recvPartners; + std::vector recvPartners; recvPartners.clear(); int numProcsRecv; - vector migrateToSelf; + std::vector migrateToSelf; bool willMigrateToSelf = false; // issue Recv calls { // process-leaving particles have been handled, so we only need actual area - vector ranks; - vector indices; + std::vector ranks; + std::vector indices; _decompTree->getOwningProcs(newOwnLeaf._lowCorner, newOwnLeaf._highCorner, ranks, indices); - vector numMolsToRecv; + std::vector numMolsToRecv; auto indexIt = indices.begin(); numProcsRecv = ranks.size(); // value may change from ranks.size(), see "numProcsSend--" below recvPartners.reserve(numProcsRecv); @@ -408,14 +406,14 @@ bool KDDecomposition::migrateParticles(const KDNode& newRoot, const KDNode& newO } } - vector sendPartners; + std::vector sendPartners; sendPartners.clear(); int numProcsSend; // issue Send calls { // process-leaving particles have been handled, so we only need actual area - vector ranks; - vector indices; + std::vector ranks; + std::vector indices; newRoot.getOwningProcs(_ownArea->_lowCorner, _ownArea->_highCorner, ranks, indices); auto indexIt = indices.begin(); @@ -477,7 +475,7 @@ bool KDDecomposition::migrateParticles(const KDNode& newRoot, const KDNode& newO sendTogether &= neighborschemeAllowsDirect; updateSendLeavingWithCopies(sendTogether); - global_log->set_mpi_output_all(); + Log::global_log->set_mpi_output_all(); double waitCounter = 5.0; double deadlockTimeOut = 360.0; bool allDone = false; @@ -509,7 +507,7 @@ bool KDDecomposition::migrateParticles(const KDNode& newRoot, const KDNode& newO // catch deadlocks double waitingTime = MPI_Wtime() - startTime; if (waitingTime > waitCounter) { - global_log->warning() << "KDDecomposition::migrateParticles: Deadlock warning: Rank " << _rank + Log::global_log->warning() << "KDDecomposition::migrateParticles: Deadlock warning: Rank " << _rank << " is waiting for more than " << waitCounter << " seconds" << std::endl; waitCounter += 1.0; @@ -522,7 +520,7 @@ bool KDDecomposition::migrateParticles(const KDNode& newRoot, const KDNode& newO } if (waitingTime > deadlockTimeOut) { - global_log->error() << "KDDecomposition::migrateParticles: Deadlock error: Rank " << _rank + Log::global_log->error() << "KDDecomposition::migrateParticles: Deadlock error: Rank " << _rank << " is waiting for more than " << deadlockTimeOut << " seconds" << std::endl; for (int i = 0; i < numProcsSend; ++i) { @@ -536,7 +534,7 @@ bool KDDecomposition::migrateParticles(const KDNode& newRoot, const KDNode& newO } // while not allDone - global_log->set_mpi_output_root(0); + Log::global_log->set_mpi_output_root(0); moleculeContainer->update(); @@ -547,7 +545,7 @@ bool KDDecomposition::migrateParticles(const KDNode& newRoot, const KDNode& newO if (isOK == _numProcs) { return true; } else { - global_log->error() << "writing checkpoint to kddecomperror.restart.dat" << std::endl; + Log::global_log->error() << "writing checkpoint to kddecomperror.restart.dat" << std::endl; global_simulation->getDomain()->writeCheckpoint("kddecomperror.restart.dat", moleculeContainer, this, global_simulation->getSimulationTime()); return false; } @@ -555,7 +553,7 @@ bool KDDecomposition::migrateParticles(const KDNode& newRoot, const KDNode& newO void KDDecomposition::fillTimeVecs(CellProcessor **cellProc){ if(cellProc == nullptr){ - global_log->error() << "The cellProcessor was not yet set! Please reorder fillTimeVecs, so that there won't be a problem!"; + Log::global_log->error() << "The cellProcessor was not yet set! Please reorder fillTimeVecs, so that there won't be a problem!"; Simulation::exit(1); } auto _tunerLoadCalc = dynamic_cast(_loadCalc); @@ -582,7 +580,7 @@ void KDDecomposition::constructNewTree(KDNode *& newRoot, KDNode *& newOwnLeaf, result = decompose(newRoot, newOwnLeaf, MPI_COMM_WORLD); } if (result) { - global_log->warning() << "Domain too small to achieve a perfect load balancing" << endl; + Log::global_log->warning() << "Domain too small to achieve a perfect load balancing" << std::endl; } completeTreeInfo(newRoot, newOwnLeaf); @@ -591,11 +589,11 @@ void KDDecomposition::constructNewTree(KDNode *& newRoot, KDNode *& newOwnLeaf, _neighbourCommunicationScheme->setCoverWholeDomain(d, newOwnLeaf->_coversWholeDomain[d]); } - global_log->info() << "KDDecomposition: rebalancing finished" << endl; + Log::global_log->info() << "KDDecomposition: rebalancing finished" << std::endl; #ifndef NDEBUG if (_rank == 0) { - stringstream fname; + std::stringstream fname; fname << "kddecomp_" << _steps - 1 << ".vtu"; newRoot->plotNode(fname.str(), &_processorSpeeds); } @@ -709,9 +707,9 @@ double KDDecomposition::getBoundingBoxMax(int dimension, Domain* domain) { void KDDecomposition::completeTreeInfo(KDNode*& root, KDNode*& ownArea) { int numElementsToRecv = root->_numProcs * 2 - 1; - vector ptrToAllNodes; - vector child1; - vector child2; + std::vector ptrToAllNodes; + std::vector child1; + std::vector child2; ptrToAllNodes.resize(numElementsToRecv); child1.resize(numElementsToRecv); child2.resize(numElementsToRecv); @@ -773,15 +771,15 @@ void KDDecomposition::completeTreeInfo(KDNode*& root, KDNode*& ownArea) { #ifdef DEBUG_DECOMP void printChildrenInfo(std::ofstream& filestream, KDNode* node, double minDev) { for (int i = 0; i < node->_level; i++) { filestream << " ";} - filestream << " * " << "load=" << node->_load << " optLoad=" << node->_optimalLoadPerProcess << " expDev=" << node->_deviationLowerBound << " minDev=" << minDev << endl; + filestream << " * " << "load=" << node->_load << " optLoad=" << node->_optimalLoadPerProcess << " expDev=" << node->_deviationLowerBound << " minDev=" << minDev << std::endl; for (int i = 0; i < node->_level; i++) { filestream << " ";} filestream << " [" << node->_child1->_lowCorner[0] << "," << node->_child1->_lowCorner[1] << "," << node->_child1->_lowCorner[2] << "]" << "[" << node->_child1->_highCorner[0] << "," << node->_child1->_highCorner[1] << "," << node->_child1->_highCorner[2] << "]" - << " load=" << node->_child1->_load << " #procs=" << node->_child1->_numProcs << " avgLoad=" << node->_child1->calculateAvgLoadPerProc() << endl; + << " load=" << node->_child1->_load << " #procs=" << node->_child1->_numProcs << " avgLoad=" << node->_child1->calculateAvgLoadPerProc() << std::endl; for (int i = 0; i < node->_level; i++) { filestream << " ";} filestream << " [" << node->_child2->_lowCorner[0] << "," << node->_child2->_lowCorner[1] << "," << node->_child2->_lowCorner[2] << "]" << "[" << node->_child2->_highCorner[0] << "," << node->_child2->_highCorner[1] << "," << node->_child2->_highCorner[2] << "]" - << " load=" << node->_child2->_load << " #procs=" << node->_child2->_numProcs << " avgLoad=" << node->_child2->calculateAvgLoadPerProc() << endl; + << " load=" << node->_child2->_load << " #procs=" << node->_child2->_numProcs << " avgLoad=" << node->_child2->calculateAvgLoadPerProc() << std::endl; } #endif @@ -823,13 +821,13 @@ bool KDDecomposition::decompose(KDNode* fatherNode, KDNode*& ownArea, MPI_Comm c #ifdef DEBUG_DECOMP std::stringstream fname; fname << "Div_proc_" << _rank << "_step_" << _steps << ".txt"; - std::ofstream filestream(fname.str().c_str(), ios::app); + std::ofstream filestream(fname.str().c_str(), std::ios::app); filestream.precision(8); for (int i = 0; i < fatherNode->_level; i++) { filestream << " ";} filestream << "Division at rank=" << _rank << " for [" << fatherNode->_lowCorner[0] << ","<< fatherNode->_lowCorner[1] << "," << fatherNode->_lowCorner[2] << "] [" << fatherNode->_highCorner[0] << ","<< fatherNode->_highCorner[1] << "," << fatherNode->_highCorner[2] << "] " << - "level=" << fatherNode->_level << " #divisions=" << possibleSubdivisions.size() << endl; + "level=" << fatherNode->_level << " #divisions=" << possibleSubdivisions.size() << std::endl; #endif while (iter != possibleSubdivisions.end() && (iterations < maxIterations) && (*iter)->_deviationLowerBound < minimalDeviation) { @@ -839,7 +837,7 @@ bool KDDecomposition::decompose(KDNode* fatherNode, KDNode*& ownArea, MPI_Comm c #endif // compute the next subdivision depending on the current rank (either first or second subdivision) - vector origRanks; + std::vector origRanks; int newNumProcs; if (_rank < (*iter)->_child2->_owningProc) { // assign the current rank to either the first (child1)... origRanks.resize((*iter)->_child1->_numProcs); @@ -886,12 +884,12 @@ bool KDDecomposition::decompose(KDNode* fatherNode, KDNode*& ownArea, MPI_Comm c (*iter)->_child2->_deviation = deviationChildren[1]; (*iter)->calculateDeviation(); if((*iter)->_deviation < (*iter)->_deviationLowerBound){ - global_log->warning() << "Calculated deviation " << (*iter)->_deviation << " lower than lower bound " + Log::global_log->warning() << "Calculated deviation " << (*iter)->_deviation << " lower than lower bound " << (*iter)->_deviationLowerBound << ". This should not happen. Please report a bug." << std::endl; } #ifdef DEBUG_DECOMP for (int i = 0; i < fatherNode->_level; i++) { filestream << " ";} - filestream << " deviation=" << (*iter)->_deviation << " (ch1:" << deviationChildren[0] << "ch2:" << deviationChildren[1] << endl; + filestream << " deviation=" << (*iter)->_deviation << " (ch1:" << deviationChildren[0] << "ch2:" << deviationChildren[1] << std::endl; #endif if ((*iter)->_deviation < minimalDeviation) { delete bestSubdivision;// (deleting of nullptr is ok and does not produce errors, since delete checks for nullptr) @@ -928,10 +926,10 @@ bool KDDecomposition::decompose(KDNode* fatherNode, KDNode*& ownArea, MPI_Comm c bool KDDecomposition::calculateAllPossibleSubdivisions(KDNode* node, std::list& subdividedNodes, MPI_Comm commGroup) { bool domainTooSmall = false; - vector > costsLeft(3); - vector > costsRight(3); + std::vector > costsLeft(3); + std::vector > costsRight(3); calculateCostsPar(node, costsLeft, costsRight, commGroup); - global_log->debug() << "calculateAllPossibleSubdivisions: " << std::endl; + Log::global_log->debug() << "calculateAllPossibleSubdivisions: " << std::endl; double leftRightLoadRatio = 1.; // divide load 50/50 -> this can be changed later on if the topology of the system should be taken into account. // update leftRightRatio to something meaningful (that is representable by the compute power distribution of the processes: @@ -948,11 +946,11 @@ bool KDDecomposition::calculateAllPossibleSubdivisions(KDNode* node, std::list_owningProc), node->_numProcs - 1); + leftRightLoadRatioIndex = std::min((int) (iter - 1 - _accumulatedProcessorSpeeds.begin() - node->_owningProc), node->_numProcs - 1); } else { - leftRightLoadRatioIndex = min((int) (iter - _accumulatedProcessorSpeeds.begin() - node->_owningProc), node->_numProcs - 1); + leftRightLoadRatioIndex = std::min((int) (iter - _accumulatedProcessorSpeeds.begin() - node->_owningProc), node->_numProcs - 1); } - leftRightLoadRatioIndex = max(1, leftRightLoadRatioIndex); + leftRightLoadRatioIndex = std::max(1, leftRightLoadRatioIndex); leftRightLoadRatio = (_accumulatedProcessorSpeeds[node->_owningProc + leftRightLoadRatioIndex] - _accumulatedProcessorSpeeds[node->_owningProc]) / (_accumulatedProcessorSpeeds[node->_owningProc + node->_numProcs] - _accumulatedProcessorSpeeds[node->_owningProc + leftRightLoadRatioIndex]); @@ -1006,13 +1004,13 @@ bool KDDecomposition::calculateAllPossibleSubdivisions(KDNode* node, std::listdebug() << "splitLoad: startindex " << index << " of " << costsLeft[dim].size() <debug() << "splitLoad: startindex " << index << " of " << costsLeft[dim].size() <_highCorner[dim] - node->_lowCorner[dim] - 1) / 2); - endIndex = min(endIndex, startIndex + 1); + startIndex = std::max(startIndex, (node->_highCorner[dim] - node->_lowCorner[dim] - 1) / 2); + endIndex = std::min(endIndex, startIndex + 1); } } @@ -1025,7 +1023,7 @@ bool KDDecomposition::calculateAllPossibleSubdivisions(KDNode* node, std::listerror() << "no processor speeds given" << std::endl; + Log::global_log->error() << "no processor speeds given" << std::endl; Simulation::exit(-1); } double optimalLoad = (_accumulatedProcessorSpeeds[node->_owningProc + node->_numProcs] - _accumulatedProcessorSpeeds[node->_owningProc]) * leftRightLoadRatio @@ -1038,16 +1036,16 @@ bool KDDecomposition::calculateAllPossibleSubdivisions(KDNode* node, std::list rho * (G - L) = L => L = rho / (1 + rho) * G if (fabs(*(iter - 1) - searchLoad) < fabs(*iter - searchLoad)) { // iter-1 always exists, since _accumulatedProcessorSpeeds[0] = 0 - optNumProcsLeft = min((int)(iter - 1 - _accumulatedProcessorSpeeds.begin() - node->_owningProc), node->_numProcs - 1); + optNumProcsLeft = std::min((int)(iter - 1 - _accumulatedProcessorSpeeds.begin() - node->_owningProc), node->_numProcs - 1); } else { - optNumProcsLeft = min((int)(iter - _accumulatedProcessorSpeeds.begin() - node->_owningProc), node->_numProcs - 1); + optNumProcsLeft = std::min((int)(iter - _accumulatedProcessorSpeeds.begin() - node->_owningProc), node->_numProcs - 1); } } else{ - optNumProcsLeft = min(round(costsLeft[dim][i] / optCostPerProc), (double) (node->_numProcs - 1)); + optNumProcsLeft = std::min(round(costsLeft[dim][i] / optCostPerProc), (double) (node->_numProcs - 1)); } - int numProcsLeft = max(1, optNumProcsLeft); + int numProcsLeft = std::max(1, optNumProcsLeft); auto* clone = new KDNode(*node); if (clone->_level == 0) { @@ -1088,7 +1086,7 @@ bool KDDecomposition::calculateAllPossibleSubdivisions(KDNode* node, std::list_child1->_numProcs <= 0 || clone->_child1->_numProcs >= node->_numProcs) || (clone->_child2->_numProcs <= 0 || clone->_child2->_numProcs >= node->_numProcs) ){ //continue; - global_log->error_always_output() << "ERROR in calculateAllPossibleSubdivisions(), part of the domain was not assigned to a proc" << endl; + Log::global_log->error_always_output() << "ERROR in calculateAllPossibleSubdivisions(), part of the domain was not assigned to a proc" << std::endl; Simulation::exit(1); } mardyn_assert( clone->_child1->isResolvable() && clone->_child2->isResolvable() ); @@ -1118,8 +1116,8 @@ bool KDDecomposition::calculateAllPossibleSubdivisions(KDNode* node, std::list >& costsLeft, vector >& costsRight, MPI_Comm commGroup) { - vector > cellCosts; +void KDDecomposition::calculateCostsPar(KDNode* area, std::vector >& costsLeft, std::vector >& costsRight, MPI_Comm commGroup) { + std::vector > cellCosts; cellCosts.resize(3); int newRank; @@ -1148,8 +1146,8 @@ void KDDecomposition::calculateCostsPar(KDNode* area, vector >& c // if this process doesn't has to do anything in this dimension, continue if (startIndex > dimStopIndex[dim] || stopIndex < dimStartIndex[dim]) continue; - int loopstart = max(0, startIndex - dimStartIndex[dim]); - int loopend = min(area->_highCorner[dim] - area->_lowCorner[dim], (area->_highCorner[dim] - area->_lowCorner[dim]) + stopIndex - dimStopIndex[dim]); + int loopstart = std::max(0, startIndex - dimStartIndex[dim]); + int loopend = std::min(area->_highCorner[dim] - area->_lowCorner[dim], (area->_highCorner[dim] - area->_lowCorner[dim]) + stopIndex - dimStopIndex[dim]); bool sendCostValue = false; bool recvCostValue = false; @@ -1185,9 +1183,9 @@ void KDDecomposition::calculateCostsPar(KDNode* area, vector >& c int numParts2 = _numParticleTypes == 1 ? 0 : _numParticlesPerCell[_globalNumCells + getGlobalIndex(dim, dim1, dim2, i_dim, i_dim1, i_dim2, area)]; - //_maxPars = max(_maxPars, numParts); - _maxPars = max(_maxPars, numParts1); - _maxPars2 = max(_maxPars2, numParts2); + //_maxPars = std::max(_maxPars, numParts); + _maxPars = std::max(_maxPars, numParts1); + _maxPars2 = std::max(_maxPars2, numParts2); // ####################### // ## Cell Costs ## // ####################### @@ -1248,7 +1246,7 @@ void KDDecomposition::calculateCostsPar(KDNode* area, vector >& c case 3: //3 zeroes is the cell itself which was already counted break; default: - global_log->error() << "[KDDecomposition] zeroCounts too large!" << std::endl; + Log::global_log->error() << "[KDDecomposition] zeroCounts too large!" << std::endl; Simulation::exit(1); } } @@ -1279,7 +1277,7 @@ void KDDecomposition::calculateCostsPar(KDNode* area, vector >& c } } for (int dim = 0; dim < 3; dim++) { - vector cellCostsSum; + std::vector cellCostsSum; cellCostsSum.resize(area->_highCorner[dim] - area->_lowCorner[dim] + 1, 0.0); int size2 = cellCostsSum.size(); @@ -1330,7 +1328,7 @@ int KDDecomposition::ownMod(int number, int modulo) const { } // TODO: this method could or should be moved to KDNode. -void KDDecomposition::getOwningProcs(int low[KDDIM], int high[KDDIM], KDNode* decompTree, KDNode* testNode, vector* procIDs, vector* neighbHaloAreas) const { +void KDDecomposition::getOwningProcs(int low[KDDIM], int high[KDDIM], KDNode* decompTree, KDNode* testNode, std::vector* procIDs, std::vector* neighbHaloAreas) const { // For areas overlapping the domain given by decompTree, the overlapping part is // mapped to the corresponding area on the other side of the domain (periodic boundary) // The boolean variable overlap stores for each coordinate direction whether the area overlaps. @@ -1482,8 +1480,8 @@ std::vector KDDecomposition::getNeighboursFromHaloRegion(D getCellIntCoordsFromRegionPeriodic(regToSendLo, regToSendHi, rmin, rmax, domain); - vector ranks; - vector ranges; + std::vector ranks; + std::vector ranges; _decompTree->getOwningProcs(regToSendLo, regToSendHi, ranks, ranges); int numNeighbours = ranks.size(); auto indexIt = ranges.begin(); @@ -1541,9 +1539,9 @@ std::vector KDDecomposition::getNeighboursFromHaloRegion(D return communicationPartners; } -void KDDecomposition::collectMoleculesInRegion(ParticleContainer* moleculeContainer, const double startRegion[3], const double endRegion[3], vector& mols) const { - vector> threadData; - vector prefixArray; +void KDDecomposition::collectMoleculesInRegion(ParticleContainer* moleculeContainer, const double startRegion[3], const double endRegion[3], std::vector& mols) const { + std::vector> threadData; + std::vector prefixArray; #if defined (_OPENMP) #pragma omp parallel shared(mols, threadData) @@ -1614,7 +1612,7 @@ bool KDDecomposition::heteroDecompose(KDNode* fatherNode, KDNode*& ownArea, MPI_ double minimalDeviation = std::numeric_limits::max(); // compute the next subdivision depending on the current rank (either first or second subdivision) - vector origRanks; + std::vector origRanks; int newNumProcs; if (_rank < bestSubdivision->_child2->_owningProc) { @@ -1704,8 +1702,8 @@ int KDDecomposition::calculatePartitionRank(){ bool KDDecomposition::calculateHeteroSubdivision(KDNode* node, KDNode*& optimalNode, MPI_Comm commGroup) { bool domainTooSmall = false; - vector > costsLeft(3); - vector > costsRight(3); + std::vector > costsLeft(3); + std::vector > costsRight(3); { MPI_Group group1, group2; //one group for each partition std::vector ranks1 {}; @@ -1726,7 +1724,7 @@ bool KDDecomposition::calculateHeteroSubdivision(KDNode* node, KDNode*& optimalN MPI_CHECK( MPI_Comm_create(commGroup, newGroup2, &newComm2) ); int currNumProcs = node->_numProcs; - vector> dummyCosts {3}; + std::vector> dummyCosts {3}; //calculate the load for one of the sides of each splitting plane if(rank < _partitionRank){ node->_numProcs = _partitionRank; @@ -1773,7 +1771,7 @@ bool KDDecomposition::calculateHeteroSubdivision(KDNode* node, KDNode*& optimalN size_t biggestDim = maxInd; if (costsLeft[biggestDim].size()<=2){ - global_log->error_always_output() << "The domain is far to small!"; + Log::global_log->error_always_output() << "The domain is far to small!"; Simulation::exit(1); } @@ -1799,7 +1797,7 @@ bool KDDecomposition::calculateHeteroSubdivision(KDNode* node, KDNode*& optimalN endIndex = std::min(startIndex + 1, endIndex); startIndex = std::min(endIndex-1, startIndex); - global_log->debug() << "splitLoad: startindex " << index << " of " << costsLeft[biggestDim].size() << std::endl; + Log::global_log->debug() << "splitLoad: startindex " << index << " of " << costsLeft[biggestDim].size() << std::endl; const int i = startIndex; @@ -1817,7 +1815,7 @@ bool KDDecomposition::calculateHeteroSubdivision(KDNode* node, KDNode*& optimalN optimalNode->split(biggestDim, node->_lowCorner[biggestDim] + i, numProcsLeft); if ( (unsigned int) (optimalNode->_child1->_numProcs + optimalNode->_child2->_numProcs) > (optimalNode->_child1->getNumMaxProcs() + optimalNode->_child2->getNumMaxProcs())) { - global_log->error() << "Domain is not resolvable at all!" << std::endl; + Log::global_log->error() << "Domain is not resolvable at all!" << std::endl; Simulation::exit(1); } @@ -1845,7 +1843,7 @@ bool KDDecomposition::calculateHeteroSubdivision(KDNode* node, KDNode*& optimalN if ((optimalNode->_child1->_numProcs <= 0 || optimalNode->_child1->_numProcs >= node->_numProcs) || (optimalNode->_child2->_numProcs <= 0 || optimalNode->_child2->_numProcs >= node->_numProcs) ){ //continue; - global_log->error_always_output() << "ERROR in calculateHeteroSubdivision(), part of the domain was not assigned to a proc" << endl; + Log::global_log->error_always_output() << "ERROR in calculateHeteroSubdivision(), part of the domain was not assigned to a proc" << std::endl; Simulation::exit(1); } mardyn_assert( optimalNode->_child1->isResolvable() && optimalNode->_child2->isResolvable() ); diff --git a/src/parallel/KDDecomposition.h b/src/parallel/KDDecomposition.h index 4d8cb44687..7ba94a7061 100644 --- a/src/parallel/KDDecomposition.h +++ b/src/parallel/KDDecomposition.h @@ -289,7 +289,7 @@ class KDDecomposition: public DomainDecompMPIBase { * it so that all division costs for */ bool calculateAllPossibleSubdivisions(KDNode* node, std::list& subdividedNodes, MPI_Comm commGroup); - + /** * Calculates the splitting plane for the "cluster" heterogeneous decomposition * diff --git a/src/parallel/KDNode.cpp b/src/parallel/KDNode.cpp index 58457ff952..945e94f919 100644 --- a/src/parallel/KDNode.cpp +++ b/src/parallel/KDNode.cpp @@ -13,7 +13,6 @@ #include /* for min and max ?*/ -using namespace Log; KDNode* KDNode::findAreaForProcess(int rank) { if (_numProcs == 1) { @@ -285,7 +284,7 @@ void KDNode::plotNode(const std::string& vtkFile, const std::vector* pro plotNode(writer); writer.writeVTKFile(vtkFile); #else - global_log->warning() << "KDNode::plotNode() requires vtk output. Compile with -DVTK!"<< std::endl; + Log::global_log->warning() << "KDNode::plotNode() requires vtk output. Compile with -DVTK!"<< std::endl; #endif } @@ -314,7 +313,7 @@ void KDNode::plotNode(VTKGridWriterImplementation& writer) const { writer.plotCell(cell); } #else - global_log->warning() << "KDNode::plotNode() requires vtk output. Compile with -DVTK!" << std::endl; + Log::global_log->warning() << "KDNode::plotNode() requires vtk output. Compile with -DVTK!" << std::endl; #endif } diff --git a/src/parallel/KDNode.h b/src/parallel/KDNode.h index b5fc10ab99..1be86c0a38 100644 --- a/src/parallel/KDNode.h +++ b/src/parallel/KDNode.h @@ -12,7 +12,7 @@ class VTKGridWriterImplementation; //! @brief represents a node in the decomposition tree when using KDDecomposition //! @author Martin Buchholz, Wolfgang Eckhardt -//! +//! //! The KDDecomposition decomposes the domain by recursively splitting the domain //! into smaller parts. This class is used to represent this decomposition. //! The root node of the decomposition covers the whole domain, in the first @@ -224,9 +224,9 @@ class KDNode { //! true if the domain in the given dimension is not divided into more than one process bool _coversWholeDomain[KDDIM]; - //! ID of this KDNode + //! ID of this KDNode int _nodeID; - //! process which owns this KDNode (only possible for leaf nodes) + //! process which owns this KDNode (only possible for leaf nodes) int _owningProc; // only used if the node is a leaf //! "left" child of this KDNode (only used if the child is no leaf) diff --git a/src/parallel/LoadCalc.cpp b/src/parallel/LoadCalc.cpp index 1b64f41190..435860cb8c 100644 --- a/src/parallel/LoadCalc.cpp +++ b/src/parallel/LoadCalc.cpp @@ -120,22 +120,22 @@ TunerLoad::TunerLoad(int count1, int count2, std::vector&& ownTime, std: calcConsts(_cornerTime, false)) { if (_ownTime.size() != size_t(_count1 * _count2)) { - global_log->error_always_output() << "_edgeTime was initialized with the wrong size of " << _ownTime.size() + Log::global_log->error_always_output() << "_edgeTime was initialized with the wrong size of " << _ownTime.size() << " expected: " << _count1 * _count2; } if (_faceTime.size() != size_t(count1 * _count2)) { - global_log->error_always_output() << "_edgeTime was initialized with the wrong size of " << _faceTime.size() + Log::global_log->error_always_output() << "_edgeTime was initialized with the wrong size of " << _faceTime.size() << " expected: " << _count1 * _count2; } if (_edgeTime.size() != size_t(_count1 * _count2)) { - global_log->error_always_output() << "_edgeTime was initialized with the wrong size of " << _edgeTime.size() + Log::global_log->error_always_output() << "_edgeTime was initialized with the wrong size of " << _edgeTime.size() << " expected: " << _count1 * _count2; } if (_cornerTime.size() != size_t(_count1 * _count2)) { - global_log->error_always_output() << "_edgeTime was initialized with the wrong size of " << _cornerTime.size() + Log::global_log->error_always_output() << "_edgeTime was initialized with the wrong size of " << _cornerTime.size() << " expected: " << _count1 * _count2; } } @@ -213,7 +213,7 @@ arma::vec nnls_coordinate_wise(const arma::mat &A, const arma::vec &b, int max_i int i = 0; double tmp; - while (i < max_iter && max(abs(x - x0)) > tol) { + while (i < max_iter && std::max(abs(x - x0)) > tol) { x0 = x; for (unsigned int k = 0; k < A.n_cols; k++) { tmp = x[k] - mu[k] / H.at(k, k); @@ -353,7 +353,7 @@ inline arma::vec getIncreasingSolutionVec(arma::mat arma_system_matrix, const ar int MeasureLoad::prepareLoads(DomainDecompBase* decomp, MPI_Comm& comm) { #ifndef MARDYN_ARMADILLO - global_log->info() << "not compiled with armadillo. MeasureLoad not usable." << std::endl; + Log::global_log->info() << "not compiled with armadillo. MeasureLoad not usable." << std::endl; return 1; #else int numRanks = decomp->getNumProcs(); @@ -446,7 +446,7 @@ int MeasureLoad::prepareLoads(DomainDecompBase* decomp, MPI_Comm& comm) { coefficient_vec = nnls(arma_system_matrix, arma_rhs); } mardyn_assert(coefficient_vec.size() == num_dof); - global_log->info() << "coefficient_vec: " << std::endl; + Log::global_log->info() << "coefficient_vec: " << std::endl; coefficient_vec.raw_print(std::cout); std::cout << std::endl; _times.resize(interpolationStartsAt); @@ -461,7 +461,7 @@ int MeasureLoad::prepareLoads(DomainDecompBase* decomp, MPI_Comm& comm) { } else if (_timeValuesShouldBeIncreasing) { arma::vec cell_time_vec = getIncreasingSolutionVec(arma_system_matrix, arma_rhs, global_maxParticlesP1); - global_log->info() << "cell_time_vec:" << std::endl; + Log::global_log->info() << "cell_time_vec:" << std::endl; cell_time_vec.raw_print(std::cout); _times = arma::conv_to >::from(cell_time_vec); mardyn_assert(_times.size() == global_maxParticlesP1); @@ -469,7 +469,7 @@ int MeasureLoad::prepareLoads(DomainDecompBase* decomp, MPI_Comm& comm) { } else { arma::vec cell_time_vec = nnls(arma_system_matrix, arma_rhs); - global_log->info() << "cell_time_vec:\n" << cell_time_vec << std::endl; + Log::global_log->info() << "cell_time_vec:\n" << cell_time_vec << std::endl; _times = arma::conv_to >::from(cell_time_vec); mardyn_assert(_times.size() == global_maxParticlesP1); MPI_Bcast(_times.data(), global_maxParticlesP1, MPI_DOUBLE, 0, comm); @@ -493,12 +493,12 @@ int MeasureLoad::prepareLoads(DomainDecompBase* decomp, MPI_Comm& comm) { } if (not isFinite(_times.begin(), _times.end())) { - global_log->warning() << "Detected non-finite number in MeasureLoad" << std::endl; + Log::global_log->warning() << "Detected non-finite number in MeasureLoad" << std::endl; return 1; } if (not isFinite(_interpolationConstants.begin(), _interpolationConstants.end())) { - global_log->warning() << "Detected non-finite number in MeasureLoad" << std::endl; + Log::global_log->warning() << "Detected non-finite number in MeasureLoad" << std::endl; return 1; } _preparedLoad = true; @@ -536,7 +536,7 @@ void MeasureLoad::calcConstants() { for (size_t row = 0; row < 3ul; row++) { _interpolationConstants[row] = solution[2 - row]; } - global_log->info() << "_interpolationConstants: " << std::endl << solution << std::endl; + Log::global_log->info() << "_interpolationConstants: " << std::endl << solution << std::endl; #endif } diff --git a/src/parallel/MPIKDNode.cpp b/src/parallel/MPIKDNode.cpp index 8359c7570e..9b608937b3 100644 --- a/src/parallel/MPIKDNode.cpp +++ b/src/parallel/MPIKDNode.cpp @@ -7,7 +7,7 @@ #define assertion(x) mardyn_assert(x) #define assertion1(x,y) { if (!(x)) std::cerr << (y) << std::endl; mardyn_assert(x);} -using Log::global_log; + MPIKDNodePacked::MPIKDNodePacked(const std::bitset<3>& coversWholeDomain, const int& numProcs, const int* lowCorner, const int* highCorner, const int& nodeID, const int& owningProc, @@ -31,7 +31,7 @@ _level(level) { setHighCorner(i, highCorner[i]); } assertion((31 < (8 * sizeof(int)))); - + } MPIKDNodePacked::~MPIKDNodePacked() { } @@ -70,7 +70,7 @@ void MPIKDNodePacked::setCoversWholeDomain(int elementIndex, const bool& coversW assertion(elementIndex>=0); assertion(elementIndex<3); //assertion(!coversWholeDomain || coversWholeDomain==1); - int shift = 0 + elementIndex; + int shift = 0 + elementIndex; int mask = 1 << (shift); int shiftedValue = coversWholeDomain << (shift); _packedRecords0 = _packedRecords0 & ~mask; @@ -118,7 +118,7 @@ int MPIKDNodePacked::getLowCorner(int elementIndex) const { assertion(elementIndex>=0); assertion(elementIndex<3); return _lowCorner[elementIndex]; - + } @@ -126,7 +126,7 @@ void MPIKDNodePacked::setLowCorner(int elementIndex, const int& lowCorner) { assertion(elementIndex>=0); assertion(elementIndex<3); _lowCorner[elementIndex]= lowCorner; - + } @@ -139,7 +139,7 @@ int MPIKDNodePacked::getHighCorner(int elementIndex) const { assertion(elementIndex>=0); assertion(elementIndex<3); return _highCorner[elementIndex]; - + } @@ -148,7 +148,7 @@ void MPIKDNodePacked::setHighCorner(int elementIndex, const int& highCorner) { assertion(elementIndex>=0); assertion(elementIndex<3); _highCorner[elementIndex]= highCorner; - + } @@ -257,7 +257,7 @@ std::string MPIKDNodePacked::toString() const { } void MPIKDNodePacked::toString (std::ostream& out) const { - out << "("; + out << "("; out << "coversWholeDomain:["; for (int i = 0; i < 3-1; i++) { out << getCoversWholeDomain(i) << ","; @@ -358,7 +358,7 @@ void MPIKDNodePacked::initDatatype() { for (int i=1; i disp[i-1])) { - global_log->debug() << "i=" << i << std::endl; + Log::global_log->debug() << "i=" << i << std::endl; } assertion1( disp[i] > disp[i-1], i ); } diff --git a/src/parallel/NeighborAcquirer.cpp b/src/parallel/NeighborAcquirer.cpp index 74caeda622..86d69fe757 100644 --- a/src/parallel/NeighborAcquirer.cpp +++ b/src/parallel/NeighborAcquirer.cpp @@ -358,4 +358,4 @@ std::pair, std::vector>> NeighborA } } return std::make_pair(haloRegions, shifts); -} \ No newline at end of file +} diff --git a/src/parallel/NeighbourCommunicationScheme.cpp b/src/parallel/NeighbourCommunicationScheme.cpp index f4561d2a4e..c138410d59 100644 --- a/src/parallel/NeighbourCommunicationScheme.cpp +++ b/src/parallel/NeighbourCommunicationScheme.cpp @@ -237,7 +237,7 @@ void DirectNeighbourCommunicationScheme::initExchangeMoleculesMPI(ParticleContai // send only if neighbour is actually a neighbour. for (auto & neighbor: _neighbours->operator[](0)) { if (not _useSequentialFallback or neighbor.getRank() != domainDecomp->getRank()) { - global_log->debug() << "Rank " << domainDecomp->getRank() << " is initiating communication (type " + Log::global_log->debug() << "Rank " << domainDecomp->getRank() << " is initiating communication (type " << msgType << ") to " << neighbor.getRank() << std::endl; neighbor.initSend(moleculeContainer, domainDecomp->getCommunicator(), domainDecomp->getMPIParticleType(), msgType, invalidParticles, true, @@ -245,7 +245,7 @@ void DirectNeighbourCommunicationScheme::initExchangeMoleculesMPI(ParticleContai } } if(not invalidParticles.empty()){ - global_log->error_always_output() << "NeighbourCommunicationScheme: Invalid particles that should have been " + Log::global_log->error_always_output() << "NeighbourCommunicationScheme: Invalid particles that should have been " "sent, are still existent. They would be lost. Aborting...\n" << "BoxMin: " << moleculeContainer->getBoundingBoxMin(0) << ", " @@ -257,13 +257,13 @@ void DirectNeighbourCommunicationScheme::initExchangeMoleculesMPI(ParticleContai << moleculeContainer->getBoundingBoxMax(2) << "\n" << "The particles:" << std::endl; for (auto& invalidParticle : invalidParticles) { - global_log->error_always_output() << invalidParticle << std::endl; + Log::global_log->error_always_output() << invalidParticle << std::endl; } - global_log->error_always_output() << "The leavingExportNeighbours:" << std::endl; + Log::global_log->error_always_output() << "The leavingExportNeighbours:" << std::endl; for (auto& neighbour : (*_leavingExportNeighbours)[0]) { std::stringstream ss; neighbour.print(ss); - global_log->error_always_output() << ss.str() << std::endl; + Log::global_log->error_always_output() << ss.str() << std::endl; } Simulation::exit(544); } @@ -323,7 +323,7 @@ void DirectNeighbourCommunicationScheme::finalizeExchangeMoleculesMPI(ParticleCo double waitCounter = 50.0; double deadlockTimeOut = 360.0; - global_log->set_mpi_output_all(); + Log::global_log->set_mpi_output_all(); while (not allDone) { allDone = true; if (_pushPull) { @@ -356,7 +356,7 @@ void DirectNeighbourCommunicationScheme::finalizeExchangeMoleculesMPI(ParticleCo // catch deadlocks double waitingTime = MPI_Wtime() - startTime; if (waitingTime > waitCounter) { - global_log->warning() + Log::global_log->warning() << "DirectNeighbourCommunicationScheme::finalizeExchangeMoleculesMPI1d: Deadlock warning: Rank " << domainDecomp->getRank() << " is waiting for more than " << waitCounter << " seconds" << std::endl; waitCounter += 5.0; @@ -375,7 +375,7 @@ void DirectNeighbourCommunicationScheme::finalizeExchangeMoleculesMPI(ParticleCo } if (waitingTime > deadlockTimeOut) { - global_log->error() + Log::global_log->error() << "DirectNeighbourCommunicationScheme::finalizeExchangeMoleculesMPI1d: Deadlock error: Rank " << domainDecomp->getRank() << " is waiting for more than " << deadlockTimeOut << " seconds" << std::endl; @@ -399,7 +399,7 @@ void DirectNeighbourCommunicationScheme::finalizeExchangeMoleculesMPI(ParticleCo } // while not allDone - global_log->set_mpi_output_root(0); + Log::global_log->set_mpi_output_root(0); } void NeighbourCommunicationScheme::selectNeighbours(MessageType msgType, bool import) { @@ -420,7 +420,7 @@ void NeighbourCommunicationScheme::selectNeighbours(MessageType msgType, bool im else _neighbours = _haloImportForceExportNeighbours; break; case LEAVING_AND_HALO_COPIES: - global_log->error() << "WRONG type in selectNeighbours - this should not be used for push-pull-partners " + Log::global_log->error() << "WRONG type in selectNeighbours - this should not be used for push-pull-partners " "selectNeighbours method" << std::endl; Simulation::exit(1); @@ -523,7 +523,7 @@ void IndirectNeighbourCommunicationScheme::initExchangeMoleculesMPI1D(ParticleCo const int numNeighbours = (*_neighbours)[d].size(); std::vector dummy; for (int i = 0; i < numNeighbours; ++i) { - global_log->debug() << "Rank " << domainDecomp->getRank() << " is initiating communication to" << std::endl; + Log::global_log->debug() << "Rank " << domainDecomp->getRank() << " is initiating communication to" << std::endl; (*_neighbours)[d][i].initSend(moleculeContainer, domainDecomp->getCommunicator(), domainDecomp->getMPIParticleType(), msgType, dummy, false, true/*do halo position change*/); } @@ -545,7 +545,7 @@ void IndirectNeighbourCommunicationScheme::finalizeExchangeMoleculesMPI1D(Partic double waitCounter = 50.0; double deadlockTimeOut = 360.0; - global_log->set_mpi_output_all(); + Log::global_log->set_mpi_output_all(); for (int i = 0; i < numNeighbours; ++i) { // reset receive status if (domainDecomp->getRank() != (*_neighbours)[d][i].getRank()) { (*_neighbours)[d][i].resetReceive(); @@ -574,7 +574,7 @@ void IndirectNeighbourCommunicationScheme::finalizeExchangeMoleculesMPI1D(Partic // catch deadlocks double waitingTime = MPI_Wtime() - startTime; if (waitingTime > waitCounter) { - global_log->warning() + Log::global_log->warning() << "IndirectNeighbourCommunicationScheme::finalizeExchangeMoleculesMPI1d: Deadlock warning: Rank " << domainDecomp->getRank() << " is waiting for more than " << waitCounter << " seconds" << std::endl; @@ -585,7 +585,7 @@ void IndirectNeighbourCommunicationScheme::finalizeExchangeMoleculesMPI1D(Partic } if (waitingTime > deadlockTimeOut) { - global_log->error() + Log::global_log->error() << "IndirectNeighbourCommunicationScheme::finalizeExchangeMoleculesMPI1d: Deadlock error: Rank " << domainDecomp->getRank() << " is waiting for more than " << deadlockTimeOut << " seconds" << std::endl; @@ -596,7 +596,7 @@ void IndirectNeighbourCommunicationScheme::finalizeExchangeMoleculesMPI1D(Partic } } // while not allDone - global_log->set_mpi_output_root(0); + Log::global_log->set_mpi_output_root(0); } void IndirectNeighbourCommunicationScheme::exchangeMoleculesMPI1D(ParticleContainer* moleculeContainer, Domain* domain, diff --git a/src/parallel/NeighbourCommunicationScheme.h b/src/parallel/NeighbourCommunicationScheme.h index 1050e6cd41..a9c3d5ebc0 100644 --- a/src/parallel/NeighbourCommunicationScheme.h +++ b/src/parallel/NeighbourCommunicationScheme.h @@ -17,7 +17,7 @@ class ZonalMethod; class HaloRegion; class NeighbourCommunicationScheme { friend class NeighbourCommunicationSchemeTest; - + public: /** * Specifies the amount of sequential communication steps needed for the communication scheme. @@ -97,13 +97,13 @@ class NeighbourCommunicationScheme { //! vector of neighbours. The first dimension should be of size getCommDims(). std::vector> *_neighbours; - + // ------------------------------------------------------------------------- std::vector> *_haloExportForceImportNeighbours; std::vector> *_haloImportForceExportNeighbours; std::vector> *_leavingExportNeighbours; std::vector> *_leavingImportNeighbours; - + void selectNeighbours(MessageType msgType, bool import); // ------------------------------------------------------------------------- diff --git a/src/parallel/NonBlockingMPIHandlerBase.cpp b/src/parallel/NonBlockingMPIHandlerBase.cpp index 657e33d14b..2e590c90ee 100644 --- a/src/parallel/NonBlockingMPIHandlerBase.cpp +++ b/src/parallel/NonBlockingMPIHandlerBase.cpp @@ -13,7 +13,6 @@ #include "plugins/PluginBase.h" #include "utils/Logger.h" -using Log::global_log; NonBlockingMPIHandlerBase::NonBlockingMPIHandlerBase(DomainDecompMPIBase* domainDecomposition, ParticleContainer* moleculeContainer, Domain* domain, @@ -28,7 +27,7 @@ NonBlockingMPIHandlerBase::~NonBlockingMPIHandlerBase() {} void NonBlockingMPIHandlerBase::performOverlappingTasks(bool forceRebalancing, double etime) { global_simulation->timers()->start("SIMULATION_DECOMPOSITION"); // ensure that all Particles are in the right cells and exchange Particles - global_log->debug() << "Updating container and decomposition" << std::endl; + Log::global_log->debug() << "Updating container and decomposition" << std::endl; // The particles have moved, so the neighbourhood relations have // changed and have to be adjusted _moleculeContainer->update(); @@ -43,7 +42,7 @@ void NonBlockingMPIHandlerBase::performOverlappingTasks(bool forceRebalancing, d performComputation(); } else { - global_log->debug() + Log::global_log->debug() << "falling back to sequential version, since domainDecomposition is blocking in this time step." << std::endl; NonBlockingMPIHandlerBase::initBalanceAndExchange(forceRebalancing, etime); @@ -53,7 +52,7 @@ void NonBlockingMPIHandlerBase::performOverlappingTasks(bool forceRebalancing, d void NonBlockingMPIHandlerBase::performComputation() { // Force calculation and other pair interaction related computations - global_log->debug() << "Traversing pairs" << std::endl; + Log::global_log->debug() << "Traversing pairs" << std::endl; global_simulation->timers()->start("SIMULATION_COMPUTATION"); global_simulation->timers()->start("SIMULATION_FORCE_CALCULATION"); diff --git a/src/parallel/NonBlockingMPIMultiStepHandler.cpp b/src/parallel/NonBlockingMPIMultiStepHandler.cpp index e674ff4644..d0fd4feb44 100644 --- a/src/parallel/NonBlockingMPIMultiStepHandler.cpp +++ b/src/parallel/NonBlockingMPIMultiStepHandler.cpp @@ -13,8 +13,6 @@ #include "particleContainer/adapter/CellProcessor.h" #include "utils/Logger.h" -using Log::global_log; -using namespace std; NonBlockingMPIMultiStepHandler::NonBlockingMPIMultiStepHandler(DomainDecompMPIBase* domainDecomposition, ParticleContainer* moleculeContainer, Domain* domain, @@ -43,7 +41,7 @@ void NonBlockingMPIMultiStepHandler::performComputation() { _domainDecomposition->prepareNonBlockingStage(false, _moleculeContainer, _domain, i); global_simulation->timers()->stop("SIMULATION_DECOMPOSITION"); // Force calculation and other pair interaction related computations - global_log->debug() << "Traversing innermost cells" << std::endl; + Log::global_log->debug() << "Traversing innermost cells" << std::endl; global_simulation->timers()->start("SIMULATION_COMPUTATION"); global_simulation->timers()->start("SIMULATION_FORCE_CALCULATION"); _moleculeContainer->traversePartialInnermostCells(*_cellProcessor, i, stageCount); @@ -86,7 +84,7 @@ void NonBlockingMPIMultiStepHandler::performComputation() { global_simulation->timers()->stop("SIMULATION_DECOMPOSITION"); // remaining force calculation and other pair interaction related computations - global_log->debug() << "Traversing non-innermost cells" << std::endl; + Log::global_log->debug() << "Traversing non-innermost cells" << std::endl; global_simulation->timers()->start("SIMULATION_COMPUTATION"); global_simulation->timers()->start("SIMULATION_FORCE_CALCULATION"); _moleculeContainer->traverseNonInnermostCells(*_cellProcessor); diff --git a/src/parallel/ParticleDataRMM.cpp b/src/parallel/ParticleDataRMM.cpp index ab9a281b12..70e228ecac 100644 --- a/src/parallel/ParticleDataRMM.cpp +++ b/src/parallel/ParticleDataRMM.cpp @@ -28,7 +28,7 @@ void ParticleDataRMM::getMPIType(MPI_Datatype &sendPartType) { } else if (sizeof(pdata_dummy.r[0]) == 4) { // 4 bytes for single types[1] = MPI_FLOAT; } else { - global_log->error() << "invalid size of vcp_real_calc"; + Log::global_log->error() << "invalid size of vcp_real_calc"; Simulation::exit(4852); } diff --git a/src/parallel/ResilienceComm.cpp b/src/parallel/ResilienceComm.cpp index 53ed78f4a1..60ab271aba 100644 --- a/src/parallel/ResilienceComm.cpp +++ b/src/parallel/ResilienceComm.cpp @@ -12,7 +12,6 @@ #include #include "utils/Logger.h" -using Log::global_log; //pretty much default ResilienceComm::ResilienceComm(int numProcs, int rank) @@ -30,12 +29,12 @@ ResilienceComm::~ResilienceComm() { /*do nothing*/ } -int ResilienceComm::scatterBackupInfo(std::vector& backupInfo, +int ResilienceComm::scatterBackupInfo(std::vector& backupInfo, int const numberOfBackups, size_t const sizePerRank, - std::vector& backing, - std::vector& backedBy, - std::vector& backingTags, + std::vector& backing, + std::vector& backedBy, + std::vector& backingTags, std::vector& backedByTags) { size_t totalBytesRecv = sizePerRank*numberOfBackups*sizeof(int); std::vector recvArray(totalBytesRecv); @@ -45,7 +44,7 @@ int ResilienceComm::scatterBackupInfo(std::vector& backupInfo, // for (auto const& rnk : backupInfo) { // bkinf << rnk << ", "; // } - // global_log->info() << bkinf.str() << std::endl; + // Log::global_log->info() << bkinf.str() << std::endl; mardyn_assert(static_cast(sizePerRank*numberOfBackups*_numProcs) == backupInfo.size()); } else { @@ -73,8 +72,8 @@ int ResilienceComm::scatterBackupInfo(std::vector& backupInfo, std::copy(recvArray.begin()+1*totalBytesRecv/sizePerRank, recvArray.begin()+2*totalBytesRecv/sizePerRank, backedByAsChar); std::copy(recvArray.begin()+2*totalBytesRecv/sizePerRank, recvArray.begin()+3*totalBytesRecv/sizePerRank, backingTagsAsChar); std::copy(recvArray.begin()+3*totalBytesRecv/sizePerRank, recvArray.begin()+4*totalBytesRecv/sizePerRank, backedByTagsAsChar); - // global_log->info() << " RR: Dumping scattered backup info: " << std::endl; - // global_log->set_mpi_output_all(); + // Log::global_log->info() << " RR: Dumping scattered backup info: " << std::endl; + // Log::global_log->set_mpi_output_all(); // std::stringstream bckd, bckBy, bckdTags, bckByTags; // for (int i=0; i& backupInfo, // bckdTags << backingTags[i] << ", "; // bckByTags << backedByTags[i] << ", "; // } - // global_log->info() << " Backed: " << bckd.str() << " Backed by: " << bckBy.str() << std::endl; - // global_log->info() << " Backed tags: " << bckdTags.str() << " Backed by tags: " << bckByTags.str() << std::endl; + // Log::global_log->info() << " Backed: " << bckd.str() << " Backed by: " << bckBy.str() << std::endl; + // Log::global_log->info() << " Backed tags: " << bckdTags.str() << " Backed by tags: " << bckByTags.str() << std::endl; return 0; } @@ -112,7 +111,7 @@ int ResilienceComm::exchangeSnapshotSizes( // MPI_Barrier(MPI_COMM_WORLD); // setup the receiving buffers too for all ranks the current one is backing for (size_t ib=0; ibinfo() << " RR: Sending " << sendData.size() + // Log::global_log->info() << " RR: Sending " << sendData.size() // << " bytes to: " << dest << " using tag: " << tag << std::endl; status = MPI_Bsend(sendData.data(), sendData.size(), MPI_CHAR, dest, tag, MPI_COMM_WORLD); mardyn_assert(status == MPI_SUCCESS); @@ -163,9 +162,9 @@ int ResilienceComm::exchangeSnapshots( src = backing[ib]; tag = backingTags[ib]; size_t const recvIndex = recvIndices[ib]; - // global_log->info() << " RR: Receiving " - // << backupDataSizes[ib] << " bytes from " - // << src << " at " + // Log::global_log->info() << " RR: Receiving " + // << backupDataSizes[ib] << " bytes from " + // << src << " at " // << recvIndices[ib] << " using tag: " << tag << std::endl; status = MPI_Recv(&recvData.data()[recvIndex], backupDataSizes[ib], MPI_CHAR, src, tag, MPI_COMM_WORLD, &recvStatus); mardyn_assert(status == MPI_SUCCESS); @@ -179,4 +178,4 @@ int ResilienceComm::exchangeSnapshots( } return 0; } -#endif /* ENABLE_MPI */ \ No newline at end of file +#endif /* ENABLE_MPI */ diff --git a/src/parallel/ResilienceComm.h b/src/parallel/ResilienceComm.h index 7bbed7ec89..e7976e07da 100644 --- a/src/parallel/ResilienceComm.h +++ b/src/parallel/ResilienceComm.h @@ -8,7 +8,7 @@ #define SRC_PARALLEL_RESILIENCECOMM_H_ #ifdef ENABLE_MPI -#include "utils/mardyn_assert.h" +#include "utils/mardyn_assert.h" #include #include @@ -23,7 +23,7 @@ /** * This class implements all communication needed for setting up the redundancy resilience scheme. - * + * * Converts all to CHAR internally. * * TODO: test how this will work when going to Big Endian/Little Endian architectures, @@ -53,12 +53,12 @@ class ResilienceComm { * @param[out] backedByTags The tags associated with the communication of the ranks in backedBy (used in send) */ int scatterBackupInfo( - std::vector& backupInfo, + std::vector& backupInfo, int const numberOfBackups, size_t const sizePerRank, - std::vector& backing, - std::vector& backedBy, - std::vector& backingTags, + std::vector& backing, + std::vector& backedBy, + std::vector& backingTags, std::vector& backedByTags ); /** @@ -72,14 +72,14 @@ class ResilienceComm { * @param[in] backingTags The tags associated with the communication of the ranks in backing (used in recv) * @param[in] backedByTags The tags associated with the communication of the ranks in backedBy (used in send) * @param[in] snapshotSize Size of the local snapshot data in bytes - * @param[out] backupDataSizes The individual sizes of the snapshots acquired + * @param[out] backupDataSizes The individual sizes of the snapshots acquired */ int exchangeSnapshotSizes( std::vector& backing, std::vector& backedBy, std::vector& backingTags, std::vector& backedByTags, - size_t const snapshotSize, + size_t const snapshotSize, std::vector& backupDataSizes ); /** @@ -91,7 +91,7 @@ class ResilienceComm { * @param[in] backedBy A list of ranks the current rank is backing up * @param[in] backingTags The tags associated with the communication of the ranks in backing (used in recv) * @param[in] backedByTags The tags associated with the communication of the ranks in backedBy (used in send) - * @param[in] backupDataSizes The individual sizes of the snapshots acquired + * @param[in] backupDataSizes The individual sizes of the snapshots acquired * @param[in] sendData The local snapshot data as char vector * @param[out] recvData The complete snapshot datas of the ranks being backed */ diff --git a/src/parallel/tests/CollectiveCommunicationTest.cpp b/src/parallel/tests/CollectiveCommunicationTest.cpp index 65c42f093c..9ad7550415 100644 --- a/src/parallel/tests/CollectiveCommunicationTest.cpp +++ b/src/parallel/tests/CollectiveCommunicationTest.cpp @@ -16,7 +16,6 @@ TEST_SUITE_REGISTRATION(CollectiveCommunicationTest); -using namespace std; CollectiveCommunicationTest::CollectiveCommunicationTest() : _rank(0) { diff --git a/src/parallel/tests/CommunicationBufferTest.cpp b/src/parallel/tests/CommunicationBufferTest.cpp index f131e476fc..7d255ebd14 100644 --- a/src/parallel/tests/CommunicationBufferTest.cpp +++ b/src/parallel/tests/CommunicationBufferTest.cpp @@ -16,7 +16,6 @@ #include "ensemble/CanonicalEnsemble.h" #include -using namespace std; TEST_SUITE_REGISTRATION(CommunicationBufferTest); diff --git a/src/parallel/tests/KDDecompositionTest.cpp b/src/parallel/tests/KDDecompositionTest.cpp index e2caf93646..af0f67dcba 100644 --- a/src/parallel/tests/KDDecompositionTest.cpp +++ b/src/parallel/tests/KDDecompositionTest.cpp @@ -21,7 +21,6 @@ TEST_SUITE_REGISTRATION(KDDecompositionTest); -using namespace std; KDDecompositionTest::KDDecompositionTest() : _rank(0) { @@ -401,15 +400,15 @@ void KDDecompositionTest::testRebalancingDeadlocks() { fNew << "new_" << i << ".vtu"; newDecompRoot->plotNode(fNew.str()); - cout << "current coeffs: " << std::endl; - cout << setprecision(17); + std::cout << "current coeffs: " << std::endl; + std::cout << std::setprecision(17); for (double _currentCoeff : _currentCoeffs) { - cout << _currentCoeff << std::endl; + std::cout << _currentCoeff << std::endl; } - cout << std::endl; - cout << "old coeffs: " << std::endl; + std::cout << std::endl; + std::cout << "old coeffs: " << std::endl; for (double _oldCoeff : _oldCoeffs) { - cout << _oldCoeff << std::endl; + std::cout << _oldCoeff << std::endl; } } @@ -548,18 +547,18 @@ void KDDecompositionTest::clearNumParticlesPerCell(std::vector &v, void KDDecompositionTest::Write_VTK_Structured_Points(unsigned *A, int N[3], std::string& filename) const { std::ofstream ofs(filename, std::ios::out); - ofs << "# vtk DataFile Version 3.0" << endl; - ofs << "Laplace" << endl; - ofs << "ASCII" << endl; - ofs << "DATASET STRUCTURED_POINTS" << endl; - ofs << "DIMENSIONS " << N[0] << " " << N[1] << " " << N[2] << endl; - ofs << "ORIGIN 0 0 0"<< endl; - ofs << "SPACING 1 1 1" << endl; - ofs << "POINT_DATA " << N[0]*N[1]*N[2] << endl; - ofs << "SCALARS nMols int 1" << endl; - ofs << "LOOKUP_TABLE default" << endl; + ofs << "# vtk DataFile Version 3.0" << std::endl; + ofs << "Laplace" << std::endl; + ofs << "ASCII" << std::endl; + ofs << "DATASET STRUCTURED_POINTS" << std::endl; + ofs << "DIMENSIONS " << N[0] << " " << N[1] << " " << N[2] << std::endl; + ofs << "ORIGIN 0 0 0"<< std::endl; + ofs << "SPACING 1 1 1" << std::endl; + ofs << "POINT_DATA " << N[0]*N[1]*N[2] << std::endl; + ofs << "SCALARS nMols int 1" << std::endl; + ofs << "LOOKUP_TABLE default" << std::endl; for (int i = 0; i < N[0] * N[1] * N[2]; i++) { - ofs << A[i] << endl; + ofs << A[i] << std::endl; } ofs.close(); } diff --git a/src/parallel/tests/NeighborAcquirerTest.cpp b/src/parallel/tests/NeighborAcquirerTest.cpp index e6c1898341..34b1c37e4f 100644 --- a/src/parallel/tests/NeighborAcquirerTest.cpp +++ b/src/parallel/tests/NeighborAcquirerTest.cpp @@ -9,7 +9,6 @@ #include "NeighborAcquirerTest.h" #include "parallel/NeighborAcquirer.h" -using namespace std; TEST_SUITE_REGISTRATION(NeighborAcquirerTest); @@ -56,7 +55,7 @@ void NeighborAcquirerTest::testShiftIfNecessary() { shift[i] = 0.0; } } - + for(int i = 0; i < 3; i++) region.rmin[i] = -1.0; for(int i = 0; i < 3; i++) region.rmax[i] = 0.0; @@ -93,15 +92,15 @@ void NeighborAcquirerTest::testShiftIfNecessary() { ASSERT_EQUAL(regionsShiftsPair.first.size(), 8ul); } - - + + } void NeighborAcquirerTest::testOverlap() { // assume this one works for now, because you thought about it long and hard. HaloRegion region01; HaloRegion region02; - - for(int i = 0; i < 3; i++) { + + for(int i = 0; i < 3; i++) { region01.rmax[i] = 4.0; region01.rmin[i] = 2.0; region02.rmax[i] = 6.0; @@ -109,12 +108,12 @@ void NeighborAcquirerTest::testOverlap() { // assume this one works for now, bec } auto overlap = NeighborAcquirer::overlap(region01, region02); - + for(int i = 0; i < 3; i++) { ASSERT_EQUAL(overlap.rmax[i], 4.0); ASSERT_EQUAL(overlap.rmin[i], 3.0); } - + for(int i = 0; i < 3; i++) { region01.rmax[i] = 6.0; region01.rmin[i] = 2.0; @@ -123,49 +122,49 @@ void NeighborAcquirerTest::testOverlap() { // assume this one works for now, bec } overlap = NeighborAcquirer::overlap(region01, region02); - + for(int i = 0; i < 3; i++) { ASSERT_EQUAL(overlap.rmax[i], 5.0); ASSERT_EQUAL(overlap.rmin[i], 3.0); } - + for(int i = 0; i < 3; i++) { region01.rmax[i] = 4.0; region01.rmin[i] = 2.0; region02.rmax[i] = 3.0; region02.rmin[i] = 1.0; } - + overlap = NeighborAcquirer::overlap(region01, region02); - + for(int i = 0; i < 3; i++) { ASSERT_EQUAL(overlap.rmax[i], 3.0); ASSERT_EQUAL(overlap.rmin[i], 2.0); } - + for(int i = 0; i < 3; i++) { region01.rmax[i] = 4.0; region01.rmin[i] = 2.0; region02.rmax[i] = 6.0; region02.rmin[i] = 1.0; } - + overlap = NeighborAcquirer::overlap(region01, region02); - + for(int i = 0; i < 3; i++) { ASSERT_EQUAL(overlap.rmax[i], 4.0); ASSERT_EQUAL(overlap.rmin[i], 2.0); } - + for(int i = 0; i < 3; i++) { region01.rmax[i] = 6.0; region01.rmin[i] = 2.0; region02.rmax[i] = 6.0; region02.rmin[i] = 2.0; } - + overlap = NeighborAcquirer::overlap(region01, region02); - + for(int i = 0; i < 3; i++) { ASSERT_EQUAL(overlap.rmax[i], 6.0); ASSERT_EQUAL(overlap.rmin[i], 2.0); @@ -175,68 +174,68 @@ void NeighborAcquirerTest::testOverlap() { // assume this one works for now, bec void NeighborAcquirerTest::testIOwnThis() { // i own a part of this HaloRegion region01; HaloRegion region02; - - for(int i = 0; i < 3; i++) { + + for(int i = 0; i < 3; i++) { region01.rmax[i] = 4.0; region01.rmin[i] = 2.0; region02.rmax[i] = 6.0; region02.rmin[i] = 3.0; } - + ASSERT_EQUAL(NeighborAcquirer::isIncluded(®ion01, ®ion02), true); - + for(int i = 0; i < 3; i++) { region01.rmax[i] = 6.0; region01.rmin[i] = 2.0; region02.rmax[i] = 5.0; region02.rmin[i] = 3.0; } - + ASSERT_EQUAL(NeighborAcquirer::isIncluded(®ion01, ®ion02), true); - + for(int i = 0; i < 3; i++) { region01.rmax[i] = 4.0; region01.rmin[i] = 2.0; region02.rmax[i] = 3.0; region02.rmin[i] = 1.0; } - + ASSERT_EQUAL(NeighborAcquirer::isIncluded(®ion01, ®ion02), true); - + for(int i = 0; i < 3; i++) { region01.rmax[i] = 4.0; region01.rmin[i] = 2.0; region02.rmax[i] = 6.0; region02.rmin[i] = 1.0; } - + ASSERT_EQUAL(NeighborAcquirer::isIncluded(®ion01, ®ion02), true); - + for(int i = 0; i < 3; i++) { region01.rmax[i] = 6.0; region01.rmin[i] = 2.0; region02.rmax[i] = 6.0; region02.rmin[i] = 2.0; } - + ASSERT_EQUAL(NeighborAcquirer::isIncluded(®ion01, ®ion02), true); - + for(int i = 0; i < 3; i++) { region01.rmax[i] = 5.0; region01.rmin[i] = 1.0; } - + region02.rmax[0] = 6.0; region02.rmax[1] = 7.0; region02.rmax[2] = 5.0; - + region02.rmin[0] = 5.0; region02.rmin[1] = 6.0; region02.rmin[2] = 5.0; - + ASSERT_EQUAL(NeighborAcquirer::isIncluded(®ion01, ®ion02), false); - - + + } void NeighborAcquirerTest::testCorrectNeighborAcquisition() { @@ -293,4 +292,4 @@ void NeighborAcquirerTest::testCorrectNeighborAcquisition() { } } } -} \ No newline at end of file +} diff --git a/src/parallel/tests/NeighborAcquirerTest.h b/src/parallel/tests/NeighborAcquirerTest.h index 11186a7341..184d257ac0 100644 --- a/src/parallel/tests/NeighborAcquirerTest.h +++ b/src/parallel/tests/NeighborAcquirerTest.h @@ -14,14 +14,14 @@ class NeighborAcquirerTest : public utils::TestWithSimulationSetup { - + TEST_SUITE(NeighborAcquirerTest); TEST_METHOD(testShiftIfNecessary); TEST_METHOD(testOverlap); TEST_METHOD(testIOwnThis); TEST_METHOD(testCorrectNeighborAcquisition); TEST_SUITE_END(); - + public: NeighborAcquirerTest(); ~NeighborAcquirerTest(); diff --git a/src/particleContainer/AutoPasContainer.cpp b/src/particleContainer/AutoPasContainer.cpp index 97b5cefbb3..6baec85f95 100644 --- a/src/particleContainer/AutoPasContainer.cpp +++ b/src/particleContainer/AutoPasContainer.cpp @@ -143,20 +143,20 @@ AutoPasContainer::AutoPasContainer(double cutoff) : _cutoff(cutoff), _particlePr #ifdef ENABLE_MPI std::stringstream logFileName, outputSuffix; - auto timeNow = chrono::system_clock::now(); + auto timeNow = std::chrono::system_clock::now(); auto time_tNow = std::chrono::system_clock::to_time_t(timeNow); auto maxRank = global_simulation->domainDecomposition().getNumProcs(); auto numDigitsMaxRank = std::to_string(maxRank).length(); auto myRank = global_simulation->domainDecomposition().getRank(); - logFileName << "AutoPas_Rank" << setfill('0') << setw(numDigitsMaxRank) << myRank << "_" + logFileName << "AutoPas_Rank" << std::setfill('0') << std::setw(numDigitsMaxRank) << myRank << "_" << std::put_time(std::localtime(&time_tNow), "%Y-%m-%d_%H-%M-%S") << ".log"; _logFile.open(logFileName.str()); _autopasContainer = decltype(_autopasContainer)(_logFile); - outputSuffix << "Rank" << setfill('0') << setw(numDigitsMaxRank) << myRank << "_"; + outputSuffix << "Rank" << std::setfill('0') << std::setw(numDigitsMaxRank) << myRank << "_"; _autopasContainer.setOutputSuffix(outputSuffix.str()); #endif } @@ -181,9 +181,9 @@ auto parseAutoPasOption(XMLfileUnits &xmlconfig, const std::string &xmlString, try { return OptionType::parseOptions(stringInXml); } catch (const std::exception &e) { - global_log->error() << "AutoPasContainer: error when parsing " << xmlString << ":" << std::endl; - global_log->error() << e.what() << std::endl; - global_log->error() << "Possible options: " + Log::global_log->error() << "AutoPasContainer: error when parsing " << xmlString << ":" << std::endl; + Log::global_log->error() << e.what() << std::endl; + Log::global_log->error() << "Possible options: " << autopas::utils::ArrayUtils::to_string(OptionType::getAllOptions()) << std::endl; Simulation::exit(4432); // dummy return @@ -192,7 +192,7 @@ auto parseAutoPasOption(XMLfileUnits &xmlconfig, const std::string &xmlString, } void AutoPasContainer::readXML(XMLfileUnits &xmlconfig) { - string oldPath(xmlconfig.getcurrentnodepath()); + std::string oldPath(xmlconfig.getcurrentnodepath()); // if any option is not specified in the XML use the autopas defaults // get option values from xml @@ -238,7 +238,7 @@ void AutoPasContainer::readXML(XMLfileUnits &xmlconfig) { } else if (vlSkinPerTimestep == -1 ){ _verletSkin = vlSkin; } else { - global_log->error() << "Input XML specifies skin AND skinPerTimestep. Please choose only one." << std::endl; + Log::global_log->error() << "Input XML specifies skin AND skinPerTimestep. Please choose only one." << std::endl; } _relativeOptimumRange = xmlconfig.getNodeValue_double("optimumRange", _relativeOptimumRange); _relativeBlacklistRange = xmlconfig.getNodeValue_double("blacklistRange", _relativeBlacklistRange); @@ -254,21 +254,21 @@ void AutoPasContainer::readXML(XMLfileUnits &xmlconfig) { } if (functorChoiceStr.find("avx") != std::string::npos) { functorOption = FunctorOption::AVX; - global_log->info() << "Selected AVX Functor." << std::endl; + Log::global_log->info() << "Selected AVX Functor." << std::endl; #ifndef __AVX__ - global_log->warning() << "Selected AVX Functor but AVX is not supported! Switching to autoVec functor." << std::endl; + Log::global_log->warning() << "Selected AVX Functor but AVX is not supported! Switching to autoVec functor." << std::endl; functorOption = FunctorOption::autoVec; #endif } else if (functorChoiceStr.find("sve") != std::string::npos) { functorOption = FunctorOption::SVE; - global_log->info() << "Selected SVE Functor." << std::endl; + Log::global_log->info() << "Selected SVE Functor." << std::endl; #ifndef __ARM_FEATURE_SVE - global_log->warning() << "Selected SVE Functor but SVE is not supported! Switching to autoVec functor." << std::endl; + Log::global_log->warning() << "Selected SVE Functor but SVE is not supported! Switching to autoVec functor." << std::endl; functorOption = FunctorOption::autoVec; #endif } else { functorOption = FunctorOption::autoVec; - global_log->info() << "Selected autoVec Functor." << std::endl; + Log::global_log->info() << "Selected autoVec Functor." << std::endl; } @@ -332,49 +332,49 @@ bool AutoPasContainer::rebuild(double *bBoxMin, double *bBoxMax) { // print full configuration to the command line int valueOffset = 28; - global_log->info() << "AutoPas configuration:" << endl - << setw(valueOffset) << left << "Data Layout " + Log::global_log->info() << "AutoPas configuration:" << std::endl + << std::setw(valueOffset) << std::left << "Data Layout " << ": " << autopas::utils::ArrayUtils::to_string(_autopasContainer.getAllowedDataLayouts()) - << endl - << setw(valueOffset) << left << "Container " + << std::endl + << std::setw(valueOffset) << std::left << "Container " << ": " << autopas::utils::ArrayUtils::to_string(_autopasContainer.getAllowedContainers()) - << endl - << setw(valueOffset) << left << "Cell size Factor " - << ": " << _autopasContainer.getAllowedCellSizeFactors() << endl - << setw(valueOffset) << left << "Traversals " + << std::endl + << std::setw(valueOffset) << std::left << "Cell size Factor " + << ": " << _autopasContainer.getAllowedCellSizeFactors() << std::endl + << std::setw(valueOffset) << std::left << "Traversals " << ": " << autopas::utils::ArrayUtils::to_string(_autopasContainer.getAllowedTraversals()) - << endl - << setw(valueOffset) << left << "Newton3" + << std::endl + << std::setw(valueOffset) << std::left << "Newton3" << ": " << autopas::utils::ArrayUtils::to_string(_autopasContainer.getAllowedNewton3Options()) - << endl - << setw(valueOffset) << left << "Tuning strategy " - << ": " << _autopasContainer.getTuningStrategyOption() << endl - << setw(valueOffset) << left << "Selector strategy " - << ": " << _autopasContainer.getSelectorStrategy() << endl - << setw(valueOffset) << left << "Tuning frequency" - << ": " << _autopasContainer.getTuningInterval() << endl - << setw(valueOffset) << left << "Number of samples " - << ": " << _autopasContainer.getNumSamples() << endl - << setw(valueOffset) << left << "Tuning Acquisition Function" - << ": " << _autopasContainer.getAcquisitionFunction() << endl - << setw(valueOffset) << left << "Number of evidence " - << ": " << _autopasContainer.getMaxEvidence() << endl - << setw(valueOffset) << left << "Verlet Cluster size " - << ": " << _autopasContainer.getVerletClusterSize() << endl - << setw(valueOffset) << left << "Rebuild frequency " - << ": " << _autopasContainer.getVerletRebuildFrequency() << endl - << setw(valueOffset) << left << "Verlet Skin " - << ": " << _autopasContainer.getVerletSkin() << endl - << setw(valueOffset) << left << "Optimum Range " - << ": " << _autopasContainer.getRelativeOptimumRange() << endl - << setw(valueOffset) << left << "Tuning Phases without test " - << ": " << _autopasContainer.getMaxTuningPhasesWithoutTest() << endl - << setw(valueOffset) << left << "Blacklist Range " - << ": " << _autopasContainer.getRelativeBlacklistRange() << endl - << setw(valueOffset) << left << "Evidence for prediction " - << ": " << _autopasContainer.getEvidenceFirstPrediction() << endl - << setw(valueOffset) << left << "Extrapolation method " - << ": " << _autopasContainer.getExtrapolationMethodOption() << endl; + << std::endl + << std::setw(valueOffset) << std::left << "Tuning strategy " + << ": " << _autopasContainer.getTuningStrategyOption() << std::endl + << std::setw(valueOffset) << std::left << "Selector strategy " + << ": " << _autopasContainer.getSelectorStrategy() << std::endl + << std::setw(valueOffset) << std::left << "Tuning frequency" + << ": " << _autopasContainer.getTuningInterval() << std::endl + << std::setw(valueOffset) << std::left << "Number of samples " + << ": " << _autopasContainer.getNumSamples() << std::endl + << std::setw(valueOffset) << std::left << "Tuning Acquisition Function" + << ": " << _autopasContainer.getAcquisitionFunction() << std::endl + << std::setw(valueOffset) << std::left << "Number of evidence " + << ": " << _autopasContainer.getMaxEvidence() << std::endl + << std::setw(valueOffset) << std::left << "Verlet Cluster size " + << ": " << _autopasContainer.getVerletClusterSize() << std::endl + << std::setw(valueOffset) << std::left << "Rebuild frequency " + << ": " << _autopasContainer.getVerletRebuildFrequency() << std::endl + << std::setw(valueOffset) << std::left << "Verlet Skin " + << ": " << _autopasContainer.getVerletSkin() << std::endl + << std::setw(valueOffset) << std::left << "Optimum Range " + << ": " << _autopasContainer.getRelativeOptimumRange() << std::endl + << std::setw(valueOffset) << std::left << "Tuning Phases without test " + << ": " << _autopasContainer.getMaxTuningPhasesWithoutTest() << std::endl + << std::setw(valueOffset) << std::left << "Blacklist Range " + << ": " << _autopasContainer.getRelativeBlacklistRange() << std::endl + << std::setw(valueOffset) << std::left << "Evidence for prediction " + << ": " << _autopasContainer.getEvidenceFirstPrediction() << std::endl + << std::setw(valueOffset) << std::left << "Extrapolation method " + << ": " << _autopasContainer.getExtrapolationMethodOption() << std::endl; /// @todo return sendHaloAndLeavingTogether, (always false) for simplicity. return false; @@ -383,7 +383,7 @@ bool AutoPasContainer::rebuild(double *bBoxMin, double *bBoxMax) { void AutoPasContainer::update() { // in case we update the container before handling the invalid particles, this might lead to lost particles. if (not _invalidParticles.empty()) { - global_log->error() << "AutoPasContainer: trying to update container, even though invalidParticles still " + Log::global_log->error() << "AutoPasContainer: trying to update container, even though invalidParticles still " "exist. This would lead to lost particles => ERROR!\n" "Remaining invalid particles:\n" << autopas::utils::ArrayUtils::to_string(_invalidParticles, "\n", {"", ""}) @@ -449,7 +449,7 @@ void AutoPasContainer::traverseTemplateHelper() { bool useMixing = not allSame; if (useMixing) { - global_log->debug() << "AutoPasContainer: Using mixing." << std::endl; + Log::global_log->debug() << "AutoPasContainer: Using mixing." << std::endl; switch (functorOption) { case FunctorOption::SVE: { #ifdef __ARM_FEATURE_SVE @@ -491,7 +491,7 @@ void AutoPasContainer::traverseTemplateHelper() { } } } else { - global_log->debug() << "AutoPasContainer: Not using mixing." << std::endl; + Log::global_log->debug() << "AutoPasContainer: Not using mixing." << std::endl; switch (functorOption) { case FunctorOption::SVE: { #ifdef __ARM_FEATURE_SVE @@ -563,7 +563,7 @@ void AutoPasContainer::traverseCells(CellProcessor &cellProcessor) { double ls1Shift6 = c.ljcenter(0).shift6(); if (std::fabs((autoPasShift6 - ls1Shift6) / ls1Shift6) > 1.e-10) { // warn if shift differs relatively by more than 1.e-10 - global_log->warning() << "Dangerous shift6 detected: AutoPas will use: " << autoPasShift6 + Log::global_log->warning() << "Dangerous shift6 detected: AutoPas will use: " << autoPasShift6 << ", while normal ls1 mode uses: " << ls1Shift6 << std::endl << "Please check that your shifts are calculated correctly." << std::endl; } @@ -585,7 +585,7 @@ void AutoPasContainer::traverseCells(CellProcessor &cellProcessor) { } } else { - global_log->warning() << "only lj functors are supported for traversals." << std::endl; + Log::global_log->warning() << "only lj functors are supported for traversals." << std::endl; } } @@ -609,7 +609,7 @@ unsigned long AutoPasContainer::getNumberOfParticles(ParticleIterator::Type t /* void AutoPasContainer::clear() { _autopasContainer.deleteAllParticles(); } void AutoPasContainer::deleteOuterParticles() { - global_log->info() << "deleting outer particles by using forced update" << std::endl; + Log::global_log->info() << "deleting outer particles by using forced update" << std::endl; auto invalidParticles = _autopasContainer.updateContainer(); if (not invalidParticles.empty()) { throw std::runtime_error( diff --git a/src/particleContainer/AutoPasTemplateInstantiations/iteratePairwiseLJFunctorAVXNoShiftMix.cpp b/src/particleContainer/AutoPasTemplateInstantiations/iteratePairwiseLJFunctorAVXNoShiftMix.cpp index 709d42f7e1..be339b752a 100644 --- a/src/particleContainer/AutoPasTemplateInstantiations/iteratePairwiseLJFunctorAVXNoShiftMix.cpp +++ b/src/particleContainer/AutoPasTemplateInstantiations/iteratePairwiseLJFunctorAVXNoShiftMix.cpp @@ -19,4 +19,4 @@ template bool autopas::AutoPas::iteratePairwise( /*calculateGlobals*/ true> *); //! @endcond -#endif \ No newline at end of file +#endif diff --git a/src/particleContainer/AutoPasTemplateInstantiations/iteratePairwiseLJFunctorAVXNoShiftNoMix.cpp b/src/particleContainer/AutoPasTemplateInstantiations/iteratePairwiseLJFunctorAVXNoShiftNoMix.cpp index b8004072bd..ee7dff515e 100644 --- a/src/particleContainer/AutoPasTemplateInstantiations/iteratePairwiseLJFunctorAVXNoShiftNoMix.cpp +++ b/src/particleContainer/AutoPasTemplateInstantiations/iteratePairwiseLJFunctorAVXNoShiftNoMix.cpp @@ -19,4 +19,4 @@ template bool autopas::AutoPas::iteratePairwise( /*calculateGlobals*/ true> *); //! @endcond -#endif \ No newline at end of file +#endif diff --git a/src/particleContainer/AutoPasTemplateInstantiations/iteratePairwiseLJFunctorAVXShiftMix.cpp b/src/particleContainer/AutoPasTemplateInstantiations/iteratePairwiseLJFunctorAVXShiftMix.cpp index b9cce6736d..c57f21b34c 100644 --- a/src/particleContainer/AutoPasTemplateInstantiations/iteratePairwiseLJFunctorAVXShiftMix.cpp +++ b/src/particleContainer/AutoPasTemplateInstantiations/iteratePairwiseLJFunctorAVXShiftMix.cpp @@ -19,4 +19,4 @@ template bool autopas::AutoPas::iteratePairwise( /*calculateGlobals*/ true> *); //! @endcond -#endif \ No newline at end of file +#endif diff --git a/src/particleContainer/AutoPasTemplateInstantiations/iteratePairwiseLJFunctorAVXShiftNoMix.cpp b/src/particleContainer/AutoPasTemplateInstantiations/iteratePairwiseLJFunctorAVXShiftNoMix.cpp index 8a62487a10..c609423d27 100644 --- a/src/particleContainer/AutoPasTemplateInstantiations/iteratePairwiseLJFunctorAVXShiftNoMix.cpp +++ b/src/particleContainer/AutoPasTemplateInstantiations/iteratePairwiseLJFunctorAVXShiftNoMix.cpp @@ -19,4 +19,4 @@ template bool autopas::AutoPas::iteratePairwise( /*calculateGlobals*/ true> *); //! @endcond -#endif \ No newline at end of file +#endif diff --git a/src/particleContainer/AutoPasTemplateInstantiations/iteratePairwiseLJFunctorSVENoShiftNoMix.cpp b/src/particleContainer/AutoPasTemplateInstantiations/iteratePairwiseLJFunctorSVENoShiftNoMix.cpp index 9a9b747f75..b06ee386ea 100644 --- a/src/particleContainer/AutoPasTemplateInstantiations/iteratePairwiseLJFunctorSVENoShiftNoMix.cpp +++ b/src/particleContainer/AutoPasTemplateInstantiations/iteratePairwiseLJFunctorSVENoShiftNoMix.cpp @@ -19,4 +19,4 @@ template bool autopas::AutoPas::iteratePairwise( /*calculateGlobals*/ true> *); //! @endcond -#endif \ No newline at end of file +#endif diff --git a/src/particleContainer/AutoPasTemplateInstantiations/iteratePairwiseLJFunctorSVEShiftMix.cpp b/src/particleContainer/AutoPasTemplateInstantiations/iteratePairwiseLJFunctorSVEShiftMix.cpp index d73e97647d..dbed925f86 100644 --- a/src/particleContainer/AutoPasTemplateInstantiations/iteratePairwiseLJFunctorSVEShiftMix.cpp +++ b/src/particleContainer/AutoPasTemplateInstantiations/iteratePairwiseLJFunctorSVEShiftMix.cpp @@ -19,4 +19,4 @@ template bool autopas::AutoPas::iteratePairwise( /*calculateGlobals*/ true> *); //! @endcond -#endif \ No newline at end of file +#endif diff --git a/src/particleContainer/AutoPasTemplateInstantiations/iteratePairwiseLJFunctorSVEShiftNoMix.cpp b/src/particleContainer/AutoPasTemplateInstantiations/iteratePairwiseLJFunctorSVEShiftNoMix.cpp index 5291da9652..f50315a46b 100644 --- a/src/particleContainer/AutoPasTemplateInstantiations/iteratePairwiseLJFunctorSVEShiftNoMix.cpp +++ b/src/particleContainer/AutoPasTemplateInstantiations/iteratePairwiseLJFunctorSVEShiftNoMix.cpp @@ -19,4 +19,4 @@ template bool autopas::AutoPas::iteratePairwise( /*calculateGlobals*/ true> *); //! @endcond -#endif \ No newline at end of file +#endif diff --git a/src/particleContainer/Cell.h b/src/particleContainer/Cell.h index ea14746fff..565ac7a20b 100644 --- a/src/particleContainer/Cell.h +++ b/src/particleContainer/Cell.h @@ -4,7 +4,7 @@ class Cell { public: Cell() : _cellIndex(0) {} - + virtual ~Cell() {} virtual void assignCellToHaloRegion() = 0; diff --git a/src/particleContainer/FullParticleCell.cpp b/src/particleContainer/FullParticleCell.cpp index 2fecf86932..4a9f37c1de 100644 --- a/src/particleContainer/FullParticleCell.cpp +++ b/src/particleContainer/FullParticleCell.cpp @@ -14,7 +14,6 @@ #include "utils/mardyn_assert.h" #include -using namespace std; FullParticleCell::FullParticleCell() : _molecules(), _cellDataSoA(0, 0, 0, 0, 0) { diff --git a/src/particleContainer/LinkedCellTraversals/C08BasedTraversals.h b/src/particleContainer/LinkedCellTraversals/C08BasedTraversals.h index 5fd3fcc8d4..6cf2138705 100644 --- a/src/particleContainer/LinkedCellTraversals/C08BasedTraversals.h +++ b/src/particleContainer/LinkedCellTraversals/C08BasedTraversals.h @@ -65,7 +65,7 @@ void C08BasedTraversals::processBaseCell(CellProcessor& cellProces const int num_pairs = _cellPairOffsets8Pack.size(); for(int j = 0; j < num_pairs; ++j) { - pair current_pair = _cellPairOffsets8Pack[j]; + std::pair current_pair = _cellPairOffsets8Pack[j]; unsigned offset1 = current_pair.first; unsigned cellIndex1 = baseIndex + offset1; @@ -119,21 +119,21 @@ void C08BasedTraversals::computeOffsets() { int i = 0; // if incrementing along X, the following order will be more cache-efficient: - _cellPairOffsets8Pack[i++] = make_pair(o, o ); - _cellPairOffsets8Pack[i++] = make_pair(o, y ); - _cellPairOffsets8Pack[i++] = make_pair(y, z ); - _cellPairOffsets8Pack[i++] = make_pair(o, z ); - _cellPairOffsets8Pack[i++] = make_pair(o, yz ); - - _cellPairOffsets8Pack[i++] = make_pair(x, yz ); - _cellPairOffsets8Pack[i++] = make_pair(x, y ); - _cellPairOffsets8Pack[i++] = make_pair(x, z ); - _cellPairOffsets8Pack[i++] = make_pair(o, x ); - _cellPairOffsets8Pack[i++] = make_pair(o, xy ); - _cellPairOffsets8Pack[i++] = make_pair(xy, z ); - _cellPairOffsets8Pack[i++] = make_pair(y, xz ); - _cellPairOffsets8Pack[i++] = make_pair(o, xz ); - _cellPairOffsets8Pack[i++] = make_pair(o, xyz); + _cellPairOffsets8Pack[i++] = std::make_pair(o, o ); + _cellPairOffsets8Pack[i++] = std::make_pair(o, y ); + _cellPairOffsets8Pack[i++] = std::make_pair(y, z ); + _cellPairOffsets8Pack[i++] = std::make_pair(o, z ); + _cellPairOffsets8Pack[i++] = std::make_pair(o, yz ); + + _cellPairOffsets8Pack[i++] = std::make_pair(x, yz ); + _cellPairOffsets8Pack[i++] = std::make_pair(x, y ); + _cellPairOffsets8Pack[i++] = std::make_pair(x, z ); + _cellPairOffsets8Pack[i++] = std::make_pair(o, x ); + _cellPairOffsets8Pack[i++] = std::make_pair(o, xy ); + _cellPairOffsets8Pack[i++] = std::make_pair(xy, z ); + _cellPairOffsets8Pack[i++] = std::make_pair(y, xz ); + _cellPairOffsets8Pack[i++] = std::make_pair(o, xz ); + _cellPairOffsets8Pack[i++] = std::make_pair(o, xyz); i = 0; _cellOffsets8Pack[i++] = o; diff --git a/src/particleContainer/LinkedCellTraversals/C08CellPairTraversal.h b/src/particleContainer/LinkedCellTraversals/C08CellPairTraversal.h index 6d64fc24f3..b14cc74f54 100644 --- a/src/particleContainer/LinkedCellTraversals/C08CellPairTraversal.h +++ b/src/particleContainer/LinkedCellTraversals/C08CellPairTraversal.h @@ -47,8 +47,8 @@ void C08CellPairTraversal::traverseCellPairs( CellProcessor& cellProcessor) { using std::array; - const array strides = { 2, 2, 2 }; - array end; + const std::array strides = { 2, 2, 2 }; + std::array end; for (int d = 0; d < 3; ++d) { end[d] = this->_dims[d] - 1; } @@ -78,13 +78,13 @@ template void C08CellPairTraversal::traverseCellPairsOuter( CellProcessor& cellProcessor) { if(eighthShell){ - global_log->error() << "eightshell + overlapping not yet supported." << std::endl; + Log::global_log->error() << "eightshell + overlapping not yet supported." << std::endl; Simulation::exit(-2); } using std::array; { - unsigned long minsize = min(this->_dims[0], min(this->_dims[1], this->_dims[2])); + unsigned long minsize = std::min(this->_dims[0], std::min(this->_dims[1], this->_dims[2])); if (minsize <= 5) { // iterating in the inner region didn't do anything. Iterate normally. @@ -93,7 +93,7 @@ void C08CellPairTraversal::traverseCellPairsOuter( } } - const array strides2 = { 2, 2, 2 }; + const std::array strides2 = { 2, 2, 2 }; #if defined(_OPENMP) #pragma omp parallel @@ -101,26 +101,26 @@ void C08CellPairTraversal::traverseCellPairsOuter( { for (unsigned long col = 0; col < 8; ++col) { // halo & boundaries in z direction - const array< unsigned long, 3> begin = threeDimensionalMapping::oneToThreeD(col, strides2); + const std::array< unsigned long, 3> begin = threeDimensionalMapping::oneToThreeD(col, strides2); // values, which are modified by 2 are actually modified by the respective stride, which is always 2 - array startZ = { begin[0], begin[1], begin[2] }; // default - array endZ = { this->_dims[0] - 1, this->_dims[1] - 1, this->_dims[2] - 1 }; // default - array stridesZ = {strides2[0], strides2[1], this->_dims[2] - 3}; // mod z + std::array startZ = { begin[0], begin[1], begin[2] }; // default + std::array endZ = { this->_dims[0] - 1, this->_dims[1] - 1, this->_dims[2] - 1 }; // default + std::array stridesZ = {strides2[0], strides2[1], this->_dims[2] - 3}; // mod z traverseCellPairsBackend(cellProcessor, startZ, endZ, stridesZ); // halo & boundaries in y direction // boundaries in z direction are excluded! - array startY = { begin[0], begin[1], begin[2] + 2 }; // mod z - array endY = { this->_dims[0] - 1, this->_dims[1] - 1, this->_dims[2] - 3 }; // mod z - array stridesY = {strides2[0], this->_dims[1] - 3, strides2[2]}; // mod y + std::array startY = { begin[0], begin[1], begin[2] + 2 }; // mod z + std::array endY = { this->_dims[0] - 1, this->_dims[1] - 1, this->_dims[2] - 3 }; // mod z + std::array stridesY = {strides2[0], this->_dims[1] - 3, strides2[2]}; // mod y traverseCellPairsBackend(cellProcessor, startY, endY, stridesY); // halo & boundaries in x direction // boundaries in z and y direction are excluded! - array startX = { begin[0], begin[1] + 2, begin[2] + 2 }; // mod yz - array endX = { this->_dims[0] - 1, this->_dims[1] - 3, this->_dims[2] - 3 }; // mod yz - array stridesX = {this->_dims[0] - 3, strides2[1], strides2[2]}; // mod x + std::array startX = { begin[0], begin[1] + 2, begin[2] + 2 }; // mod yz + std::array endX = { this->_dims[0] - 1, this->_dims[1] - 3, this->_dims[2] - 3 }; // mod yz + std::array stridesX = {this->_dims[0] - 3, strides2[1], strides2[2]}; // mod x traverseCellPairsBackend(cellProcessor, startX, endX, stridesX); #if defined(_OPENMP) @@ -149,7 +149,7 @@ void C08CellPairTraversal::traverseCellPairsInner( } } unsigned long splitsize = maxcellsize - 5; - unsigned long minsize = min(this->_dims[0], min(this->_dims[1], this->_dims[2])); + unsigned long minsize = std::min(this->_dims[0], std::min(this->_dims[1], this->_dims[2])); mardyn_assert(minsize >= 4); // there should be at least 4 cells in each dimension, otherwise we did something stupid! @@ -157,8 +157,8 @@ void C08CellPairTraversal::traverseCellPairsInner( return; // we can not iterate over any inner cells, that do not depend on boundary or halo cells } - array lower; - array upper; + std::array lower; + std::array upper; for (unsigned long i = 0; i < 3; i++) { lower[i] = 2; upper[i] = this->_dims[i] - 3; @@ -171,10 +171,10 @@ void C08CellPairTraversal::traverseCellPairsInner( #pragma omp parallel #endif { - array strides = {2, 2, 2}; + std::array strides = {2, 2, 2}; for (unsigned long col = 0; col < 8; ++col) { - array startIndices = threeDimensionalMapping::oneToThreeD(col, strides); + std::array startIndices = threeDimensionalMapping::oneToThreeD(col, strides); for (int i = 0; i < 3; i++) { startIndices[i] = startIndices[i] + lower[i]; } diff --git a/src/particleContainer/LinkedCellTraversals/MidpointTraversal.h b/src/particleContainer/LinkedCellTraversals/MidpointTraversal.h index e9466a4dd7..7531c68371 100644 --- a/src/particleContainer/LinkedCellTraversals/MidpointTraversal.h +++ b/src/particleContainer/LinkedCellTraversals/MidpointTraversal.h @@ -143,17 +143,17 @@ void MidpointTraversal::computeOffsets3D() { // process only half of the faces to get no pair twice for(int i=0; i<3; ++i){ // faces int j = (i+3)%6; - _offsets3D[index++] = make_pair(_faces[i], _faces[j]); + _offsets3D[index++] = std::make_pair(_faces[i], _faces[j]); } // process only half of the edges to get no pair twice for(int i=0; i<6; ++i){ // edges int j = (i+6)%12; - _offsets3D[index++] = make_pair(_edges[i], _edges[j]); + _offsets3D[index++] = std::make_pair(_edges[i], _edges[j]); } // process only half of the corners to get no pair twice for(int i=0; i<4; ++i){ // corners int j = (i+4)%8; - _offsets3D[index++] = make_pair(_corners[i], _corners[j]); + _offsets3D[index++] = std::make_pair(_corners[i], _corners[j]); } mardyn_assert(index == 13); @@ -243,14 +243,14 @@ void MidpointTraversal::pairOriginWithForwardNeighbors(int& index) for(long y=-1; y<=1; ++y){ // 3 * 4 for(long x=-1; x<=1; ++x){ // 3 - _offsets3D[index++] = make_pair(origin, std::array{x, y, 1l}); + _offsets3D[index++] = std::make_pair(origin, std::array{x, y, 1l}); } // 1st - _offsets3D[index++] = make_pair(origin, std::array{1l, y, 0l}); + _offsets3D[index++] = std::make_pair(origin, std::array{1l, y, 0l}); } // 13th - _offsets3D[index++] = make_pair(origin, std::array{0l, 1l, 0l}); + _offsets3D[index++] = std::make_pair(origin, std::array{0l, 1l, 0l}); } diff --git a/src/particleContainer/LinkedCellTraversals/NeutralTerritoryTraversal.h b/src/particleContainer/LinkedCellTraversals/NeutralTerritoryTraversal.h index 7b23511acf..6ea14ff247 100644 --- a/src/particleContainer/LinkedCellTraversals/NeutralTerritoryTraversal.h +++ b/src/particleContainer/LinkedCellTraversals/NeutralTerritoryTraversal.h @@ -124,14 +124,14 @@ void NeutralTerritoryTraversal::traverseCellPairs(CellProcessor& c template void NeutralTerritoryTraversal::traverseCellPairsOuter(CellProcessor& cellProcessor) { - global_log->error() << "NT: overlapping Comm not implemented." << std::endl; + Log::global_log->error() << "NT: overlapping Comm not implemented." << std::endl; Simulation::exit(46); } template void NeutralTerritoryTraversal::traverseCellPairsInner(CellProcessor& cellProcessor, unsigned stage, unsigned stageCount) { - global_log->error() << "NT: overlapping Comm not implemented." << std::endl; + Log::global_log->error() << "NT: overlapping Comm not implemented." << std::endl; Simulation::exit(47); } diff --git a/src/particleContainer/LinkedCellTraversals/OriginalCellPairTraversal.h b/src/particleContainer/LinkedCellTraversals/OriginalCellPairTraversal.h index 5ddffb7388..3fa7498af6 100644 --- a/src/particleContainer/LinkedCellTraversals/OriginalCellPairTraversal.h +++ b/src/particleContainer/LinkedCellTraversals/OriginalCellPairTraversal.h @@ -74,7 +74,7 @@ void OriginalCellPairTraversal::rebuild(std::vector } } } else { - global_log->error() << "OriginalCellPairTraversalDat::rebuild was called with incompatible Traversal data!" << endl; + Log::global_log->error() << "OriginalCellPairTraversalDat::rebuild was called with incompatible Traversal data!" << std::endl; Simulation::exit(-1); } } diff --git a/src/particleContainer/LinkedCellTraversals/QuickschedTraversal.h b/src/particleContainer/LinkedCellTraversals/QuickschedTraversal.h index c94dc2f589..829ba57ecf 100644 --- a/src/particleContainer/LinkedCellTraversals/QuickschedTraversal.h +++ b/src/particleContainer/LinkedCellTraversals/QuickschedTraversal.h @@ -17,7 +17,6 @@ #include "quicksched.h" #endif -using Log::global_log; struct QuickschedTraversalData : CellPairTraversalData { std::array taskBlockSize; @@ -52,7 +51,7 @@ class QuickschedTraversal : public C08BasedTraversals { static void runner(int type, void *data); - array _taskBlocksize; + std::array _taskBlocksize; CellProcessor *_contextCellProcessor; struct qsched *_scheduler; @@ -69,7 +68,7 @@ QuickschedTraversal::QuickschedTraversal(std::vector _contextCellProcessor(nullptr), _scheduler(new struct qsched), _taskTypeSelector(PackedAdjustable) { - mardyn_assert((is_base_of::value)); + mardyn_assert((std::is_base_of::value)); qsched_init(_scheduler, mardyn_get_max_threads(), qsched_flag_none); } @@ -88,7 +87,7 @@ void QuickschedTraversal::rebuild(std::vector &cells _taskBlocksize = qui_data->taskBlockSize; init(); } else { - global_log->error() << "QuickschedTraversal::rebuild was called with incompatible Traversal data!" << endl; + Log::global_log->error() << "QuickschedTraversal::rebuild was called with incompatible Traversal data!" << std::endl; } #endif /* QUICKSCHED */ } @@ -100,23 +99,23 @@ void QuickschedTraversal::init() { qsched_task_t taskId; unsigned long cellIndex; // macro for easier access and to avoid aliasing -//#define m_cells (*((vector *)(this->_cells))) -// vector m_cells = *(dynamic_cast *>(this->_cells)); - vector m_cells = *((vector *)(this->_cells)); +//#define m_cells (*((std::vector *)(this->_cells))) +// std::vector m_cells = *(dynamic_cast *>(this->_cells)); + std::vector m_cells = *((std::vector *)(this->_cells)); switch (_taskTypeSelector) { case PackedAdjustable: { // check that blocksize is within domain size for (int i = 0; i < 3; ++i) { if (_taskBlocksize[i] > this->_dims[i]) { - global_log->error() << "Blocksize is bigger than number of cells in dimension " + Log::global_log->error() << "Blocksize is bigger than number of cells in dimension " << (char) ('x' + i) << ". (" << _taskBlocksize[i] << " > " << this->_dims[i] << ")" << std::endl; Simulation::exit(1); } } - global_log->info() << "Generating resource and task ids" << std::endl; + Log::global_log->info() << "Generating resource and task ids" << std::endl; for (unsigned long z = 0; z < this->_dims[2]; ++z) { for (unsigned long y = 0; y < this->_dims[1]; ++y) { for (unsigned long x = 0; x < this->_dims[0]; ++x) { @@ -148,7 +147,7 @@ void QuickschedTraversal::init() { } /* end for-z */ // set dependencies - global_log->info() << "Setting task dependencies" << std::endl; + Log::global_log->info() << "Setting task dependencies" << std::endl; for (unsigned long z = 0; z < this->_dims[2] - 1; z += _taskBlocksize[2] - 1) { for (unsigned long y = 0; y < this->_dims[1] - 1; y += _taskBlocksize[1] - 1) { for (unsigned long x = 0; x < this->_dims[0] - 1; x += _taskBlocksize[0] - 1) { @@ -176,7 +175,7 @@ void QuickschedTraversal::init() { break; } /* end case PackedAdjustable */ default: - global_log->error() << "QuickschedHandler::init() received non existing task type!" + Log::global_log->error() << "QuickschedHandler::init() received non existing task type!" << std::endl; } #endif // QUICKSCHED @@ -230,7 +229,7 @@ void QuickschedTraversal::runner(int type, void *data) { break; } /* end case PackedAdjustable */ default: - global_log->error() << "Undefined Quicksched task type: " << type << std::endl; + Log::global_log->error() << "Undefined Quicksched task type: " << type << std::endl; } #ifdef PRINT_SCHEDULING_TIMINGS if(_simulation.getSimStep() > 10){ @@ -252,12 +251,12 @@ void QuickschedTraversal::traverseCellPairs(CellProcessor &cellPro template void QuickschedTraversal::traverseCellPairsInner(CellProcessor &cellProcessor, unsigned stage, unsigned stageCount) { - global_log->error() << "QuickschedTraversal::traverseCellPairsInner is not implemented!" << std::endl; + Log::global_log->error() << "QuickschedTraversal::traverseCellPairsInner is not implemented!" << std::endl; } template void QuickschedTraversal::traverseCellPairsOuter(CellProcessor &cellProcessor) { - global_log->error() << "QuickschedTraversal::traverseCellPairsOuter is not implemented!" << std::endl; + Log::global_log->error() << "QuickschedTraversal::traverseCellPairsOuter is not implemented!" << std::endl; } #endif //SRC_PARTICLECONTAINER_LINKEDCELLTRAVERSALS_QUICKSCHEDTRAVERSAL_H diff --git a/src/particleContainer/LinkedCellTraversals/SlicedCellPairTraversal.h b/src/particleContainer/LinkedCellTraversals/SlicedCellPairTraversal.h index 9d89b5586a..1d5e484710 100644 --- a/src/particleContainer/LinkedCellTraversals/SlicedCellPairTraversal.h +++ b/src/particleContainer/LinkedCellTraversals/SlicedCellPairTraversal.h @@ -82,8 +82,8 @@ template inline void SlicedCellPairTraversal::traverseCellPairs( CellProcessor& cellProcessor) { using std::array; - const array start = { 0, 0, 0 }; - array end; + const std::array start = { 0, 0, 0 }; + std::array end; for (int d = 0; d < 3; ++d) { end[d] = this->_dims[d] - 1; } @@ -108,37 +108,37 @@ inline void SlicedCellPairTraversal::traverseCellPairsOuter( // values, which are modified by 2 are actually modified by the respective stride, which is always 2 // lower part - array startZlo = { 0, 0, 0 }; - array endZlo = { this->_dims[0] - 1, this->_dims[1] - 1, 2 }; + std::array startZlo = { 0, 0, 0 }; + std::array endZlo = { this->_dims[0] - 1, this->_dims[1] - 1, 2 }; traverseCellPairsBackend(cellProcessor, startZlo, endZlo); // upper part - array startZhi = { 0, 0, this->_dims[2] - 3 }; - array endZhi = { this->_dims[0] - 1, this->_dims[1] - 1, this->_dims[2] - 1 }; + std::array startZhi = { 0, 0, this->_dims[2] - 3 }; + std::array endZhi = { this->_dims[0] - 1, this->_dims[1] - 1, this->_dims[2] - 1 }; traverseCellPairsBackend(cellProcessor, startZhi, endZhi); // halo & boundaries in y direction // boundaries in z direction are excluded! // lower part - array startYlo = { 0, 0, 2 }; - array endYlo = { this->_dims[0] - 1, 2, this->_dims[2] - 3 }; + std::array startYlo = { 0, 0, 2 }; + std::array endYlo = { this->_dims[0] - 1, 2, this->_dims[2] - 3 }; traverseCellPairsBackend(cellProcessor, startYlo, endYlo); // upper part - array startYhi = { 0, this->_dims[1] - 3, 2 }; - array endYhi = { this->_dims[0] - 1, this->_dims[1] - 1, this->_dims[2] - 3 }; + std::array startYhi = { 0, this->_dims[1] - 3, 2 }; + std::array endYhi = { this->_dims[0] - 1, this->_dims[1] - 1, this->_dims[2] - 3 }; traverseCellPairsBackend(cellProcessor, startYhi, endYhi); // halo & boundaries in x direction // boundaries in z and y direction are excluded! // lower part - array startXlo = { 0, 2, 2 }; - array endXlo = { 2, this->_dims[1] - 3, this->_dims[2] - 3 }; + std::array startXlo = { 0, 2, 2 }; + std::array endXlo = { 2, this->_dims[1] - 3, this->_dims[2] - 3 }; traverseCellPairsBackend(cellProcessor, startXlo, endXlo); // upper part - array startXhi = { this->_dims[0] - 3, 2, 2 }; - array endXhi = { this->_dims[0] - 1, this->_dims[1] - 3, this->_dims[2] - 3 }; + std::array startXhi = { this->_dims[0] - 3, 2, 2 }; + std::array endXhi = { this->_dims[0] - 1, this->_dims[1] - 3, this->_dims[2] - 3 }; traverseCellPairsBackend(cellProcessor, startXhi, endXhi); } @@ -166,8 +166,8 @@ inline void SlicedCellPairTraversal::traverseCellPairsInner( return; // we can not iterate over any inner cells, that do not depend on boundary or halo cells } - array lower; - array upper; + std::array lower; + std::array upper; for (unsigned long i = 0; i < 3; i++) { lower[i] = 2; upper[i] = this->_dims[i] - 3; @@ -194,7 +194,7 @@ inline void SlicedCellPairTraversal::traverseCellPairsBackend( mardyn_exit(1); } - array diff; + std::array diff; unsigned long num_cells = 1; for(int d = 0; d < 3; ++d) { @@ -209,8 +209,8 @@ inline void SlicedCellPairTraversal::traverseCellPairsBackend( #endif { Permutation perm = getPermutationForIncreasingSorting(diff); - array diff_permuted = permuteForward(perm, diff); - array start_permuted = permuteForward(perm, start); + std::array diff_permuted = permuteForward(perm, diff); + std::array start_permuted = permuteForward(perm, start); initLocks(); @@ -238,7 +238,7 @@ inline void SlicedCellPairTraversal::traverseCellPairsBackend( } // unroll - array newInd_permuted = threeDimensionalMapping::oneToThreeD(i,diff_permuted); + std::array newInd_permuted = threeDimensionalMapping::oneToThreeD(i,diff_permuted); // add inner-, middle- and outer-start for(int d = 0; d < 3; ++d) { @@ -246,7 +246,7 @@ inline void SlicedCellPairTraversal::traverseCellPairsBackend( } // permute newInd backwards - array newInd = permuteBackward(perm, newInd_permuted); + std::array newInd = permuteBackward(perm, newInd_permuted); // get actual index unsigned long cellIndex = threeDimensionalMapping::threeToOneD(newInd, this->_dims); @@ -320,8 +320,8 @@ template inline bool SlicedCellPairTraversal::isApplicable( const std::array& dims) { using std::array; - const array start = { 0, 0, 0 }; - array end; + const std::array start = { 0, 0, 0 }; + std::array end; for (int d = 0; d < 3; ++d) { end[d] = dims[d] - 1; } @@ -337,9 +337,9 @@ inline bool SlicedCellPairTraversal::isApplicable( using namespace Permute3Elements; using std::array; - array dims = {end[0] - start[0], end[1] - start[1], end[2] - start[2]}; + std::array dims = {end[0] - start[0], end[1] - start[1], end[2] - start[2]}; Permutation permutation = getPermutationForIncreasingSorting(dims); - array dimsPermuted = permuteForward(permutation, dims); + std::array dimsPermuted = permuteForward(permutation, dims); int num_threads = mardyn_get_max_threads(); diff --git a/src/particleContainer/LinkedCells.cpp b/src/particleContainer/LinkedCells.cpp index 14f8e77c92..82e8ce1f7a 100644 --- a/src/particleContainer/LinkedCells.cpp +++ b/src/particleContainer/LinkedCells.cpp @@ -28,8 +28,6 @@ #include "ResortCellProcessorSliced.h" -using namespace std; -using Log::global_log; //################################################ //############ PUBLIC METHODS #################### @@ -44,8 +42,8 @@ LinkedCells::LinkedCells(double bBoxMin[3], double bBoxMax[3], int numberOfCells = 1; _cutoffRadius = cutoffRadius; - global_log->debug() << "cutoff: " << cutoffRadius << endl; - global_log->debug() << "# cells in cutoff hardcoded to 1 " << endl; + Log::global_log->debug() << "cutoff: " << cutoffRadius << std::endl; + Log::global_log->debug() << "# cells in cutoff hardcoded to 1 " << std::endl; for (int d = 0; d < 3; d++) { /* first calculate the cell length for this dimension */ @@ -71,11 +69,11 @@ LinkedCells::LinkedCells(double bBoxMin[3], double bBoxMax[3], numberOfCells *= _cellsPerDimension[d]; mardyn_assert(numberOfCells > 0); } - global_log->debug() << "Cell size (" << _cellLength[0] << ", " - << _cellLength[1] << ", " << _cellLength[2] << ")" << endl; - global_log->info() << "Cells per dimension (incl. halo): " + Log::global_log->debug() << "Cell size (" << _cellLength[0] << ", " + << _cellLength[1] << ", " << _cellLength[2] << ")" << std::endl; + Log::global_log->info() << "Cells per dimension (incl. halo): " << _cellsPerDimension[0] << " x " << _cellsPerDimension[1] << " x " - << _cellsPerDimension[2] << endl; + << _cellsPerDimension[2] << std::endl; _cells.resize(numberOfCells); @@ -85,18 +83,18 @@ LinkedCells::LinkedCells(double bBoxMin[3], double bBoxMax[3], if (_boxWidthInNumCells[0] < 2 * _haloWidthInNumCells[0] || _boxWidthInNumCells[1] < 2 * _haloWidthInNumCells[1] || _boxWidthInNumCells[2] < 2 * _haloWidthInNumCells[2]) { - global_log->error_always_output() + Log::global_log->error_always_output() << "LinkedCells (constructor): bounding box too small for calculated cell length" - << endl; - global_log->error_always_output() << "_cellsPerDimension: " << _cellsPerDimension[0] + << std::endl; + Log::global_log->error_always_output() << "_cellsPerDimension: " << _cellsPerDimension[0] << " / " << _cellsPerDimension[1] << " / " - << _cellsPerDimension[2] << endl; - global_log->error_always_output() << "_haloWidthInNumCells: " + << _cellsPerDimension[2] << std::endl; + Log::global_log->error_always_output() << "_haloWidthInNumCells: " << _haloWidthInNumCells[0] << " / " << _haloWidthInNumCells[1] - << " / " << _haloWidthInNumCells[2] << endl; - global_log->error_always_output() << "_boxWidthInNumCells: " << _boxWidthInNumCells[0] + << " / " << _haloWidthInNumCells[2] << std::endl; + Log::global_log->error_always_output() << "_boxWidthInNumCells: " << _boxWidthInNumCells[0] << " / " << _boxWidthInNumCells[1] << " / " - << _boxWidthInNumCells[2] << endl; + << _boxWidthInNumCells[2] << std::endl; Simulation::exit(5); } @@ -133,7 +131,7 @@ void LinkedCells::readXML(XMLfileUnits& xmlconfig) { } bool LinkedCells::rebuild(double bBoxMin[3], double bBoxMax[3]) { - global_log->info() << "REBUILD OF LinkedCells" << endl; + Log::global_log->info() << "REBUILD OF LinkedCells" << std::endl; for (int i = 0; i < 3; i++) { this->_boundingBoxMin[i] = bBoxMin[i]; @@ -141,13 +139,13 @@ bool LinkedCells::rebuild(double bBoxMin[3], double bBoxMax[3]) { // _haloWidthInNumCells[i] = ::ceil(_cellsInCutoff); _haloWidthInNumCells[i] = _cellsInCutoff; } - global_log->info() << "Bounding box: " << "[" << bBoxMin[0] << ", " << bBoxMax[0] << "]" << " x " << "[" + Log::global_log->info() << "Bounding box: " << "[" << bBoxMin[0] << ", " << bBoxMax[0] << "]" << " x " << "[" << bBoxMin[1] << ", " << bBoxMax[1] << "]" << " x " << "[" << bBoxMin[2] << ", " << bBoxMax[2] << "]" << std::endl; int numberOfCells = 1; - global_log->info() << "Using " << _cellsInCutoff << " cells in cutoff." << endl; + Log::global_log->info() << "Using " << _cellsInCutoff << " cells in cutoff." << std::endl; float rc = (_cutoffRadius / _cellsInCutoff); for (int dim = 0; dim < 3; dim++) { @@ -157,7 +155,7 @@ bool LinkedCells::rebuild(double bBoxMin[3], double bBoxMax[3]) { // in each dimension at least one layer of (inner+boundary) cells necessary if (_cellsPerDimension[dim] == 2 * _haloWidthInNumCells[dim]) { - global_log->error_always_output() << "LinkedCells::rebuild: region too small" << endl; + Log::global_log->error_always_output() << "LinkedCells::rebuild: region too small" << std::endl; Simulation::exit(1); } @@ -173,8 +171,8 @@ bool LinkedCells::rebuild(double bBoxMin[3], double bBoxMax[3]) { _haloBoundingBoxMax[dim] = _boundingBoxMax[dim] + _haloLength[dim]; } - global_log->info() << "Cells per dimension (incl. halo): " << _cellsPerDimension[0] << " x " - << _cellsPerDimension[1] << " x " << _cellsPerDimension[2] << endl; + Log::global_log->info() << "Cells per dimension (incl. halo): " << _cellsPerDimension[0] << " x " + << _cellsPerDimension[1] << " x " << _cellsPerDimension[2] << std::endl; _cells.resize(numberOfCells); @@ -226,15 +224,15 @@ void LinkedCells::check_molecules_in_box() { } if (numBadMolecules > 0) { - global_log->error() << "Found " << numBadMolecules << " outside of bounding box:" << std::endl; + Log::global_log->error() << "Found " << numBadMolecules << " outside of bounding box:" << std::endl; for (auto & m : badMolecules) { - global_log->error() << "Particle (id=" << m.getID() << "), (current position: x=" + Log::global_log->error() << "Particle (id=" << m.getID() << "), (current position: x=" << m.r(0) << ", y=" << m.r(1) << ", z=" << m.r(2) << ")" << std::endl; } - global_log->error() << "The bounding box is: [" << _haloBoundingBoxMin[0] << ", " << _haloBoundingBoxMax[0] + Log::global_log->error() << "The bounding box is: [" << _haloBoundingBoxMin[0] << ", " << _haloBoundingBoxMax[0] << ") x [" << _haloBoundingBoxMin[1] << ", " << _haloBoundingBoxMax[1] << ") x [" << _haloBoundingBoxMin[2] << ", " << _haloBoundingBoxMax[2] << ")" << std::endl; - global_log->error() << "Particles will be lost. Aborting simulation." << std::endl; + Log::global_log->error() << "Particles will be lost. Aborting simulation." << std::endl; Simulation::exit(311); } } @@ -278,10 +276,10 @@ void LinkedCells::update() { for (ParticleIterator tM = iterator(ParticleIterator::ALL_CELLS); tM.isValid(); ++tM) { if (not _cells[tM.getCellIndex()].testInBox(*tM)) { numBadMolecules++; - global_log->error_always_output() << "particle " << tM->getID() << " in cell " << tM.getCellIndex() + Log::global_log->error_always_output() << "particle " << tM->getID() << " in cell " << tM.getCellIndex() << ", which is" << (_cells[tM.getCellIndex()].isBoundaryCell() ? "" : " NOT") << " a boundarycell is outside of its cell after LinkedCells::update()." << std::endl; - global_log->error_always_output() << "particle at (" << tM->r(0) << ", " << tM->r(1) << ", " << tM->r(2) << ")" + Log::global_log->error_always_output() << "particle at (" << tM->r(0) << ", " << tM->r(1) << ", " << tM->r(2) << ")" << std::endl << "cell: [" << _cells[tM.getCellIndex()].getBoxMin(0) << ", " << _cells[tM.getCellIndex()].getBoxMax(0) << "] x [" << _cells[tM.getCellIndex()].getBoxMin(1) << ", " << _cells[tM.getCellIndex()].getBoxMax(1) << "] x [" @@ -294,16 +292,16 @@ void LinkedCells::update() { if (numBadMolecules > 0) { - global_log->error() << "Found " << numBadMolecules << " outside of their correct cells. Aborting." << std::endl; + Log::global_log->error() << "Found " << numBadMolecules << " outside of their correct cells. Aborting." << std::endl; Simulation::exit(311); } #endif } void LinkedCells::update_via_copies() { - const vector::size_type numCells = _cells.size(); - vector forwardNeighbourOffsets; // now vector - vector backwardNeighbourOffsets; // now vector + const std::vector::size_type numCells = _cells.size(); + std::vector forwardNeighbourOffsets; // now vector + std::vector backwardNeighbourOffsets; // now vector calculateNeighbourIndices(forwardNeighbourOffsets, backwardNeighbourOffsets); // magic numbers: empirically determined to be somewhat efficient. @@ -315,14 +313,14 @@ void LinkedCells::update_via_copies() { #if defined(_OPENMP) #pragma omp for schedule(dynamic, chunk_size) #endif - for (vector::size_type cellIndex = 0; cellIndex < numCells; cellIndex++) { + for (std::vector::size_type cellIndex = 0; cellIndex < numCells; cellIndex++) { _cells[cellIndex].preUpdateLeavingMolecules(); } #if defined(_OPENMP) #pragma omp for schedule(dynamic, chunk_size) #endif - for (vector::size_type cellIndex = 0; cellIndex < numCells; cellIndex++) { + for (std::vector::size_type cellIndex = 0; cellIndex < numCells; cellIndex++) { ParticleCell& cell = _cells[cellIndex]; for (unsigned long j = 0; j < backwardNeighbourOffsets.size(); j++) { @@ -348,7 +346,7 @@ void LinkedCells::update_via_copies() { #if defined(_OPENMP) #pragma omp for schedule(dynamic, chunk_size) #endif - for (vector::size_type cellIndex = 0; cellIndex < _cells.size(); cellIndex++) { + for (std::vector::size_type cellIndex = 0; cellIndex < _cells.size(); cellIndex++) { _cells[cellIndex].postUpdateLeavingMolecules(); } } // end pragma omp parallel @@ -381,7 +379,7 @@ void LinkedCells::update_via_coloring() { const int num_pairs = cellPairOffsets.size(); for(int j = 0; j < num_pairs; ++j) { - pair current_pair = cellPairOffsets[j]; + std::pair current_pair = cellPairOffsets[j]; long int offset1 = current_pair.first; long int cellIndex1 = baseIndex + offset1; @@ -454,9 +452,9 @@ bool LinkedCells::addParticle(Molecule& particle, bool inBoxCheckedAlready, bool return wasInserted; } -void LinkedCells::addParticles(vector& particles, bool checkWhetherDuplicate) { - typedef vector::size_type mol_index_t; - typedef vector::size_type cell_index_t; +void LinkedCells::addParticles(std::vector& particles, bool checkWhetherDuplicate) { + typedef std::vector::size_type mol_index_t; + typedef std::vector::size_type cell_index_t; #ifndef NDEBUG int oldNumberOfParticles = getNumberOfParticles(); @@ -464,13 +462,13 @@ void LinkedCells::addParticles(vector& particles, bool checkWhetherDup const mol_index_t N = particles.size(); - map> newPartsPerCell; + std::map> newPartsPerCell; #if defined(_OPENMP) #pragma omp parallel #endif { - map> local_newPartsPerCell; + std::map> local_newPartsPerCell; #if defined(_OPENMP) #pragma omp for schedule(static) @@ -480,7 +478,7 @@ void LinkedCells::addParticles(vector& particles, bool checkWhetherDup #ifndef NDEBUG if(!particle.inBox(_haloBoundingBoxMin, _haloBoundingBoxMax)){ - global_log->error()<<"At particle with ID "<< particle.getID()<<" assertion failed..."<error()<<"At particle with ID "<< particle.getID()<<" assertion failed..."<& particles, bool checkWhetherDup { for (auto it = local_newPartsPerCell.begin(); it != local_newPartsPerCell.end(); ++it) { cell_index_t cellIndex = it->first; - vector & global_vector = newPartsPerCell[cellIndex]; - vector & local_vector = it->second; + std::vector & global_vector = newPartsPerCell[cellIndex]; + std::vector & local_vector = it->second; global_vector.insert(global_vector.end(), local_vector.begin(), local_vector.end()); } } @@ -519,7 +517,7 @@ void LinkedCells::addParticles(vector& particles, bool checkWhetherDup for(auto it = thread_begin; it != thread_end; ++it) { cell_index_t cellIndex = it->first; - const vector & global_vector = it->second; + const std::vector & global_vector = it->second; const size_t numMolsInCell = global_vector.size(); _cells[cellIndex].increaseMoleculeStorage(numMolsInCell); @@ -535,16 +533,16 @@ void LinkedCells::addParticles(vector& particles, bool checkWhetherDup #ifndef NDEBUG int numberOfAddedParticles = getNumberOfParticles() - oldNumberOfParticles; - global_log->debug()<<"In LinkedCells::addParticles :"<debug()<<"\t#Particles to be added = "<debug()<<"\t#Particles actually added = "<debug()<<"In LinkedCells::addParticles :"<debug()<<"\t#Particles to be added = "<debug()<<"\t#Particles actually added = "<error() << "Cell structure in LinkedCells (traverseNonInnermostCells) invalid, call update first" << endl; + Log::global_log->error() << "Cell structure in LinkedCells (traverseNonInnermostCells) invalid, call update first" << std::endl; Simulation::exit(1); } @@ -553,7 +551,7 @@ void LinkedCells::traverseNonInnermostCells(CellProcessor& cellProcessor) { void LinkedCells::traversePartialInnermostCells(CellProcessor& cellProcessor, unsigned int stage, int stageCount) { if (not _cellsValid) { - global_log->error() << "Cell structure in LinkedCells (traversePartialInnermostCells) invalid, call update first" << endl; + Log::global_log->error() << "Cell structure in LinkedCells (traversePartialInnermostCells) invalid, call update first" << std::endl; Simulation::exit(1); } @@ -562,9 +560,9 @@ void LinkedCells::traversePartialInnermostCells(CellProcessor& cellProcessor, un void LinkedCells::traverseCells(CellProcessor& cellProcessor) { if (not _cellsValid) { - global_log->error() + Log::global_log->error() << "Cell structure in LinkedCells (traversePairs) invalid, call update first" - << endl; + << std::endl; Simulation::exit(1); } @@ -589,7 +587,7 @@ unsigned long LinkedCells::getNumberOfParticles(ParticleIterator::Type t /* = Pa } void LinkedCells::clear() { - vector::iterator cellIter; + std::vector::iterator cellIter; for (cellIter = _cells.begin(); cellIter != _cells.end(); cellIter++) { cellIter->deallocateAllParticles(); } @@ -611,9 +609,9 @@ void LinkedCells::deleteParticlesOutsideBox(double boxMin[3], double boxMax[3]) void LinkedCells::deleteOuterParticles() { /*if (_cellsValid == false) { - global_log->error() + Log::global_log->error() << "Cell structure in LinkedCells (deleteOuterParticles) invalid, call update first" - << endl; + << std::endl; Simulation::exit(1); }*/ @@ -720,7 +718,7 @@ void LinkedCells::initializeCells() { } void LinkedCells::calculateNeighbourIndices(std::vector& forwardNeighbourOffsets, std::vector& backwardNeighbourOffsets) const { - global_log->debug() << "Setting up cell neighbour indice lists." << endl; + Log::global_log->debug() << "Setting up cell neighbour indice lists." << std::endl; // 13 neighbors for _haloWidthInNumCells = 1 or 64 for =2 int maxNNeighbours = ( (2*_haloWidthInNumCells[0]+1) * (2*_haloWidthInNumCells[1]+1) * (2*_haloWidthInNumCells[2]+1) - 1) / 2; @@ -796,33 +794,33 @@ std::array, 14> LinkedCells::calculateCe // minimize number of cells simultaneously in memory: std::array, 14> cellPairOffsets; - cellPairOffsets[ 0] = make_pair(o, xyz); + cellPairOffsets[ 0] = std::make_pair(o, xyz); // evict xyz - cellPairOffsets[ 1] = make_pair(o, yz ); - cellPairOffsets[ 2] = make_pair(x, yz ); + cellPairOffsets[ 1] = std::make_pair(o, yz ); + cellPairOffsets[ 2] = std::make_pair(x, yz ); // evict yz - cellPairOffsets[ 3] = make_pair(o, x ); + cellPairOffsets[ 3] = std::make_pair(o, x ); - cellPairOffsets[ 4] = make_pair(o, xy ); - cellPairOffsets[ 5] = make_pair(xy, z ); + cellPairOffsets[ 4] = std::make_pair(o, xy ); + cellPairOffsets[ 5] = std::make_pair(xy, z ); // evict xy - cellPairOffsets[ 6] = make_pair(o, z ); - cellPairOffsets[ 7] = make_pair(x, z ); - cellPairOffsets[ 8] = make_pair(y, z ); + cellPairOffsets[ 6] = std::make_pair(o, z ); + cellPairOffsets[ 7] = std::make_pair(x, z ); + cellPairOffsets[ 8] = std::make_pair(y, z ); // evict z - cellPairOffsets[ 9] = make_pair(o, y ); - cellPairOffsets[10] = make_pair(x, y ); + cellPairOffsets[ 9] = std::make_pair(o, y ); + cellPairOffsets[10] = std::make_pair(x, y ); // evict x - cellPairOffsets[11] = make_pair(o, xz ); - cellPairOffsets[12] = make_pair(y, xz ); + cellPairOffsets[11] = std::make_pair(o, xz ); + cellPairOffsets[12] = std::make_pair(y, xz ); // evict xz - cellPairOffsets[13] = make_pair(o, o ); + cellPairOffsets[13] = std::make_pair(o, o ); return cellPairOffsets; } @@ -835,16 +833,16 @@ unsigned long int LinkedCells::getCellIndexOfMolecule(Molecule* molecule) const for (int dim = 0; dim < 3; dim++) { #ifndef NDEBUG if (molecule->r(dim) < _haloBoundingBoxMin[dim] || molecule->r(dim) >= _haloBoundingBoxMax[dim]) { - global_log->error() << "Molecule is outside of bounding box" << endl; - global_log->error() << "Molecule:\n" << *molecule << endl; - global_log->error() << "_haloBoundingBoxMin = (" << _haloBoundingBoxMin[0] << ", " << _haloBoundingBoxMin[1] << ", " << _haloBoundingBoxMin[2] << ")" << endl; - global_log->error() << "_haloBoundingBoxMax = (" << _haloBoundingBoxMax[0] << ", " << _haloBoundingBoxMax[1] << ", " << _haloBoundingBoxMax[2] << ")" << endl; + Log::global_log->error() << "Molecule is outside of bounding box" << std::endl; + Log::global_log->error() << "Molecule:\n" << *molecule << std::endl; + Log::global_log->error() << "_haloBoundingBoxMin = (" << _haloBoundingBoxMin[0] << ", " << _haloBoundingBoxMin[1] << ", " << _haloBoundingBoxMin[2] << ")" << std::endl; + Log::global_log->error() << "_haloBoundingBoxMax = (" << _haloBoundingBoxMax[0] << ", " << _haloBoundingBoxMax[1] << ", " << _haloBoundingBoxMax[2] << ")" << std::endl; Simulation::exit(1); } #endif //this version is sensitive to roundoffs, if we have molecules (initialized) precisely at position 0.0: //cellIndex[dim] = (int) floor((molecule->r(dim) - _haloBoundingBoxMin[dim]) / _cellLength[dim]); - cellIndex[dim] = min(max(((int) floor((molecule->r(dim) - _boundingBoxMin[dim]) / _cellLength[dim])) + _haloWidthInNumCells[dim],0),_cellsPerDimension[dim]-1); + cellIndex[dim] = std::min(std::max(((int) floor((molecule->r(dim) - _boundingBoxMin[dim]) / _cellLength[dim])) + _haloWidthInNumCells[dim],0),_cellsPerDimension[dim]-1); } int cellIndex1d = this->cellIndexOf3DIndex(cellIndex[0], cellIndex[1], cellIndex[2]); @@ -884,17 +882,17 @@ unsigned long int LinkedCells::getCellIndexOfPoint(const double point[3]) const #ifndef NDEBUG //this should never ever happen! if (localPoint[dim] < _haloBoundingBoxMin[dim] || localPoint[dim] >= _haloBoundingBoxMax[dim]) { - global_log->error() << "Point is outside of halo bounding box" << endl; - global_log->error() << "Point p = (" << localPoint[0] << ", " << localPoint[1] << ", " << localPoint[2] << ")" << endl; - global_log->error() << "_haloBoundingBoxMin = (" << _haloBoundingBoxMin[0] << ", " << _haloBoundingBoxMin[1] << ", " << _haloBoundingBoxMin[2] << ")" << endl; - global_log->error() << "_haloBoundingBoxMax = (" << _haloBoundingBoxMax[0] << ", " << _haloBoundingBoxMax[1] << ", " << _haloBoundingBoxMax[2] << ")" << endl; + Log::global_log->error() << "Point is outside of halo bounding box" << std::endl; + Log::global_log->error() << "Point p = (" << localPoint[0] << ", " << localPoint[1] << ", " << localPoint[2] << ")" << std::endl; + Log::global_log->error() << "_haloBoundingBoxMin = (" << _haloBoundingBoxMin[0] << ", " << _haloBoundingBoxMin[1] << ", " << _haloBoundingBoxMin[2] << ")" << std::endl; + Log::global_log->error() << "_haloBoundingBoxMax = (" << _haloBoundingBoxMax[0] << ", " << _haloBoundingBoxMax[1] << ", " << _haloBoundingBoxMax[2] << ")" << std::endl; Simulation::exit(1); } #endif //this version is sensitive to roundoffs, if we have molecules (initialized) precisely at position 0.0: //cellIndex[dim] = (int) floor(point[dim] - _haloBoundingBoxMin[dim]) * _cellLengthReciprocal[dim]); - cellIndex[dim] = min(max(((int) floor((localPoint[dim] - _boundingBoxMin[dim]) * _cellLengthReciprocal[dim])) + _haloWidthInNumCells[dim],0),_cellsPerDimension[dim]-1); + cellIndex[dim] = std::min(std::max(((int) floor((localPoint[dim] - _boundingBoxMin[dim]) * _cellLengthReciprocal[dim])) + _haloWidthInNumCells[dim],0),_cellsPerDimension[dim]-1); } int cellIndex1d = this->cellIndexOf3DIndex(cellIndex[0], cellIndex[1], cellIndex[2]); @@ -1008,9 +1006,9 @@ void LinkedCells::deleteMolecule(ParticleIterator &moleculeIter, const bool& reb if (rebuildCaches) { auto cellid = getCellIndexOfMolecule(&*moleculeIter); if (cellid >= _cells.size()) { - global_log->error_always_output() + Log::global_log->error_always_output() << "coordinates for atom deletion lie outside bounding box." - << endl; + << std::endl; Simulation::exit(1); } _cells[cellid].buildSoACaches(); @@ -1041,8 +1039,8 @@ double LinkedCells::getEnergy(ParticlePairsHandler* particlePairsHandler, Molecu u += cellProcessor->processSingleMolecule(&molWithSoA, currentCell); - vector forwardNeighbourOffsets; // now vector - vector backwardNeighbourOffsets; // now vector + std::vector forwardNeighbourOffsets; // now vector + std::vector backwardNeighbourOffsets; // now vector calculateNeighbourIndices(forwardNeighbourOffsets, backwardNeighbourOffsets); // forward neighbours @@ -1131,12 +1129,12 @@ void LinkedCells::printSubInfo(int offset) { for (int i = 0; i < offset; i++) { offsetstream << "\t"; } - global_log->info() << offsetstream.str() << "own datastructures:\t" << ownSize / 1.e6 << " MB" << std::endl; - global_log->info() << offsetstream.str() << "cells total:\t\t" << cellTotal / 1.e6 << " MB" << std::endl; - global_log->info() << offsetstream.str() << "cells SoAs:\t\t" << cellSoA / 1.e6 << " MB" << std::endl; - global_log->info() << offsetstream.str() << "cells molecule vectors:\t" << cellMoleculeVectors / 1.e6 << " MB" + Log::global_log->info() << offsetstream.str() << "own datastructures:\t" << ownSize / 1.e6 << " MB" << std::endl; + Log::global_log->info() << offsetstream.str() << "cells total:\t\t" << cellTotal / 1.e6 << " MB" << std::endl; + Log::global_log->info() << offsetstream.str() << "cells SoAs:\t\t" << cellSoA / 1.e6 << " MB" << std::endl; + Log::global_log->info() << offsetstream.str() << "cells molecule vectors:\t" << cellMoleculeVectors / 1.e6 << " MB" << std::endl; - global_log->info() << offsetstream.str() << "indexVectors:\t\t" << indexVectors / 1.e6 << " MB" << std::endl; + Log::global_log->info() << offsetstream.str() << "indexVectors:\t\t" << indexVectors / 1.e6 << " MB" << std::endl; } std::string LinkedCells::getName() { return "LinkedCells"; @@ -1182,8 +1180,8 @@ std::vector LinkedCells::getParticleCellStatistics() { return statistics; } -string LinkedCells::getConfigurationAsString() { - stringstream ss; +std::string LinkedCells::getConfigurationAsString() { + std::stringstream ss; // TODO: propper string representation for ls1 traversal choices ss << "{Container: ls1_linkedCells , Traversal: " << _traversalTuner->getSelectedTraversal() << "}"; return ss.str(); diff --git a/src/particleContainer/LinkedCells.h b/src/particleContainer/LinkedCells.h index da9d71d551..a444fea3ae 100644 --- a/src/particleContainer/LinkedCells.h +++ b/src/particleContainer/LinkedCells.h @@ -206,7 +206,7 @@ class LinkedCells : public ParticleContainer { double* getCellLength() override { return _cellLength; } - + /** * @brief Gets a molecule by its position. * @param pos Molecule position diff --git a/src/particleContainer/ParticleCellBase.cpp b/src/particleContainer/ParticleCellBase.cpp index 6f37eac159..3cd67b55ca 100644 --- a/src/particleContainer/ParticleCellBase.cpp +++ b/src/particleContainer/ParticleCellBase.cpp @@ -70,7 +70,7 @@ bool PositionIsInBox3D(const T l[3], const T u[3], const T r[3]) { return in; } -unsigned long ParticleCellBase::initCubicGrid(const array &numMoleculesPerDimension, +unsigned long ParticleCellBase::initCubicGrid(const std::array &numMoleculesPerDimension, const std::array &simBoxLength, Random &RNG) { std::array spacing{}; diff --git a/src/particleContainer/ParticleContainer.cpp b/src/particleContainer/ParticleContainer.cpp index 8ff1f47e21..1970c2cc4d 100644 --- a/src/particleContainer/ParticleContainer.cpp +++ b/src/particleContainer/ParticleContainer.cpp @@ -3,8 +3,6 @@ #include "molecules/Molecule.h" #include "utils/Logger.h" -using namespace std; -using Log::global_log; ParticleContainer::ParticleContainer(double bBoxMin[3], double bBoxMax[3]) { for (int i = 0; i < 3; i++) { @@ -14,12 +12,12 @@ ParticleContainer::ParticleContainer(double bBoxMin[3], double bBoxMax[3]) { } bool ParticleContainer::rebuild(double bBoxMin[3], double bBoxMax[3]) { - global_log->info() << "REBUILD OF PARTICLE CONTAINER" << endl; + Log::global_log->info() << "REBUILD OF PARTICLE CONTAINER" << std::endl; for (int i = 0; i < 3; i++) { _boundingBoxMin[i] = bBoxMin[i]; _boundingBoxMax[i] = bBoxMax[i]; } - global_log->info() << "Bounding box: " << "[" << bBoxMin[0] << ", " << bBoxMax[0] << "]" << " x " << "[" + Log::global_log->info() << "Bounding box: " << "[" << bBoxMin[0] << ", " << bBoxMax[0] << "]" << " x " << "[" << bBoxMin[1] << ", " << bBoxMax[1] << "]" << " x " << "[" << bBoxMin[2] << ", " << bBoxMax[2] << "]" << std::endl; diff --git a/src/particleContainer/TraversalTuner.h b/src/particleContainer/TraversalTuner.h index 1bd65296a6..71a34fa1b5 100644 --- a/src/particleContainer/TraversalTuner.h +++ b/src/particleContainer/TraversalTuner.h @@ -17,7 +17,6 @@ #include "LinkedCellTraversals/NeutralTerritoryTraversal.h" #include "LinkedCellTraversals/SlicedCellPairTraversal.h" -using Log::global_log; template class TraversalTuner { @@ -103,20 +102,20 @@ TraversalTuner::TraversalTuner() : _cells(nullptr), _dims(), _opti auto *c08esData = new C08CellPairTraversalData; _traversals = { - make_pair(nullptr, origData), - make_pair(nullptr, c08Data), - make_pair(nullptr, c04Data), - make_pair(nullptr, slicedData), - make_pair(nullptr, hsData), - make_pair(nullptr, mpData), - make_pair(nullptr, ntData), - make_pair(nullptr, c08esData) + std::make_pair(nullptr, origData), + std::make_pair(nullptr, c08Data), + std::make_pair(nullptr, c04Data), + std::make_pair(nullptr, slicedData), + std::make_pair(nullptr, hsData), + std::make_pair(nullptr, mpData), + std::make_pair(nullptr, ntData), + std::make_pair(nullptr, c08esData) }; #ifdef QUICKSCHED struct QuickschedTraversalData *quiData = new QuickschedTraversalData; quiData->taskBlockSize = {{2, 2, 2}}; - if (is_base_of::value) { - _traversals.push_back(make_pair(nullptr, quiData)); + if (std::is_base_of::value) { + _traversals.push_back(std::make_pair(nullptr, quiData)); } #endif } @@ -139,32 +138,32 @@ void TraversalTuner::findOptimalTraversal() { // log traversal if (dynamic_cast *>(_optimalTraversal)) - global_log->info() << "Using HalfShellTraversal." << endl; + Log::global_log->info() << "Using HalfShellTraversal." << std::endl; else if (dynamic_cast *>(_optimalTraversal)) - global_log->info() << "Using OriginalCellPairTraversal." << endl; + Log::global_log->info() << "Using OriginalCellPairTraversal." << std::endl; else if (dynamic_cast *>(_optimalTraversal)) - global_log->info() << "Using C08CellPairTraversal without eighthShell." << endl; + Log::global_log->info() << "Using C08CellPairTraversal without eighthShell." << std::endl; else if (dynamic_cast *>(_optimalTraversal)) - global_log->info() << "Using C08CellPairTraversal with eighthShell." << endl; + Log::global_log->info() << "Using C08CellPairTraversal with eighthShell." << std::endl; else if (dynamic_cast *>(_optimalTraversal)) - global_log->info() << "Using C04CellPairTraversal." << endl; + Log::global_log->info() << "Using C04CellPairTraversal." << std::endl; else if (dynamic_cast *>(_optimalTraversal)) - global_log->info() << "Using MidpointTraversal." << endl; + Log::global_log->info() << "Using MidpointTraversal." << std::endl; else if (dynamic_cast *>(_optimalTraversal)) - global_log->info() << "Using NeutralTerritoryTraversal." << endl; + Log::global_log->info() << "Using NeutralTerritoryTraversal." << std::endl; else if (dynamic_cast *>(_optimalTraversal)) { - global_log->info() << "Using QuickschedTraversal." << endl; + Log::global_log->info() << "Using QuickschedTraversal." << std::endl; #ifndef QUICKSCHED - global_log->error() << "MarDyn was compiled without Quicksched Support. Aborting!" << endl; + Log::global_log->error() << "MarDyn was compiled without Quicksched Support. Aborting!" << std::endl; Simulation::exit(1); #endif } else if (dynamic_cast *>(_optimalTraversal)) - global_log->info() << "Using SlicedCellPairTraversal." << endl; + Log::global_log->info() << "Using SlicedCellPairTraversal." << std::endl; else - global_log->warning() << "Using unknown traversal." << endl; + Log::global_log->warning() << "Using unknown traversal." << std::endl; if (_cellsInCutoff > _optimalTraversal->maxCellsInCutoff()) { - global_log->error() << "Traversal supports up to " << _optimalTraversal->maxCellsInCutoff() + Log::global_log->error() << "Traversal supports up to " << _optimalTraversal->maxCellsInCutoff() << " cells in cutoff, but value is chosen as " << _cellsInCutoff << std::endl; Simulation::exit(45); } @@ -172,37 +171,37 @@ void TraversalTuner::findOptimalTraversal() { template void TraversalTuner::readXML(XMLfileUnits &xmlconfig) { - string oldPath(xmlconfig.getcurrentnodepath()); + std::string oldPath(xmlconfig.getcurrentnodepath()); // read traversal type default values - string traversalType; + std::string traversalType; xmlconfig.getNodeValue("traversalSelector", traversalType); transform(traversalType.begin(), traversalType.end(), traversalType.begin(), ::tolower); - if (traversalType.find("c08es") != string::npos) + if (traversalType.find("c08es") != std::string::npos) selectedTraversal = C08ES; - else if (traversalType.find("c08") != string::npos) + else if (traversalType.find("c08") != std::string::npos) selectedTraversal = C08; - else if (traversalType.find("c04") != string::npos) + else if (traversalType.find("c04") != std::string::npos) selectedTraversal = C04; - else if (traversalType.find("qui") != string::npos) + else if (traversalType.find("qui") != std::string::npos) selectedTraversal = QSCHED; - else if (traversalType.find("slice") != string::npos) + else if (traversalType.find("slice") != std::string::npos) selectedTraversal = SLICED; - else if (traversalType.find("ori") != string::npos) + else if (traversalType.find("ori") != std::string::npos) selectedTraversal = ORIGINAL; - else if (traversalType.find("hs") != string::npos) + else if (traversalType.find("hs") != std::string::npos) selectedTraversal = HS; - else if (traversalType.find("mp") != string::npos) + else if (traversalType.find("mp") != std::string::npos) selectedTraversal = MP; - else if (traversalType.find("nt") != string::npos) { + else if (traversalType.find("nt") != std::string::npos) { selectedTraversal = NT; } else { // selector already set in constructor, just print a warning here if (mardyn_get_max_threads() > 1) { - global_log->warning() << "No traversal type selected. Defaulting to c08 traversal." << endl; + Log::global_log->warning() << "No traversal type selected. Defaulting to c08 traversal." << std::endl; } else { - global_log->warning() << "No traversal type selected. Defaulting to sliced traversal." << endl; + Log::global_log->warning() << "No traversal type selected. Defaulting to sliced traversal." << std::endl; } } @@ -213,39 +212,39 @@ void TraversalTuner::readXML(XMLfileUnits &xmlconfig) { // xmlconfig.changecurrentnode(traversalIterator); // does not work resolve paths to traversals manually // use iterator only to resolve number of traversals (==iterations) - string basePath(xmlconfig.getcurrentnodepath()); + std::string basePath(xmlconfig.getcurrentnodepath()); int i = 1; XMLfile::Query qry = xmlconfig.query("traversalData"); for (XMLfile::Query::const_iterator traversalIterator = qry.begin(); traversalIterator; ++traversalIterator) { - string path(basePath + "/traversalData[" + to_string(i) + "]"); + std::string path(basePath + "/traversalData[" + std::to_string(i) + "]"); xmlconfig.changecurrentnode(path); traversalType = xmlconfig.getNodeValue_string("@type", "NOTHING FOUND"); transform(traversalType.begin(), traversalType.end(), traversalType.begin(), ::tolower); if (traversalType == "c08") { // nothing to do - } else if (traversalType.find("qui") != string::npos) { + } else if (traversalType.find("qui") != std::string::npos) { #ifdef QUICKSCHED - if (not is_base_of::value) { - global_log->warning() << "Attempting to use Quicksched with cell type that does not store task data!" - << endl; + if (not std::is_base_of::value) { + Log::global_log->warning() << "Attempting to use Quicksched with cell type that does not store task data!" + << std::endl; } for (auto p : _traversals) { if (struct QuickschedTraversalData *quiData = dynamic_cast(p.second)) { // read task block size - string tag = "taskBlockSize/l"; + std::string tag = "taskBlockSize/l"; char dimension = 'x'; for (int j = 0; j < 3; ++j) { tag += (dimension + j); xmlconfig.getNodeValue(tag, quiData->taskBlockSize[j]); if (quiData->taskBlockSize[j] < 2) { - global_log->error() << "Task block size in " + Log::global_log->error() << "Task block size in " << (char) (dimension + j) << " direction is <2 and thereby invalid! (" << quiData->taskBlockSize[j] << ")" - << endl; + << std::endl; Simulation::exit(1); } } @@ -253,12 +252,12 @@ void TraversalTuner::readXML(XMLfileUnits &xmlconfig) { } } #else - global_log->warning() << "Found quicksched traversal data in config " + Log::global_log->warning() << "Found quicksched traversal data in config " << "but mardyn was compiled without quicksched support! " - << "(make ENABLE_QUICKSCHED=1)" << endl; + << "(make ENABLE_QUICKSCHED=1)" << std::endl; #endif } else { - global_log->warning() << "Unknown traversal type: " << traversalType << endl; + Log::global_log->warning() << "Unknown traversal type: " << traversalType << std::endl; } ++i; } @@ -302,12 +301,12 @@ void TraversalTuner::rebuild(std::vector &cells, con traversalPointerReference = new C08CellPairTraversal(cells, dims); break; case traversalNames::QSCHED: { - mardyn_assert((is_base_of::value)); + mardyn_assert((std::is_base_of::value)); auto *quiData = dynamic_cast(traversalData); traversalPointerReference = new QuickschedTraversal(cells, dims, quiData->taskBlockSize); } break; default: - global_log->error() << "Unknown traversal data found in TraversalTuner._traversals!" << endl; + Log::global_log->error() << "Unknown traversal data found in TraversalTuner._traversals!" << std::endl; Simulation::exit(1); } } @@ -385,7 +384,7 @@ inline bool TraversalTuner::isTraversalApplicable( ret = true; break; default: - global_log->warning() << "unknown traversal given in TraversalTuner::isTraversalApplicable, assuming that is applicable" << std::endl; + Log::global_log->warning() << "unknown traversal given in TraversalTuner::isTraversalApplicable, assuming that is applicable" << std::endl; } return ret; } diff --git a/src/particleContainer/adapter/CellProcessor.h b/src/particleContainer/adapter/CellProcessor.h index bbf6312095..b9b7226a7c 100644 --- a/src/particleContainer/adapter/CellProcessor.h +++ b/src/particleContainer/adapter/CellProcessor.h @@ -32,11 +32,11 @@ class CellProcessor { double _LJCutoffRadiusSquare; public: - CellProcessor(const double cutoffRadius, const double LJCutoffRadius) : - _cutoffRadiusSquare(cutoffRadius * cutoffRadius), + CellProcessor(const double cutoffRadius, const double LJCutoffRadius) : + _cutoffRadiusSquare(cutoffRadius * cutoffRadius), _LJCutoffRadiusSquare(LJCutoffRadius * LJCutoffRadius) {} - /** - * virtual destructor + /** + * virtual destructor */ virtual ~CellProcessor() {} diff --git a/src/particleContainer/adapter/FlopCounter.cpp b/src/particleContainer/adapter/FlopCounter.cpp index f00f4e2da7..f73e97ca38 100644 --- a/src/particleContainer/adapter/FlopCounter.cpp +++ b/src/particleContainer/adapter/FlopCounter.cpp @@ -110,14 +110,13 @@ void FlopCounter::_Counts::allReduce() { void FlopCounter::_Counts::print() const { using std::endl; - using Log::global_log; - global_log->info() << " Molecule distances: " << _moleculeDistances << endl; + Log::global_log->info() << " Molecule distances: " << _moleculeDistances << std::endl; for (int i = 0; i < NUM_POTENTIALS; ++i) { std::string str = _potCounts[i].printNameKernelAndMacroCalls(); if (str.length() > 0) - global_log->info() << str; + Log::global_log->info() << str; } } @@ -126,7 +125,7 @@ FlopCounter::FlopCounter(double cutoffRadius, double LJCutoffRadius) : CellProce const int numThreads = mardyn_get_max_threads(); - global_log->info() << "FlopCounter: allocate data for " << numThreads << " threads." << std::endl; + Log::global_log->info() << "FlopCounter: allocate data for " << numThreads << " threads." << std::endl; _threadData.resize(numThreads); @@ -247,8 +246,8 @@ void FlopCounter::processCellPair(ParticleCell & c1, ParticleCell & c2, bool sum // is more efficient const bool calc_soa1_soa2 = (soa1.getMolNum() <= soa2.getMolNum()); - - + + if(sumAll) { // sumAll // if one cell is empty skip if (soa1.getMolNum() == 0 or soa2.getMolNum() == 0) { @@ -430,7 +429,7 @@ void FlopCounter::_calculatePairs(const CellDataSoARMM & soa1, const CellDataSoA unsigned long int i_lj = 0; unsigned long int i_mm = 0; - + const vcp_real_calc _ljCutSq_rc = static_cast(_LJCutoffRadiusSquare); RealCalcVec cutoffRadiusSquare = RealCalcVec::set1(_ljCutSq_rc); @@ -451,9 +450,9 @@ void FlopCounter::_calculatePairs(const CellDataSoARMM & soa1, const CellDataSoA } void FlopCounter::printStats() const { - global_log->info() << "FlopCounter stats: " << endl; + Log::global_log->info() << "FlopCounter stats: " << std::endl; _currentCounts.print(); - global_log->info() + Log::global_log->info() << "\tfraction of Flops for molecule dist: " - << getTotalMoleculeDistanceFlopCount() / getTotalFlopCount() << endl; + << getTotalMoleculeDistanceFlopCount() / getTotalFlopCount() << std::endl; } diff --git a/src/particleContainer/adapter/FlopCounter.h b/src/particleContainer/adapter/FlopCounter.h index 22aec1d8fd..59deaeac7d 100644 --- a/src/particleContainer/adapter/FlopCounter.h +++ b/src/particleContainer/adapter/FlopCounter.h @@ -83,7 +83,7 @@ class FlopCounter: public CellProcessor { * \brief Only pass through to child. */ void preprocessCell(ParticleCell& cell) {} - + double processSingleMolecule(Molecule* /*m1*/, ParticleCell& /*cell2*/) { return 0.0; } // why 0.0 flops??? @@ -93,7 +93,7 @@ class FlopCounter: public CellProcessor { void processCell(ParticleCell& cell); void processCellPair(ParticleCell& c1, ParticleCell& c2, bool sumAll = false); - + /** * \brief Only pass through to child. */ diff --git a/src/particleContainer/adapter/LegacyCellProcessor.cpp b/src/particleContainer/adapter/LegacyCellProcessor.cpp index 56143e16ae..480e0fda8b 100644 --- a/src/particleContainer/adapter/LegacyCellProcessor.cpp +++ b/src/particleContainer/adapter/LegacyCellProcessor.cpp @@ -12,8 +12,6 @@ #include "utils/Logger.h" #include -using namespace std; -using namespace Log; LegacyCellProcessor::LegacyCellProcessor(const double cutoffRadius, const double LJCutoffRadius, ParticlePairsHandler* particlePairsHandler) @@ -55,7 +53,7 @@ double LegacyCellProcessor::processSingleMolecule(Molecule* m1, ParticleCell& ce void LegacyCellProcessor::processCellPair(ParticleCell& cell1, ParticleCell& cell2, bool sumAll /* = false */) { double distanceVector[3]; - + auto begin1 = cell1.iterator(); auto begin2 = cell2.iterator(); @@ -63,9 +61,9 @@ void LegacyCellProcessor::processCellPair(ParticleCell& cell1, ParticleCell& cel // loop over all particles in the cell for (auto it1 = begin1; it1.isValid(); ++it1) { - Molecule& molecule1 = *it1; + Molecule& molecule1 = *it1; for (auto it2 = begin2; it2.isValid(); ++it2) { - Molecule& molecule2 = *it2; + Molecule& molecule2 = *it2; if(molecule1.getID() == molecule2.getID()) continue; // for grand canonical ensemble and traversal of pseudocells double dd = molecule2.dist2(molecule1, distanceVector); if (dd < _cutoffRadiusSquare) { diff --git a/src/particleContainer/adapter/LegacyCellProcessor.h b/src/particleContainer/adapter/LegacyCellProcessor.h index 5887b23840..db2f2a95aa 100644 --- a/src/particleContainer/adapter/LegacyCellProcessor.h +++ b/src/particleContainer/adapter/LegacyCellProcessor.h @@ -36,7 +36,7 @@ class LegacyCellProcessor : public CellProcessor { void initTraversal(); void preprocessCell(ParticleCell& /*cell*/) {} - + void processCellPair(ParticleCell& cell1, ParticleCell& cell2, bool sumAll = false); double processSingleMolecule(Molecule* m1, ParticleCell& cell2); diff --git a/src/particleContainer/adapter/ParticlePairs2LoadCalcAdapter.h b/src/particleContainer/adapter/ParticlePairs2LoadCalcAdapter.h index 35a1f88078..ae925103fb 100644 --- a/src/particleContainer/adapter/ParticlePairs2LoadCalcAdapter.h +++ b/src/particleContainer/adapter/ParticlePairs2LoadCalcAdapter.h @@ -46,7 +46,7 @@ class ParticlePairs2LoadCalcAdapter : public ParticlePairsHandler { MPI_CHECK( MPI_Allreduce(_globalLoadPerCell, temp, _globalNumCells, MPI_FLOAT, MPI_SUM, MPI_COMM_WORLD) ); delete[] _globalLoadPerCell; _globalLoadPerCell = temp; - //cout << "LocalLoad: " << _localLoad << endl; + //cout << "LocalLoad: " << _localLoad << std::endl; } //! @brief calculate force between pairs and collect macroscopic contribution diff --git a/src/particleContainer/adapter/ParticlePairs2PotForceAdapter.h b/src/particleContainer/adapter/ParticlePairs2PotForceAdapter.h index c45ec64e4f..108cf7f79c 100644 --- a/src/particleContainer/adapter/ParticlePairs2PotForceAdapter.h +++ b/src/particleContainer/adapter/ParticlePairs2PotForceAdapter.h @@ -51,7 +51,7 @@ class ParticlePairs2PotForceAdapter : public ParticlePairsHandler { //! @brief initialize macroscopic values //! //! each pair contributes to the macroscopic values (potential energy,...) - //! All those values are initialized with zero, and then for each pair, + //! All those values are initialized with zero, and then for each pair, //! they are increased by the pairs contribution void init() { _virial = 0; @@ -157,17 +157,17 @@ class ParticlePairs2PotForceAdapter : public ParticlePairsHandler { switch (pairType) { double dummy1, dummy2, dummy3, dummy4[3], Virial3[3]; - - case MOLECULE_MOLECULE : + + case MOLECULE_MOLECULE : // if ( _rdf != NULL ) _rdf->observeRDF(molecule1, molecule2, dd); // moved to RDFCellProcessor PotForce(molecule1, molecule2, params, distanceVector, my_threadData._upot6LJ, my_threadData._upotXpoles, my_threadData._myRF, Virial3, calculateLJ ); my_threadData._virial += 2*(Virial3[0]+Virial3[1]+Virial3[2]); return my_threadData._upot6LJ + my_threadData._upotXpoles; - case MOLECULE_HALOMOLECULE : + case MOLECULE_HALOMOLECULE : PotForce(molecule1, molecule2, params, distanceVector, dummy1, dummy2, dummy3, dummy4, calculateLJ); return 0.0; - case MOLECULE_MOLECULE_FLUID : + case MOLECULE_MOLECULE_FLUID : dummy1 = 0.0; // 6*U_LJ dummy2 = 0.0; // U_polarity dummy3 = 0.0; // U_dipole_reaction_field diff --git a/src/particleContainer/adapter/RDFCellProcessor.cpp b/src/particleContainer/adapter/RDFCellProcessor.cpp index 30be777bf9..d3c10920d5 100644 --- a/src/particleContainer/adapter/RDFCellProcessor.cpp +++ b/src/particleContainer/adapter/RDFCellProcessor.cpp @@ -12,8 +12,6 @@ #include "utils/Logger.h" #include -using namespace std; -using namespace Log; void RDFCellProcessor::processCell(ParticleCell& cell) { if (cell.isInnerCell() || cell.isBoundaryCell()) { @@ -38,7 +36,7 @@ void RDFCellProcessor::processCell(ParticleCell& cell) { double cosPhi = molecule1.orientationAngle(molecule2, dummy2, dd); double cosPhiReverse = molecule2.orientationAngle(molecule1, dummy3, dd); _rdf->observeARDFMolecule(dd, cosPhi, cosPhiReverse, molecule1.componentid(), molecule2.componentid()); - + } } } @@ -54,9 +52,9 @@ void RDFCellProcessor::processCellPair(ParticleCell& cell1, ParticleCell& cell2, // loop over all particles in the cell for (auto it1 = begin1; it1.isValid(); ++it1) { - Molecule& molecule1 = *it1; + Molecule& molecule1 = *it1; for (auto it2 = begin2; it2.isValid(); ++it2) { - Molecule& molecule2 = *it2; + Molecule& molecule2 = *it2; double dummy[3]; double dd = molecule2.dist2(molecule1, dummy); @@ -67,7 +65,7 @@ void RDFCellProcessor::processCellPair(ParticleCell& cell1, ParticleCell& cell2, double cosPhi = molecule1.orientationAngle(molecule2, dummy2, dd); double cosPhiReverse = molecule2.orientationAngle(molecule1, dummy3, dd); _rdf->observeARDFMolecule(dd, cosPhi, cosPhiReverse, molecule1.componentid(), molecule2.componentid()); - + } } } @@ -93,7 +91,7 @@ void RDFCellProcessor::processCellPair(ParticleCell& cell1, ParticleCell& cell2, double cosPhi = molecule1.orientationAngle(molecule2, dummy2, dd); double cosPhiReverse = molecule2.orientationAngle(molecule1, dummy3, dd); _rdf->observeARDFMolecule(dd, cosPhi, cosPhiReverse, molecule1.componentid(), molecule2.componentid()); - + } } } @@ -123,7 +121,7 @@ void RDFCellProcessor::processCellPair(ParticleCell& cell1, ParticleCell& cell2, double cosPhi = molecule1.orientationAngle(molecule2, dummy2, dd); double cosPhiReverse = molecule2.orientationAngle(molecule1, dummy3, dd); _rdf->observeARDFMolecule(dd, cosPhi, cosPhiReverse, molecule1.componentid(), molecule2.componentid()); - + } } } diff --git a/src/particleContainer/adapter/VCP1CLJRMM.cpp b/src/particleContainer/adapter/VCP1CLJRMM.cpp index bee488878f..503ee88584 100644 --- a/src/particleContainer/adapter/VCP1CLJRMM.cpp +++ b/src/particleContainer/adapter/VCP1CLJRMM.cpp @@ -15,17 +15,17 @@ VCP1CLJRMM::VCP1CLJRMM(Domain& domain, double cutoffRadius, double LJcutoffRadius) : CellProcessor(cutoffRadius, LJcutoffRadius), _domain(domain), _eps24(), _sig2(), _shift6(), _dtInvm(0.0), _upot6lj(0.0), _virial(0.0) { #if VCP_VEC_TYPE==VCP_NOVEC - global_log->info() << "VCP1CLJRMM: using no intrinsics." << std::endl; + Log::global_log->info() << "VCP1CLJRMM: using no intrinsics." << std::endl; #elif VCP_VEC_TYPE==VCP_VEC_SSE3 - global_log->info() << "VCP1CLJRMM: using SSE3 intrinsics." << std::endl; + Log::global_log->info() << "VCP1CLJRMM: using SSE3 intrinsics." << std::endl; #elif VCP_VEC_TYPE==VCP_VEC_AVX - global_log->info() << "VCP1CLJRMM: using AVX intrinsics." << std::endl; + Log::global_log->info() << "VCP1CLJRMM: using AVX intrinsics." << std::endl; #elif VCP_VEC_TYPE==VCP_VEC_AVX2 - global_log->info() << "VCP1CLJRMM: using AVX2 intrinsics." << std::endl; + Log::global_log->info() << "VCP1CLJRMM: using AVX2 intrinsics." << std::endl; #elif (VCP_VEC_TYPE==VCP_VEC_KNL) || (VCP_VEC_TYPE==VCP_VEC_KNL_GATHER) - global_log->info() << "VCP1CLJRMM: using KNL intrinsics." << std::endl; + Log::global_log->info() << "VCP1CLJRMM: using KNL intrinsics." << std::endl; #elif (VCP_VEC_TYPE==VCP_VEC_AVX512F) || (VCP_VEC_TYPE==VCP_VEC_AVX512F_GATHER) - global_log->info() << "VCP1CLJRMM: using SKX intrinsics." << std::endl; + Log::global_log->info() << "VCP1CLJRMM: using SKX intrinsics." << std::endl; #endif const Component& componentZero = _simulation.getEnsemble()->getComponents()->front(); @@ -42,12 +42,12 @@ VCP1CLJRMM::VCP1CLJRMM(Domain& domain, double cutoffRadius, double LJcutoffRadiu double dt = global_simulation->getIntegrator()->getTimestepLength(); _dtInvm = dt / componentZero.m(); } else { - global_log->info() << "VCP1CLJRMM: initialize dtInv2m via setter method necessary." << endl; + Log::global_log->info() << "VCP1CLJRMM: initialize dtInv2m via setter method necessary." << std::endl; } // initialize thread data _numThreads = mardyn_get_max_threads(); - global_log->info() << "VCP1CLJRMM: allocate data for " + Log::global_log->info() << "VCP1CLJRMM: allocate data for " << _numThreads << " threads." << std::endl; _threadData.resize(_numThreads); @@ -82,7 +82,7 @@ void VCP1CLJRMM::initTraversal() { _virial = 0.0; } // end pragma omp master - global_log->debug() << "VCP1CLJRMM::initTraversal()." << std::endl; + Log::global_log->debug() << "VCP1CLJRMM::initTraversal()." << std::endl; } void VCP1CLJRMM::processCellPair(ParticleCell& cell1, ParticleCell& cell2, bool sumAll) { @@ -113,11 +113,11 @@ void VCP1CLJRMM::processCellPair(ParticleCell& cell1, ParticleCell& cell2, bool // This saves the Molecule::isLessThan checks // and works similar to the "Half-Shell" scheme - const bool ApplyCutoff = true; - + const bool ApplyCutoff = true; + if(sumAll) { // sumAll const bool CalculateMacroscopic = true; // is now always set to true - + if (calc_soa1_soa2) { _calculatePairs, CalculateMacroscopic, MaskGatherC>(soa1, soa2); } else { diff --git a/src/particleContainer/adapter/VCP1CLJRMM.h b/src/particleContainer/adapter/VCP1CLJRMM.h index 25c87c90d5..f5b6bc0e60 100644 --- a/src/particleContainer/adapter/VCP1CLJRMM.h +++ b/src/particleContainer/adapter/VCP1CLJRMM.h @@ -37,9 +37,9 @@ class VCP1CLJRMM: public CellProcessor { * \brief Load the CellDataSoA for cell. */ void preprocessCell(ParticleCell& /*cell*/) {} - + void processCellPair(ParticleCell& cell1, ParticleCell& cell2, bool sumAll = false /* related to ZonalMethod */); - + double processSingleMolecule(Molecule* /*m1*/, ParticleCell& /*cell2*/) { return 0.0; } @@ -64,7 +64,7 @@ class VCP1CLJRMM: public CellProcessor { double getDtInvm() const { return _dtInvm; } - + private: /** * \brief The Domain where macroscopic values will be stored. diff --git a/src/particleContainer/adapter/VectorizedCellProcessor.cpp b/src/particleContainer/adapter/VectorizedCellProcessor.cpp index 04ff55c092..b500dffe77 100644 --- a/src/particleContainer/adapter/VectorizedCellProcessor.cpp +++ b/src/particleContainer/adapter/VectorizedCellProcessor.cpp @@ -15,27 +15,25 @@ #include #include "vectorization/MaskGatherChooser.h" -using namespace Log; -using namespace std; VectorizedCellProcessor::VectorizedCellProcessor(Domain & domain, double cutoffRadius, double LJcutoffRadius) : CellProcessor(cutoffRadius, LJcutoffRadius), _domain(domain), // maybe move the following to somewhere else: - _epsRFInvrc3(2. * (domain.getepsilonRF() - 1.) / ((cutoffRadius * cutoffRadius * cutoffRadius) * (2. * domain.getepsilonRF() + 1.))), + _epsRFInvrc3(2. * (domain.getepsilonRF() - 1.) / ((cutoffRadius * cutoffRadius * cutoffRadius) * (2. * domain.getepsilonRF() + 1.))), _eps_sig(), _shift6(), _upot6lj(0.0), _upotXpoles(0.0), _virial(0.0), _myRF(0.0){ #if VCP_VEC_TYPE==VCP_NOVEC - global_log->info() << "VectorizedCellProcessor: using no intrinsics." << std::endl; + Log::global_log->info() << "VectorizedCellProcessor: using no intrinsics." << std::endl; #elif VCP_VEC_TYPE==VCP_VEC_SSE3 - global_log->info() << "VectorizedCellProcessor: using SSE3 intrinsics." << std::endl; + Log::global_log->info() << "VectorizedCellProcessor: using SSE3 intrinsics." << std::endl; #elif VCP_VEC_TYPE==VCP_VEC_AVX - global_log->info() << "VectorizedCellProcessor: using AVX intrinsics." << std::endl; + Log::global_log->info() << "VectorizedCellProcessor: using AVX intrinsics." << std::endl; #elif VCP_VEC_TYPE==VCP_VEC_AVX2 - global_log->info() << "VectorizedCellProcessor: using AVX2 intrinsics." << std::endl; + Log::global_log->info() << "VectorizedCellProcessor: using AVX2 intrinsics." << std::endl; #elif (VCP_VEC_TYPE==VCP_VEC_KNL) || (VCP_VEC_TYPE==VCP_VEC_KNL_GATHER) - global_log->info() << "VectorizedCellProcessor: using KNL intrinsics." << std::endl; + Log::global_log->info() << "VectorizedCellProcessor: using KNL intrinsics." << std::endl; #elif (VCP_VEC_TYPE==VCP_VEC_AVX512F) || (VCP_VEC_TYPE==VCP_VEC_AVX512F_GATHER) - global_log->info() << "VectorizedCellProcessor: using SKX intrinsics." << std::endl; + Log::global_log->info() << "VectorizedCellProcessor: using SKX intrinsics." << std::endl; #endif ComponentList components = *(_simulation.getEnsemble()->getComponents()); @@ -84,7 +82,7 @@ VectorizedCellProcessor::VectorizedCellProcessor(Domain & domain, double cutoffR // initialize thread data _numThreads = mardyn_get_max_threads(); - global_log->info() << "VectorizedCellProcessor: allocate data for " << _numThreads << " threads." << std::endl; + Log::global_log->info() << "VectorizedCellProcessor: allocate data for " << _numThreads << " threads." << std::endl; _threadData.resize(_numThreads); #if defined(_OPENMP) @@ -2764,7 +2762,7 @@ void VectorizedCellProcessor::processCellPair(ParticleCell & c1, ParticleCell & // is more efficient const bool calc_soa1_soa2 = (soa1.getMolNum() <= soa2.getMolNum()); - + if(sumAll) { // Macroscopic conditions: Compute always diff --git a/src/particleContainer/adapter/VectorizedCellProcessor.h b/src/particleContainer/adapter/VectorizedCellProcessor.h index 2062d0fe58..c41d5b5322 100644 --- a/src/particleContainer/adapter/VectorizedCellProcessor.h +++ b/src/particleContainer/adapter/VectorizedCellProcessor.h @@ -58,9 +58,9 @@ class VectorizedCellProcessor : public CellProcessor { * \brief Calculate forces between pairs of Molecules in cell. */ void processCell(ParticleCell& cell); - + void processCellPair(ParticleCell& cell1, ParticleCell& cell2, bool sumAll = false); - + /** * \brief Free the LennardJonesSoA for cell. */ diff --git a/src/particleContainer/adapter/tests/VectorizedCellProcessorTest.cpp b/src/particleContainer/adapter/tests/VectorizedCellProcessorTest.cpp index 1befe11969..bb809c6a9b 100644 --- a/src/particleContainer/adapter/tests/VectorizedCellProcessorTest.cpp +++ b/src/particleContainer/adapter/tests/VectorizedCellProcessorTest.cpp @@ -322,15 +322,15 @@ void VectorizedCellProcessorTest::testElectrostaticVectorization(const char* fil } if(printStats) { - test_log->info() << endl; - test_log->info() << "max_abs_F: " << max_abs_F << endl; - test_log->info() << "max_abs_M: " << max_abs_M << endl; - test_log->info() << "max_abs_Vi: " << max_abs_Vi << endl; - test_log->info() << "mean_abs_F: " << mean_abs_F / counter << endl; - test_log->info() << "mean_abs_M: " << mean_abs_M / counter << endl; - test_log->info() << "mean_abs_Vi: " << mean_abs_Vi / counter << endl; - test_log->info() << "upot: " << std::abs(legacy_u_pot - vectorized_u_pot) << endl; - test_log->info() << "viri: " << std::abs(legacy_virial - vectorized_virial) << endl; + test_log->info() << std::endl; + test_log->info() << "max_abs_F: " << max_abs_F << std::endl; + test_log->info() << "max_abs_M: " << max_abs_M << std::endl; + test_log->info() << "max_abs_Vi: " << max_abs_Vi << std::endl; + test_log->info() << "mean_abs_F: " << mean_abs_F / counter << std::endl; + test_log->info() << "mean_abs_M: " << mean_abs_M / counter << std::endl; + test_log->info() << "mean_abs_Vi: " << mean_abs_Vi / counter << std::endl; + test_log->info() << "upot: " << std::abs(legacy_u_pot - vectorized_u_pot) << std::endl; + test_log->info() << "viri: " << std::abs(legacy_virial - vectorized_virial) << std::endl; } // Assert that macroscopic quantities are the same diff --git a/src/particleContainer/handlerInterfaces/ParticlePairsHandler.h b/src/particleContainer/handlerInterfaces/ParticlePairsHandler.h index bb11b57f4a..47b5cf20fb 100644 --- a/src/particleContainer/handlerInterfaces/ParticlePairsHandler.h +++ b/src/particleContainer/handlerInterfaces/ParticlePairsHandler.h @@ -11,14 +11,14 @@ typedef enum { //! @brief interface for defining the action performed when processing a pair //! @author Martin Buchholz -//! +//! //! The idea of a ParticleContainer is, that the container itself only knows //! about how to efficiently store and access Particles (or neighbouring pairs -//! of Particles) It doesn't know anything (exception follows) about the -//! internal structure of a Particle, or what action should be performed for +//! of Particles) It doesn't know anything (exception follows) about the +//! internal structure of a Particle, or what action should be performed for //! a pair of particles (an action could e.g. be to calculate the force). //! The only thing that has to be known from a particle is it's position. -//! +//! //! An application e.g. wants to find all neighbouring particle pairs and //! calculate the forces between them. The retrieval of the pairs has to be //! done by the ParticleContainer, but the force calculation has to be diff --git a/src/particleContainer/tests/ParticleContainerFactory.cpp b/src/particleContainer/tests/ParticleContainerFactory.cpp index 46f9cc9116..68fe537a99 100644 --- a/src/particleContainer/tests/ParticleContainerFactory.cpp +++ b/src/particleContainer/tests/ParticleContainerFactory.cpp @@ -26,7 +26,6 @@ #include #include -using namespace Log; ParticleContainer* ParticleContainerFactory::createEmptyParticleContainer(Type type) { if (type == LinkedCell) { @@ -42,7 +41,7 @@ ParticleContainer* ParticleContainerFactory::createEmptyParticleContainer(Type t return container; } else { - global_log->error() << "ParticleContainerFactory: Unsupported type requested! " << std::endl; + Log::global_log->error() << "ParticleContainerFactory: Unsupported type requested! " << std::endl; return nullptr; } } @@ -88,7 +87,7 @@ ParticleContainer* ParticleContainerFactory::createInitializedParticleContainer( } #endif } else { - global_log->error() << "ParticleContainerFactory: Unsupported type requested! " << std::endl; + Log::global_log->error() << "ParticleContainerFactory: Unsupported type requested! " << std::endl; return nullptr; } diff --git a/src/plugins/COMaligner.cpp b/src/plugins/COMaligner.cpp index 152eb81c7b..f72ca4c378 100755 --- a/src/plugins/COMaligner.cpp +++ b/src/plugins/COMaligner.cpp @@ -1,196 +1,196 @@ -/* - * COMaligner.cpp - * - * Created on: 7 May 2018 - * Author: kruegener - */ - -#include "COMaligner.h" - -//! @brief will be called to read configuration -//! -//! All values have defaults and are not mandatory to be supplied
-//! -//! Defaults are:
-//! bool X, Y, Z: all true (alignment on all Axis)
-//! int interval: 25 (alignment every 25th simstep)
-//! float correctionFactor: 1 (full alignment)
-//! -//! \param xmlconfig read from config.xml -void COMaligner::readXML(XMLfileUnits& xmlconfig){ - - xmlconfig.getNodeValue("x", _alignX); - xmlconfig.getNodeValue("y", _alignY); - xmlconfig.getNodeValue("z", _alignZ); - xmlconfig.getNodeValue("interval", _interval); - xmlconfig.getNodeValue("correctionFactor", _alignmentCorrection); - - // SANITY CHECK - if(_interval < 1 || _alignmentCorrection < 0 || _alignmentCorrection > 1){ - global_log -> error() << "[COMaligner] INVALID CONFIGURATION!!! DISABLED!" << std::endl; - global_log -> error() << "[COMaligner] HALTING SIMULATION" << std::endl; - _enabled = false; - // HALT SIM - Simulation::exit(1); - return; - } - - global_log -> info() << "[COMaligner] settings:" << std::endl; - global_log -> info() << " x: " << _alignX << std::endl; - global_log -> info() << " y: " << _alignY << std::endl; - global_log -> info() << " z: " << _alignZ << std::endl; - global_log -> info() << " interval: " << _interval << std::endl; - global_log -> info() << " correctionFactor: " << _alignmentCorrection << std::endl; - - // Setting up different cases here to save on if statements in the simulation phase - _dim_step = 1; - if(_alignX){ - _dim_start = 0; - if(_alignY){ - if(_alignZ){ - // X Y Z - _dim_end = 3; - } - else{ - // X Y - _dim_end = 2; - } - } - else if(_alignZ){ - // X Z - _dim_step = 2; - _dim_end = 3; - } - else{ - // X - _dim_end = 1; - } - } - else if(_alignY){ - _dim_start = 1; - if(_alignZ){ - // Y Z - _dim_end = 3; - } - else{ - // Y - _dim_end = 2; - } - } - else if(_alignZ){ - // Z - _dim_start = 2; - _dim_end = 3; - } - else{ - _enabled = false; - } - - global_log -> debug() << "[COMaligner] dim settings are: " << _dim_start << " " << _dim_end << " " << _dim_step << std::endl; - -} - -//! @brief called before Forces are applied -//! calculates realignment motion that is applied after the forces have been applied
-//! only calculates motion on specified dimensions -//! -//! \param particleContainer -//! \param domainDecomp -//! \param simstep -void COMaligner::beforeForces(ParticleContainer* particleContainer, - DomainDecompBase* domainDecomp, - unsigned long simstep) { - - if(_enabled) { - - global_log->debug() << "[COMaligner] before forces called" << std::endl; - - if ((simstep - 1) % _interval != 0) { - return; - } - - // RESET - for (unsigned d = 0; d < 3; d++) { - _balance[d] = 0.0; - _motion[d] = 0.0; - } - _mass = 0; - - // ITERATE OVER PARTICLES - for (auto tm = particleContainer->iterator(ParticleIterator::ONLY_INNER_AND_BOUNDARY); tm.isValid(); ++tm) { - double partMass = tm->mass(); - _mass += partMass; - for (int d = _dim_start; d < _dim_end; d += _dim_step) { - _balance[d] += tm->r(d) * partMass; - } - } - - // COMMUNICATION - domainDecomp->collCommInit(4); - for (int d = 0; d < 3; d++) { - domainDecomp->collCommAppendDouble(_balance[d]); - } - domainDecomp->collCommAppendDouble(_mass); - domainDecomp->collCommAllreduceSum(); - for (int d = 0; d < 3; d++) { - _balance[d] = domainDecomp->collCommGetDouble(); - } - _mass = domainDecomp->collCommGetDouble(); - domainDecomp->collCommFinalize(); - - // CALCULATE MOTION - for (int d = _dim_start; d < _dim_end; d += _dim_step) { - _motion[d] = -_alignmentCorrection * ((_balance[d] / _mass) - .5 * _boxLength[d]); - } - global_log->info() << "[COMaligner] motion is x: " << _motion[0] << " y: " << _motion[1] << " z: " << _motion[2] - << std::endl; - - // AVOID MOVES LARGER THAN ONE CUTOFF RADIUS - double totalMotion = sqrt(_motion[0]*_motion[0]+_motion[1]*_motion[1]+_motion[2]*_motion[2]); - if(totalMotion > _cutoff){ - double factor = _cutoff/totalMotion; - for(int d = 0; d < 3; d++){ - _motion[d] *= factor; - } - global_log->info() << "[COMaligner] Motion larger than Cutoff Radius. Reducing Motion" << _motion[2] - << std::endl; - global_log->info() << "[COMaligner] New motion is x: " << _motion[0] << " y: " << _motion[1] << " z: " << _motion[2] - << std::endl; - } - - // MOVE - for(auto tm = particleContainer->iterator(ParticleIterator::ONLY_INNER_AND_BOUNDARY); tm.isValid(); ++tm){ - for (int d = _dim_start; d < _dim_end; d += _dim_step){ - tm->move(d, _motion[d]); - } - } - - } - else{ - global_log->info() << "[COMaligner] DISABLED, all dims set to 0" << std::endl; - } - - // TODO: Check for OpenMP implementation of above for-loop -} - -//! @brief called after Forces are applied -//! applies the motion calculated earlier -//! -//! \param particleContainer -//! \param domainDecomp -//! \param domain -//! \param simstep -//! \param lmu -//! \param mcav -void COMaligner::endStep(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain, - unsigned long simstep) { - - // Moved to before Forces - /*if(_enabled){ - for(auto tm = particleContainer->iterator(); tm.isValid(); ++tm){ - for (int d = _dim_start; d < _dim_end; d += _dim_step){ - tm->move(d, _motion[d]); - } - } - }*/ -} +/* + * COMaligner.cpp + * + * Created on: 7 May 2018 + * Author: kruegener + */ + +#include "COMaligner.h" + +//! @brief will be called to read configuration +//! +//! All values have defaults and are not mandatory to be supplied
+//! +//! Defaults are:
+//! bool X, Y, Z: all true (alignment on all Axis)
+//! int interval: 25 (alignment every 25th simstep)
+//! float correctionFactor: 1 (full alignment)
+//! +//! \param xmlconfig read from config.xml +void COMaligner::readXML(XMLfileUnits& xmlconfig){ + + xmlconfig.getNodeValue("x", _alignX); + xmlconfig.getNodeValue("y", _alignY); + xmlconfig.getNodeValue("z", _alignZ); + xmlconfig.getNodeValue("interval", _interval); + xmlconfig.getNodeValue("correctionFactor", _alignmentCorrection); + + // SANITY CHECK + if(_interval < 1 || _alignmentCorrection < 0 || _alignmentCorrection > 1){ + Log::global_log -> error() << "[COMaligner] INVALID CONFIGURATION!!! DISABLED!" << std::endl; + Log::global_log -> error() << "[COMaligner] HALTING SIMULATION" << std::endl; + _enabled = false; + // HALT SIM + Simulation::exit(1); + return; + } + + Log::global_log -> info() << "[COMaligner] settings:" << std::endl; + Log::global_log -> info() << " x: " << _alignX << std::endl; + Log::global_log -> info() << " y: " << _alignY << std::endl; + Log::global_log -> info() << " z: " << _alignZ << std::endl; + Log::global_log -> info() << " interval: " << _interval << std::endl; + Log::global_log -> info() << " correctionFactor: " << _alignmentCorrection << std::endl; + + // Setting up different cases here to save on if statements in the simulation phase + _dim_step = 1; + if(_alignX){ + _dim_start = 0; + if(_alignY){ + if(_alignZ){ + // X Y Z + _dim_end = 3; + } + else{ + // X Y + _dim_end = 2; + } + } + else if(_alignZ){ + // X Z + _dim_step = 2; + _dim_end = 3; + } + else{ + // X + _dim_end = 1; + } + } + else if(_alignY){ + _dim_start = 1; + if(_alignZ){ + // Y Z + _dim_end = 3; + } + else{ + // Y + _dim_end = 2; + } + } + else if(_alignZ){ + // Z + _dim_start = 2; + _dim_end = 3; + } + else{ + _enabled = false; + } + + Log::global_log -> debug() << "[COMaligner] dim settings are: " << _dim_start << " " << _dim_end << " " << _dim_step << std::endl; + +} + +//! @brief called before Forces are applied +//! calculates realignment motion that is applied after the forces have been applied
+//! only calculates motion on specified dimensions +//! +//! \param particleContainer +//! \param domainDecomp +//! \param simstep +void COMaligner::beforeForces(ParticleContainer* particleContainer, + DomainDecompBase* domainDecomp, + unsigned long simstep) { + + if(_enabled) { + + Log::global_log->debug() << "[COMaligner] before forces called" << std::endl; + + if ((simstep - 1) % _interval != 0) { + return; + } + + // RESET + for (unsigned d = 0; d < 3; d++) { + _balance[d] = 0.0; + _motion[d] = 0.0; + } + _mass = 0; + + // ITERATE OVER PARTICLES + for (auto tm = particleContainer->iterator(ParticleIterator::ONLY_INNER_AND_BOUNDARY); tm.isValid(); ++tm) { + double partMass = tm->mass(); + _mass += partMass; + for (int d = _dim_start; d < _dim_end; d += _dim_step) { + _balance[d] += tm->r(d) * partMass; + } + } + + // COMMUNICATION + domainDecomp->collCommInit(4); + for (int d = 0; d < 3; d++) { + domainDecomp->collCommAppendDouble(_balance[d]); + } + domainDecomp->collCommAppendDouble(_mass); + domainDecomp->collCommAllreduceSum(); + for (int d = 0; d < 3; d++) { + _balance[d] = domainDecomp->collCommGetDouble(); + } + _mass = domainDecomp->collCommGetDouble(); + domainDecomp->collCommFinalize(); + + // CALCULATE MOTION + for (int d = _dim_start; d < _dim_end; d += _dim_step) { + _motion[d] = -_alignmentCorrection * ((_balance[d] / _mass) - .5 * _boxLength[d]); + } + Log::global_log->info() << "[COMaligner] motion is x: " << _motion[0] << " y: " << _motion[1] << " z: " << _motion[2] + << std::endl; + + // AVOID MOVES LARGER THAN ONE CUTOFF RADIUS + double totalMotion = sqrt(_motion[0]*_motion[0]+_motion[1]*_motion[1]+_motion[2]*_motion[2]); + if(totalMotion > _cutoff){ + double factor = _cutoff/totalMotion; + for(int d = 0; d < 3; d++){ + _motion[d] *= factor; + } + Log::global_log->info() << "[COMaligner] Motion larger than Cutoff Radius. Reducing Motion" << _motion[2] + << std::endl; + Log::global_log->info() << "[COMaligner] New motion is x: " << _motion[0] << " y: " << _motion[1] << " z: " << _motion[2] + << std::endl; + } + + // MOVE + for(auto tm = particleContainer->iterator(ParticleIterator::ONLY_INNER_AND_BOUNDARY); tm.isValid(); ++tm){ + for (int d = _dim_start; d < _dim_end; d += _dim_step){ + tm->move(d, _motion[d]); + } + } + + } + else{ + Log::global_log->info() << "[COMaligner] DISABLED, all dims set to 0" << std::endl; + } + + // TODO: Check for OpenMP implementation of above for-loop +} + +//! @brief called after Forces are applied +//! applies the motion calculated earlier +//! +//! \param particleContainer +//! \param domainDecomp +//! \param domain +//! \param simstep +//! \param lmu +//! \param mcav +void COMaligner::endStep(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain, + unsigned long simstep) { + + // Moved to before Forces + /*if(_enabled){ + for(auto tm = particleContainer->iterator(); tm.isValid(); ++tm){ + for (int d = _dim_start; d < _dim_end; d += _dim_step){ + tm->move(d, _motion[d]); + } + } + }*/ +} diff --git a/src/plugins/COMaligner.h b/src/plugins/COMaligner.h index c668309eb1..0fd5584e9f 100755 --- a/src/plugins/COMaligner.h +++ b/src/plugins/COMaligner.h @@ -71,7 +71,7 @@ class COMaligner : public PluginBase{ ~COMaligner(){}; void init(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, Domain* domain) override { - global_log -> debug() << "COM Realignment enabled" << std::endl; + Log::global_log -> debug() << "COM Realignment enabled" << std::endl; for(unsigned d = 0; d < 3; d++){ _boxLength[d] = domain->getGlobalLength(d); diff --git a/src/plugins/DirectedPM.cpp b/src/plugins/DirectedPM.cpp index 4d76d0e047..3af8f591aa 100644 --- a/src/plugins/DirectedPM.cpp +++ b/src/plugins/DirectedPM.cpp @@ -29,22 +29,22 @@ void DirectedPM::readXML(XMLfileUnits& xmlconfig) { xmlconfig.getNodeValue("heightMembrane", _heightMembrane); // height for neglecting the influence of the membrane xmlconfig.getNodeValue("outputFrequency", _outputFrequency); // Averaged time steps - global_log->info() << "[DirectedPM] settings:" << std::endl; - global_log->info() << " Component: " << _component << std::endl; - global_log->info() << " r: " << _rIncrements << std::endl; - global_log->info() << " h: " << _hIncrements << std::endl; - global_log->info() << " phi: " << _phiIncrements << std::endl; - global_log->info() << " rohCutLiq: " << _rohCutLiq << std::endl; - global_log->info() << " percent: " << _percent << std::endl; - global_log->info() << " heightWall: " << _heightWall << std::endl; - global_log->info() << " heightMembrane: " << _heightMembrane << std::endl; - global_log->info() << " outputFrequency: " << _outputFrequency << std::endl; + Log::global_log->info() << "[DirectedPM] settings:" << std::endl; + Log::global_log->info() << " Component: " << _component << std::endl; + Log::global_log->info() << " r: " << _rIncrements << std::endl; + Log::global_log->info() << " h: " << _hIncrements << std::endl; + Log::global_log->info() << " phi: " << _phiIncrements << std::endl; + Log::global_log->info() << " rohCutLiq: " << _rohCutLiq << std::endl; + Log::global_log->info() << " percent: " << _percent << std::endl; + Log::global_log->info() << " heightWall: " << _heightWall << std::endl; + Log::global_log->info() << " heightMembrane: " << _heightMembrane << std::endl; + Log::global_log->info() << " outputFrequency: " << _outputFrequency << std::endl; } void DirectedPM::beforeForces(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, unsigned long simstep) { if (_enabled) { - global_log->debug() << "[DirectedPM] before forces called" << std::endl; + Log::global_log->debug() << "[DirectedPM] before forces called" << std::endl; // CALCULATE SYNSIMSTEP FOR MATRIX double synsimstep; @@ -100,18 +100,18 @@ void DirectedPM::beforeForces(ParticleContainer* particleContainer, DomainDecomp (phiUN < _phiIncrements)) { unID = (hUN * _rIncrements * _phiIncrements) + (rUN * _phiIncrements) + phiUN; } else { - global_log->error() + Log::global_log->error() << "INV PROFILE UNITS " << _universalInvProfileUnit[0] << " " << _universalInvProfileUnit[1] << " " << _universalInvProfileUnit[2] << "\n"; - global_log->error() << "PROFILE UNITS " << _rIncrements << " " << _hIncrements << " " + Log::global_log->error() << "PROFILE UNITS " << _rIncrements << " " << _hIncrements << " " << _phiIncrements << "\n"; - global_log->error() << "Severe error!! Invalid profile ID (" << rUN << " / " << hUN << " / " + Log::global_log->error() << "Severe error!! Invalid profile ID (" << rUN << " / " << hUN << " / " << phiUN << ").\n\n"; - global_log->error() << "Severe error!! Invalid profile unit (" << R2 << " / " << yc << " / " + Log::global_log->error() << "Severe error!! Invalid profile unit (" << R2 << " / " << yc << " / " << phi << ").\n\n"; - global_log->error() + Log::global_log->error() << "Coordinates off center (" << xc << " / " << yc << " / " << zc << ").\n"; - global_log->error() << "unID = " << unID << "\n"; + Log::global_log->error() << "unID = " << unID << "\n"; Simulation::exit(707); } // ADD VELOCITCY AND VIRIAL TO RESPECTIVE BIN @@ -375,12 +375,12 @@ void DirectedPM::beforeForces(ParticleContainer* particleContainer, DomainDecomp << _xyzEkinDroplet[_outputFrequency] / (3 * particleDropletTrue) << " \t\t " << TxzGAS << " \t\t " << TxzDROPLET << " \t\t " << _xzEkinGas[_outputFrequency] / (2 * particleDropletFalse) << " \t\t " - << _xzEkinDroplet[_outputFrequency] / (2 * particleDropletTrue) << endl; + << _xzEkinDroplet[_outputFrequency] / (2 * particleDropletTrue) << std::endl; } _DPMGlobalStream.close(); // 2D DENSITY OUTPUT - DPMStreamDensity.open("drop_MK_DirectedPM_" + to_string(simstep) + ".NDpr", std::ios::out); + DPMStreamDensity.open("drop_MK_DirectedPM_" + std::to_string(simstep) + ".NDpr", std::ios::out); DPMStreamDensity.precision(6); // Write Header DPMStreamDensity << "//Segment volume: " << _volumebox @@ -413,7 +413,7 @@ void DirectedPM::beforeForces(ParticleContainer* particleContainer, DomainDecomp DPMStreamDensity.close(); // 2D Temperature OUTPUT - DPMStreamTemperature.open("drop_MK_DirectedPM_" + to_string(simstep) + ".Temppr", std::ios::out); + DPMStreamTemperature.open("drop_MK_DirectedPM_" + std::to_string(simstep) + ".Temppr", std::ios::out); DPMStreamTemperature.precision(6); // Write Header DPMStreamTemperature << "//Segment volume: " << _volumebox @@ -438,7 +438,7 @@ void DirectedPM::beforeForces(ParticleContainer* particleContainer, DomainDecomp for (unsigned phiID = 0; phiID < _phiIncrements; phiID++) { for (unsigned r = 0; r < _rIncrements; r++) { auto ID = (long)(h * _rIncrements * _phiIncrements + r * _phiIncrements + phiID); - if (isnan(_temperatureBox[ID])) { + if (std::isnan(_temperatureBox[ID])) { _temperatureBox[ID] = 0.; } DPMStreamTemperature << _temperatureBox[ID] << "\t"; @@ -449,7 +449,7 @@ void DirectedPM::beforeForces(ParticleContainer* particleContainer, DomainDecomp DPMStreamTemperature.close(); // 2D TemperatureXZ OUTPUT - DPMStreamTemperatureXZ.open("drop_MK_DirectedPM_" + to_string(simstep) + ".TempprXZ", std::ios::out); + DPMStreamTemperatureXZ.open("drop_MK_DirectedPM_" + std::to_string(simstep) + ".TempprXZ", std::ios::out); DPMStreamTemperatureXZ.precision(6); // Write Header DPMStreamTemperatureXZ << "//Segment volume: " << _volumebox @@ -475,7 +475,7 @@ void DirectedPM::beforeForces(ParticleContainer* particleContainer, DomainDecomp for (unsigned phiID = 0; phiID < _phiIncrements; phiID++) { for (unsigned r = 0; r < _rIncrements; r++) { auto ID = (long)(h * _rIncrements * _phiIncrements + r * _phiIncrements + phiID); - if (isnan(_temperatureBoxXZ[ID])) { + if (std::isnan(_temperatureBoxXZ[ID])) { _temperatureBoxXZ[ID] = 0.; } DPMStreamTemperatureXZ << _temperatureBoxXZ[ID] << "\t"; @@ -486,7 +486,7 @@ void DirectedPM::beforeForces(ParticleContainer* particleContainer, DomainDecomp DPMStreamTemperatureXZ.close(); // 2D Ekin OUTPUT - DPMStreamEkin.open("drop_MK_DirectedPM_" + to_string(simstep) + ".Ekin", std::ios::out); + DPMStreamEkin.open("drop_MK_DirectedPM_" + std::to_string(simstep) + ".Ekin", std::ios::out); DPMStreamEkin.precision(6); // Write Header DPMStreamEkin << "//Segment volume: " << _volumebox << "\n//Accumulated data sets: " << _outputFrequency @@ -516,7 +516,7 @@ void DirectedPM::beforeForces(ParticleContainer* particleContainer, DomainDecomp DPMStreamEkin.close(); // 2D VIRIAL OUTPUT - DPMStreamVirial.open("drop_MK_DirectedPM_" + to_string(simstep) + ".Vipr", std::ios::out); + DPMStreamVirial.open("drop_MK_DirectedPM_" + std::to_string(simstep) + ".Vipr", std::ios::out); DPMStreamVirial.precision(6); // Write Header DPMStreamVirial << "//Segment volume: " << _volumebox @@ -538,7 +538,7 @@ void DirectedPM::beforeForces(ParticleContainer* particleContainer, DomainDecomp for (unsigned phiID = 0; phiID < _phiIncrements; phiID++) { for (unsigned r = 0; r < _rIncrements; r++) { auto ID = (long)(h * _rIncrements * _phiIncrements + r * _phiIncrements + phiID); - if (isnan(_virialBox[ID])) { + if (std::isnan(_virialBox[ID])) { _virialBox[ID] = 0.; } DPMStreamVirial << _virialBox[ID] << "\t"; diff --git a/src/plugins/DirectedPM.h b/src/plugins/DirectedPM.h index e9a55c0e76..b700a64ba0 100644 --- a/src/plugins/DirectedPM.h +++ b/src/plugins/DirectedPM.h @@ -115,7 +115,7 @@ class DirectedPM : public PluginBase { public: void init(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, Domain* domain) override { - global_log->debug() << "DirectPM enabled" << std::endl; + Log::global_log->debug() << "DirectPM enabled" << std::endl; _firstTime = true; for (unsigned d = 0; d < 3; d++) { _boxLength[d] = domain->getGlobalLength(d); @@ -171,12 +171,12 @@ class DirectedPM : public PluginBase { _DPMGlobalStream.open("Global_output_DPM_MK.txt", std::ios::out); _DPMGlobalStream << "Ausgabe der globalen Gr��en gerichtete Geschwindigkeit, dichteGas, dichteLiq, druckGas, " "druckLiq, TGas, TLiq, EkinxyzGas, EkinxyzLiq, TGasXZ, TLiqXZ,EkinxzGas und EkinxzLiq," - << endl; - _DPMGlobalStream << endl; + << std::endl; + _DPMGlobalStream << std::endl; _DPMGlobalStream << "Timestept \t\t gerichtete Geschw. \t\t dichteGas \t\t dichteLiq \t\t druckGas \t\t " "druckLiq \t\t TGas \t\t TLiq \t\t EkinxyzGas \t\t EkinxyzLiq\t\t TGasXZ\t\t " "TLiqXZ\t\t EkinxzGas \t\t EkinxzLiq\t\t" - << endl; + << std::endl; _DPMGlobalStream.close(); } void readXML(XMLfileUnits& xmlconfig) override; diff --git a/src/plugins/Dropaccelerator.cpp b/src/plugins/Dropaccelerator.cpp index 2f8240edd9..2362bca8cb 100644 --- a/src/plugins/Dropaccelerator.cpp +++ b/src/plugins/Dropaccelerator.cpp @@ -28,22 +28,22 @@ void Dropaccelerator::readXML(XMLfileUnits& xmlconfig) { // SANITY CHECK if (_interval < 1 || _steps <= 0 || _startSimStep < 0 || _xPosition <= 0. || _yPosition <= 0. || _zPosition <= 0. || _dropRadius <= 0) { - global_log->error() << "[Dropaccelerator] INVALID CONFIGURATION!!! DISABLED!" << std::endl; - global_log->error() << "[Dropaccelerator] HALTING SIMULATION" << std::endl; + Log::global_log->error() << "[Dropaccelerator] INVALID CONFIGURATION!!! DISABLED!" << std::endl; + Log::global_log->error() << "[Dropaccelerator] HALTING SIMULATION" << std::endl; _enabled = false; // HALT SIM Simulation::exit(1); return; } - global_log->info() << "[Dropaccelerator] settings:" << std::endl; - global_log->info() << " xposition: " << _xPosition << std::endl; - global_log->info() << " yposition: " << _yPosition << std::endl; - global_log->info() << " zposition: " << _zPosition << std::endl; - global_log->info() << " dropradius: " << _dropRadius << std::endl; - global_log->info() << " velocity: " << _veloc << std::endl; - global_log->info() << " starttime: " << _startSimStep << std::endl; - global_log->info() << " steps: " << _steps << std::endl; + Log::global_log->info() << "[Dropaccelerator] settings:" << std::endl; + Log::global_log->info() << " xposition: " << _xPosition << std::endl; + Log::global_log->info() << " yposition: " << _yPosition << std::endl; + Log::global_log->info() << " zposition: " << _zPosition << std::endl; + Log::global_log->info() << " dropradius: " << _dropRadius << std::endl; + Log::global_log->info() << " velocity: " << _veloc << std::endl; + Log::global_log->info() << " starttime: " << _startSimStep << std::endl; + Log::global_log->info() << " steps: " << _steps << std::endl; } void Dropaccelerator::afterForces(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, @@ -51,7 +51,7 @@ void Dropaccelerator::afterForces(ParticleContainer* particleContainer, DomainDe double corrVeloc = _veloc / _steps; if (_enabled) { - global_log->debug() << "[Dropaccelerator] after forces called" << std::endl; + Log::global_log->debug() << "[Dropaccelerator] after forces called" << std::endl; if ((simstep - 1) % _interval != 0) { return; diff --git a/src/plugins/Dropaccelerator.h b/src/plugins/Dropaccelerator.h index 2c66acc634..3e7d7c15f2 100644 --- a/src/plugins/Dropaccelerator.h +++ b/src/plugins/Dropaccelerator.h @@ -55,7 +55,7 @@ class Dropaccelerator : public PluginBase { public: void init(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, Domain* domain) override { - global_log->debug() << "DropletAccelerator enabled" << std::endl; + Log::global_log->debug() << "DropletAccelerator enabled" << std::endl; for (unsigned d = 0; d < 3; d++) { _boxLength[d] = domain->getGlobalLength(d); diff --git a/src/plugins/Dropaligner.cpp b/src/plugins/Dropaligner.cpp index 563b486134..04f89d6a63 100644 --- a/src/plugins/Dropaligner.cpp +++ b/src/plugins/Dropaligner.cpp @@ -23,27 +23,27 @@ void Dropaligner::readXML(XMLfileUnits& xmlconfig) { // SANITY CHECK if (_interval < 1 || _alignmentCorrection < 0 || _alignmentCorrection > 1 || _xPos <= 0. || _yPos <= 0. || _zPos <= 0. || _radius <= 0) { - global_log->error() << "[Dropaligner] INVALID CONFIGURATION!!! DISABLED!" << std::endl; - global_log->error() << "[Dropaligner] HALTING SIMULATION" << std::endl; + Log::global_log->error() << "[Dropaligner] INVALID CONFIGURATION!!! DISABLED!" << std::endl; + Log::global_log->error() << "[Dropaligner] HALTING SIMULATION" << std::endl; _enabled = false; // HALT SIM Simulation::exit(1); return; } - global_log->info() << "[Dropaligner] settings:" << std::endl; - global_log->info() << " xpos: " << _xPos << std::endl; - global_log->info() << " ypos: " << _yPos << std::endl; - global_log->info() << " zpos: " << _zPos << std::endl; - global_log->info() << " radius: " << _radius << std::endl; - global_log->info() << " interval: " << _interval << std::endl; - global_log->info() << " correctionFactor: " << _alignmentCorrection << std::endl; + Log::global_log->info() << "[Dropaligner] settings:" << std::endl; + Log::global_log->info() << " xpos: " << _xPos << std::endl; + Log::global_log->info() << " ypos: " << _yPos << std::endl; + Log::global_log->info() << " zpos: " << _zPos << std::endl; + Log::global_log->info() << " radius: " << _radius << std::endl; + Log::global_log->info() << " interval: " << _interval << std::endl; + Log::global_log->info() << " correctionFactor: " << _alignmentCorrection << std::endl; } void Dropaligner::beforeForces(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, unsigned long simstep) { if (_enabled) { - global_log->debug() << "[Dropaligner] before forces called" << std::endl; + Log::global_log->debug() << "[Dropaligner] before forces called" << std::endl; if ((simstep - 1) % _interval != 0) { return; diff --git a/src/plugins/Dropaligner.h b/src/plugins/Dropaligner.h index 16225cb5b4..9e604534fb 100644 --- a/src/plugins/Dropaligner.h +++ b/src/plugins/Dropaligner.h @@ -52,7 +52,7 @@ class Dropaligner : public PluginBase { public: void init(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, Domain* domain) override { - global_log->debug() << "DropletRealignment enabled" << std::endl; + Log::global_log->debug() << "DropletRealignment enabled" << std::endl; for (unsigned d = 0; d < 3; d++) { _boxLength[d] = domain->getGlobalLength(d); diff --git a/src/plugins/ExamplePlugin.cpp b/src/plugins/ExamplePlugin.cpp index 51f8f6d5d1..8e65194345 100644 --- a/src/plugins/ExamplePlugin.cpp +++ b/src/plugins/ExamplePlugin.cpp @@ -11,52 +11,51 @@ #include "utils/xmlfileUnits.h" #include "utils/Logger.h" -using Log::global_log; void ExamplePlugin::readXML(XMLfileUnits& xmlconfig) { _writeFrequency = 1; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "Write frequency: " << _writeFrequency << std::endl; + Log::global_log->info() << "Write frequency: " << _writeFrequency << std::endl; _message = "Your code would be called here."; xmlconfig.getNodeValue("message", _message); - global_log->info() << "Output prefix: " << _message << std::endl; + Log::global_log->info() << "Output prefix: " << _message << std::endl; _displaySelector = WhereToDisplay::ALL; std::string displaySelectorString; xmlconfig.getNodeValue("where_to_display", displaySelectorString); - global_log->info() << "where to display: " << displaySelectorString + Log::global_log->info() << "where to display: " << displaySelectorString << std::endl; const char* str = displaySelectorString.c_str(); if (strcmp(str, "all") == 0) { _displaySelector = WhereToDisplay::ALL; - global_log->info() << "Displaying at all plugin positions." + Log::global_log->info() << "Displaying at all plugin positions." << std::endl; } else if (strcmp(str, "beforeEventNewTimestep") == 0) { _displaySelector = WhereToDisplay::BEFORE_EVENT_NEW_TIMESTEP; - global_log->info() << "Displaying at beforeEventNewTimestep." + Log::global_log->info() << "Displaying at beforeEventNewTimestep." << std::endl; } else if (strcmp(str, "beforeForces") == 0) { _displaySelector = WhereToDisplay::BEFORE_FORCES; - global_log->info() << "Displaying at beforeForces." << std::endl; + Log::global_log->info() << "Displaying at beforeForces." << std::endl; } else if (strcmp(str, "afterForces") == 0) { _displaySelector = WhereToDisplay::AFTER_FORCES; - global_log->info() << "Displaying at afterForces." << std::endl; + Log::global_log->info() << "Displaying at afterForces." << std::endl; } else if (strcmp(str, "endStep") == 0) { _displaySelector = WhereToDisplay::END_STEP; - global_log->info() << "Displaying at endStep." << std::endl; + Log::global_log->info() << "Displaying at endStep." << std::endl; } else if (strcmp(str, "init") == 0) { _displaySelector = WhereToDisplay::AT_INIT; - global_log->info() << "Displaying at init." << std::endl; + Log::global_log->info() << "Displaying at init." << std::endl; } else if (strcmp(str, "finish") == 0) { _displaySelector = WhereToDisplay::AT_FINISH; - global_log->info() << "Displaying at finish." << std::endl; + Log::global_log->info() << "Displaying at finish." << std::endl; } else { - global_log->error() + Log::global_log->error() << "Unknown option specified to ExamplePlugin::where_to_display." << std::endl; - global_log->error() + Log::global_log->error() << "Valid options are: all, beforeEventNewTimestep, beforeForces, afterForces, endStep, init, finish." << std::endl; Simulation::exit(11); @@ -67,7 +66,7 @@ void ExamplePlugin::init(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, Domain* domain) { if (_displaySelector == WhereToDisplay::ALL or _displaySelector == WhereToDisplay::AT_INIT) { - global_log->info() << "ExamplePlugin::init " << _message << endl; + Log::global_log->info() << "ExamplePlugin::init " << _message << std::endl; } } @@ -77,7 +76,7 @@ void ExamplePlugin::beforeEventNewTimestep(ParticleContainer* particleContainer, and (_displaySelector == WhereToDisplay::ALL or _displaySelector == WhereToDisplay::BEFORE_EVENT_NEW_TIMESTEP)) { - global_log->info() << "ExamplePlugin::beforeEventNewTimestep " << _message << endl; + Log::global_log->info() << "ExamplePlugin::beforeEventNewTimestep " << _message << std::endl; } } @@ -86,7 +85,7 @@ void ExamplePlugin::beforeForces(ParticleContainer* particleContainer, if (simstep % _writeFrequency == 0 and (_displaySelector == WhereToDisplay::ALL or _displaySelector == WhereToDisplay::BEFORE_FORCES)) { - global_log->info() << "ExamplePlugin::beforeForces " << _message << endl; + Log::global_log->info() << "ExamplePlugin::beforeForces " << _message << std::endl; } } @@ -95,7 +94,7 @@ void ExamplePlugin::afterForces(ParticleContainer* particleContainer, if (simstep % _writeFrequency == 0 and (_displaySelector == WhereToDisplay::ALL or _displaySelector == WhereToDisplay::AFTER_FORCES)) { - global_log->info() << "ExamplePlugin::afterForces " << _message << endl; + Log::global_log->info() << "ExamplePlugin::afterForces " << _message << std::endl; } } @@ -104,7 +103,7 @@ void ExamplePlugin::endStep(ParticleContainer* particleContainer, if (simstep % _writeFrequency == 0 and (_displaySelector == WhereToDisplay::ALL or _displaySelector == WhereToDisplay::END_STEP)) { - global_log->info() << "ExamplePlugin::endStep " << _message << endl; + Log::global_log->info() << "ExamplePlugin::endStep " << _message << std::endl; } } @@ -112,6 +111,6 @@ void ExamplePlugin::finish(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, Domain* domain) { if (_displaySelector == WhereToDisplay::ALL or _displaySelector == WhereToDisplay::AT_FINISH) { - global_log->info() << "ExamplePlugin::finish " << _message << endl; + Log::global_log->info() << "ExamplePlugin::finish " << _message << std::endl; } } diff --git a/src/plugins/FixRegion.cpp b/src/plugins/FixRegion.cpp index 645988eec5..aa3ca9dbb2 100644 --- a/src/plugins/FixRegion.cpp +++ b/src/plugins/FixRegion.cpp @@ -29,20 +29,20 @@ void FixRegion::init(ParticleContainer* particleContainer, DomainDecompBase* dom // SANITY CHECK if (_xMin < 0. || _yMin < 0. || _zMin < 0. || _xMax > _boxLength[0] || _yMax > _boxLength[1] || _zMax > _boxLength[2]) { - global_log->error() << "[FixRegion] INVALID INPUT!!! DISABLED!" << std::endl; - global_log->error() << "[FixRegion] HALTING SIMULATION" << std::endl; + Log::global_log->error() << "[FixRegion] INVALID INPUT!!! DISABLED!" << std::endl; + Log::global_log->error() << "[FixRegion] HALTING SIMULATION" << std::endl; // HALT SIM Simulation::exit(1); return; } - global_log->info() << "[FixRegion] settings:" << std::endl; - global_log->info() << " xmin: " << _xMin << std::endl; - global_log->info() << " ymin: " << _yMin << std::endl; - global_log->info() << " zmin: " << _zMin << std::endl; - global_log->info() << " xmax: " << _xMax << std::endl; - global_log->info() << " ymax: " << _yMax << std::endl; - global_log->info() << " zmax: " << _zMax << std::endl; + Log::global_log->info() << "[FixRegion] settings:" << std::endl; + Log::global_log->info() << " xmin: " << _xMin << std::endl; + Log::global_log->info() << " ymin: " << _yMin << std::endl; + Log::global_log->info() << " zmin: " << _zMin << std::endl; + Log::global_log->info() << " xmax: " << _xMax << std::endl; + Log::global_log->info() << " ymax: " << _yMax << std::endl; + Log::global_log->info() << " zmax: " << _zMax << std::endl; _molCount = 0; @@ -69,7 +69,7 @@ void FixRegion::init(ParticleContainer* particleContainer, DomainDecompBase* dom domainDecomp->collCommAllreduceSum(); _molCount = domainDecomp->collCommGetUnsLong(); domainDecomp->collCommFinalize(); - global_log->info() << _molCount << " molecules are inside a fixed region" << std::endl; + Log::global_log->info() << _molCount << " molecules are inside a fixed region" << std::endl; } void FixRegion::beforeForces(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, diff --git a/src/plugins/InMemoryCheckpointing.cpp b/src/plugins/InMemoryCheckpointing.cpp index a0a98e96d2..efb706ace9 100644 --- a/src/plugins/InMemoryCheckpointing.cpp +++ b/src/plugins/InMemoryCheckpointing.cpp @@ -14,16 +14,15 @@ #include "Domain.h" #include "parallel/DomainDecompBase.h" -using Log::global_log; void InMemoryCheckpointing::readXML(XMLfileUnits& xmlconfig) { _writeFrequency = 5; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "Write frequency: " << _writeFrequency << std::endl; + Log::global_log->info() << "Write frequency: " << _writeFrequency << std::endl; _restartAtIteration = 10; xmlconfig.getNodeValue("restartAtIteration", _restartAtIteration); - global_log->info() << "Restart at iteration (for development purposes): " << _restartAtIteration << std::endl; + Log::global_log->info() << "Restart at iteration (for development purposes): " << _restartAtIteration << std::endl; } void InMemoryCheckpointing::beforeEventNewTimestep( @@ -32,7 +31,7 @@ void InMemoryCheckpointing::beforeEventNewTimestep( if (simstep != _restartAtIteration) { return; } - global_log->info() << "InMemoryCheckpointWriter: resetting time to: " << _snapshot.getCurrentTime() << std::endl; + Log::global_log->info() << "InMemoryCheckpointWriter: resetting time to: " << _snapshot.getCurrentTime() << std::endl; Domain * domain = global_simulation->getDomain(); // erase all current molecules @@ -67,7 +66,7 @@ void InMemoryCheckpointing::endStep(ParticleContainer* particleContainer, } // else, write snapshot - global_log->info() << "InMemoryCheckpointWriter: writing snapshot: " << std::endl; + Log::global_log->info() << "InMemoryCheckpointWriter: writing snapshot: " << std::endl; // put the molecules in the buffer _snapshot.clearMolecules(); diff --git a/src/plugins/LoadImbalanceThroughSleepPlugin.cpp b/src/plugins/LoadImbalanceThroughSleepPlugin.cpp index 52e4ebd767..7d763d8512 100644 --- a/src/plugins/LoadImbalanceThroughSleepPlugin.cpp +++ b/src/plugins/LoadImbalanceThroughSleepPlugin.cpp @@ -1,29 +1,29 @@ -#include "LoadImbalanceThroughSleepPlugin.h" - -#include "parallel/DomainDecompBase.h" -#include "utils/xmlfileUnits.h" - -#include -#include - - -void LoadImbalanceThroughSleepPlugin::readXML(XMLfileUnits &xmlconfig) { - xmlconfig.getNodeValue("varyingSteps", _varyingSteps); - xmlconfig.getNodeValue("varyingStepsSleepTime", _varyingStepsSleepTime); -} - -void LoadImbalanceThroughSleepPlugin::afterForces(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, - unsigned long simstep) { - using namespace std::chrono_literals; - if (_varyingSteps and domainDecomp->getRank() % 2 == 0) { - std::this_thread::sleep_for(std::chrono::milliseconds(_varyingStepsSleepTime)); - } -} - -void LoadImbalanceThroughSleepPlugin::endStep(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, - Domain *domain, unsigned long simstep) { - using namespace std::chrono_literals; - if (_varyingSteps and domainDecomp->getRank() % 2 != 0) { - std::this_thread::sleep_for(std::chrono::milliseconds(_varyingStepsSleepTime)); - } -} \ No newline at end of file +#include "LoadImbalanceThroughSleepPlugin.h" + +#include "parallel/DomainDecompBase.h" +#include "utils/xmlfileUnits.h" + +#include +#include + + +void LoadImbalanceThroughSleepPlugin::readXML(XMLfileUnits &xmlconfig) { + xmlconfig.getNodeValue("varyingSteps", _varyingSteps); + xmlconfig.getNodeValue("varyingStepsSleepTime", _varyingStepsSleepTime); +} + +void LoadImbalanceThroughSleepPlugin::afterForces(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, + unsigned long simstep) { + using namespace std::chrono_literals; + if (_varyingSteps and domainDecomp->getRank() % 2 == 0) { + std::this_thread::sleep_for(std::chrono::milliseconds(_varyingStepsSleepTime)); + } +} + +void LoadImbalanceThroughSleepPlugin::endStep(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, + Domain *domain, unsigned long simstep) { + using namespace std::chrono_literals; + if (_varyingSteps and domainDecomp->getRank() % 2 != 0) { + std::this_thread::sleep_for(std::chrono::milliseconds(_varyingStepsSleepTime)); + } +} diff --git a/src/plugins/MamicoCoupling.cpp b/src/plugins/MamicoCoupling.cpp index 4256572a37..4bb5739eef 100644 --- a/src/plugins/MamicoCoupling.cpp +++ b/src/plugins/MamicoCoupling.cpp @@ -11,7 +11,7 @@ void MamicoCoupling::init(ParticleContainer* particleContainer, { #ifdef MAMICO_COUPLING //code to print to log that plugin is initialised - global_log->info() << "MaMiCo coupling plugin initialized" << std::endl; + Log::global_log->info() << "MaMiCo coupling plugin initialized" << std::endl; #endif } @@ -61,4 +61,4 @@ void MamicoCoupling::finish(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, Domain* domain) { -} \ No newline at end of file +} diff --git a/src/plugins/MaxCheck.cpp b/src/plugins/MaxCheck.cpp index 721f4cce9b..56cfa7313a 100644 --- a/src/plugins/MaxCheck.cpp +++ b/src/plugins/MaxCheck.cpp @@ -13,8 +13,6 @@ #include "utils/Logger.h" #include -using namespace std; -using Log::global_log; MaxCheck::MaxCheck() { } @@ -24,7 +22,7 @@ MaxCheck::~MaxCheck() { void MaxCheck::init(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, Domain* domain) { - global_log->debug() << "MaxCheck enabled" << std::endl; + Log::global_log->debug() << "MaxCheck enabled" << std::endl; } void MaxCheck::readXML(XMLfileUnits& xmlconfig) { @@ -36,9 +34,9 @@ void MaxCheck::readXML(XMLfileUnits& xmlconfig) { xmlconfig.getNodeValue("control/start", _control.start); xmlconfig.getNodeValue("control/frequency", _control.freq); xmlconfig.getNodeValue("control/stop", _control.stop); - global_log->info() << "[MaxCheck] Active period: start:freq:stop = " + Log::global_log->info() << "[MaxCheck] Active period: start:freq:stop = " << _control.start << ":" << _control.freq << ":" << _control.stop - << endl; + << std::endl; // range Domain* domain = global_simulation->getDomain(); @@ -59,27 +57,27 @@ void MaxCheck::readXML(XMLfileUnits& xmlconfig) { // Warn if old config style is used as it has big influence on the simulation if (not xmlconfig.query("yrange").empty()) { - global_log->warning() << "[MaxCheck] is deprecated! Use and / instead." << endl; + Log::global_log->warning() << "[MaxCheck] is deprecated! Use and / instead." << std::endl; } - global_log->info() << "[MaxCheck] Apply " << ((_range.inclusive) ? "inside" : "outside") << " range:" + Log::global_log->info() << "[MaxCheck] Apply " << ((_range.inclusive) ? "inside" : "outside") << " range:" << " x = " << _range.xmin << " - " << _range.xmax << " ;" << " y = " << _range.ymin << " - " << _range.ymax << " ;" - << " z = " << _range.zmin << " - " << _range.zmax << endl; + << " z = " << _range.zmin << " - " << _range.zmax << std::endl; // targets uint32_t numTargets = 0; XMLfile::Query query = xmlconfig.query("targets/target"); numTargets = query.card(); - global_log->info() << "[MaxCheck] Number of component targets: " - << numTargets << endl; + Log::global_log->info() << "[MaxCheck] Number of component targets: " + << numTargets << std::endl; if (numTargets < 1) { - global_log->warning() + Log::global_log->warning() << "[MaxCheck] No target parameters specified. Program exit ..." - << endl; + << std::endl; Simulation::exit(-1); } - string oldpath = xmlconfig.getcurrentnodepath(); + std::string oldpath = xmlconfig.getcurrentnodepath(); XMLfile::Query::const_iterator nodeIter; for (nodeIter = query.begin(); nodeIter; nodeIter++) { xmlconfig.changecurrentnode(nodeIter); @@ -95,27 +93,27 @@ void MaxCheck::readXML(XMLfileUnits& xmlconfig) { mv.method = MCM_UNKNOWN; xmlconfig.getNodeValue("@method", mv.method); - global_log->info() << "[MaxCheck] Method(cid=" << cid_ub << "): " - << mv.method << endl; + Log::global_log->info() << "[MaxCheck] Method(cid=" << cid_ub << "): " + << mv.method << std::endl; xmlconfig.getNodeValue("Fmax", mv.F); - global_log->info() << "[MaxCheck] Fmax(cid=" << cid_ub << "): " << mv.F - << endl; + Log::global_log->info() << "[MaxCheck] Fmax(cid=" << cid_ub << "): " << mv.F + << std::endl; mv.F2 = mv.F * mv.F; xmlconfig.getNodeValue("vmax", mv.v); - global_log->info() << "[MaxCheck] vmax(cid=" << cid_ub << "): " << mv.v - << endl; + Log::global_log->info() << "[MaxCheck] vmax(cid=" << cid_ub << "): " << mv.v + << std::endl; mv.v2 = mv.v * mv.v; - + xmlconfig.getNodeValue("Mmax", mv.M); - global_log->info() << "[MaxCheck] Mmax(cid=" << cid_ub << "): " << mv.M - << endl; + Log::global_log->info() << "[MaxCheck] Mmax(cid=" << cid_ub << "): " << mv.M + << std::endl; mv.M2 = mv.M * mv.M; - + xmlconfig.getNodeValue("Lmax", mv.L); - global_log->info() << "[MaxCheck] Lmax(cid=" << cid_ub << "): " << mv.L - << endl; + Log::global_log->info() << "[MaxCheck] Lmax(cid=" << cid_ub << "): " << mv.L + << std::endl; mv.L2 = mv.L * mv.L; _maxVals[cid_ub] = mv; @@ -201,7 +199,7 @@ void MaxCheck::checkMaxVals(ParticleContainer* particleContainer, double scale = mv.v / vabs; it->scale_v(scale); } - + if (mv.M > 0. && absVals.M2 > mv.M2) { double Mabs = sqrt(absVals.M2); double scale = mv.M / Mabs; diff --git a/src/plugins/Mirror.cpp b/src/plugins/Mirror.cpp index 7d39e6fef8..631c7f61a7 100644 --- a/src/plugins/Mirror.cpp +++ b/src/plugins/Mirror.cpp @@ -12,8 +12,6 @@ #include #include -using namespace std; -using Log::global_log; void printInsertionStatus(std::pair::iterator,bool> &status) { @@ -47,26 +45,26 @@ Mirror::Mirror() : } void Mirror::init(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, Domain* domain) { - global_log->debug() << "[Mirror] Enabled at position: " << _position.coord << std::endl; + Log::global_log->debug() << "[Mirror] Enabled at position: " << _position.coord << std::endl; } void Mirror::readXML(XMLfileUnits& xmlconfig) { _pluginID = 100; xmlconfig.getNodeValue("pluginID", _pluginID); - global_log->info() << "[Mirror] pluginID = " << _pluginID << std::endl; + Log::global_log->info() << "[Mirror] pluginID = " << _pluginID << std::endl; // Target component _targetComp = 0; xmlconfig.getNodeValue("cid", _targetComp); - if(_targetComp > 0) { global_log->info() << "[Mirror] Target component: " << _targetComp << std::endl; } + if(_targetComp > 0) { Log::global_log->info() << "[Mirror] Target component: " << _targetComp << std::endl; } // Switch component _switchComp.enabled = false; _switchComp.cid_ub = 1; _switchComp.enabled = xmlconfig.getNodeValue("switchcomp/cid", _switchComp.cid_ub); if(_switchComp.enabled) - global_log->info() << "[Mirror] Switch component to cid: " << _switchComp.cid_ub << " if molecule has passed the Mirror." << std::endl; + Log::global_log->info() << "[Mirror] Switch component to cid: " << _switchComp.cid_ub << " if molecule has passed the Mirror." << std::endl; // Mirror position _position.axis = 1; // only y-axis supported yet @@ -84,11 +82,11 @@ void Mirror::readXML(XMLfileUnits& xmlconfig) if(nullptr != subject) subject->registerObserver(this); else { - global_log->error() << "[Mirror] Initialization of plugin DistControl is needed before! Program exit..." << std::endl; + Log::global_log->error() << "[Mirror] Initialization of plugin DistControl is needed before! Program exit..." << std::endl; Simulation::exit(-1); } } - global_log->info() << "[Mirror] Enabled at position: y = " << _position.coord << std::endl; + Log::global_log->info() << "[Mirror] Enabled at position: y = " << _position.coord << std::endl; /** mirror type */ _type = MT_UNKNOWN; @@ -108,29 +106,29 @@ void Mirror::readXML(XMLfileUnits& xmlconfig) else if("o-|" == strDirection) _direction = MD_RIGHT_MIRROR; if(MD_LEFT_MIRROR == _direction) - global_log->info() << "[Mirror] Reflect particles to the right |-o" << std::endl; + Log::global_log->info() << "[Mirror] Reflect particles to the right |-o" << std::endl; else if(MD_RIGHT_MIRROR == _direction) - global_log->info() << "[Mirror] Reflect particles to the left o-|" << std::endl; + Log::global_log->info() << "[Mirror] Reflect particles to the left o-|" << std::endl; /** constant force */ if(MT_FORCE_CONSTANT == _type) { _forceConstant = 100.; xmlconfig.getNodeValue("forceConstant", _forceConstant); - global_log->info() << "[Mirror] Applying force in vicinity of mirror: _forceConstant = " << _forceConstant << std::endl; + Log::global_log->info() << "[Mirror] Applying force in vicinity of mirror: _forceConstant = " << _forceConstant << std::endl; } /** zero gradient */ if(MT_ZERO_GRADIENT == _type) { - global_log->error() << "[Mirror] Method 3 (MT_ZERO_GRADIENT) is deprecated. Use 5 (MT_MELAND_2004) instead. Program exit ..." << std::endl; + Log::global_log->error() << "[Mirror] Method 3 (MT_ZERO_GRADIENT) is deprecated. Use 5 (MT_MELAND_2004) instead. Program exit ..." << std::endl; Simulation::exit(-1); } /** normal distributions */ if(MT_NORMDISTR_MB == _type) { - global_log->error() << "[Mirror] Method 4 (MT_NORMDISTR_MB) is deprecated. Use 5 (MT_MELAND_2004) instead. Program exit ..." << std::endl; + Log::global_log->error() << "[Mirror] Method 4 (MT_NORMDISTR_MB) is deprecated. Use 5 (MT_MELAND_2004) instead. Program exit ..." << std::endl; Simulation::exit(-1); } @@ -141,42 +139,42 @@ void Mirror::readXML(XMLfileUnits& xmlconfig) if(!xmlconfig.getNodeValue("meland/velo_target", _melandParams.velo_target)) { - global_log->error() << "[Mirror] Meland: Parameters for method 5 (MT_MELAND_2004) provided in config-file *.xml corrupted/incomplete. Program exit ..." << std::endl; + Log::global_log->error() << "[Mirror] Meland: Parameters for method 5 (MT_MELAND_2004) provided in config-file *.xml corrupted/incomplete. Program exit ..." << std::endl; Simulation::exit(-2004); } else { - global_log->info() << "[Mirror] Meland: target velocity = " << _melandParams.velo_target << std::endl; + Log::global_log->info() << "[Mirror] Meland: target velocity = " << _melandParams.velo_target << std::endl; if (_melandParams.fixed_probability_factor > 0) { - global_log->info() << "[Mirror] Meland: FixedProb = " << _melandParams.fixed_probability_factor << std::endl; + Log::global_log->info() << "[Mirror] Meland: FixedProb = " << _melandParams.fixed_probability_factor << std::endl; } } - + /** Diffuse mirror **/ _diffuse_mirror.enabled = false; _diffuse_mirror.width = 0.0; bool bRet = xmlconfig.getNodeValue("diffuse/width", _diffuse_mirror.width); _diffuse_mirror.enabled = bRet; - if(_diffuse_mirror.width > 0.0) { global_log->info() << "[Mirror] Using diffuse Mirror width = " << _diffuse_mirror.width << std::endl; } + if(_diffuse_mirror.width > 0.0) { Log::global_log->info() << "[Mirror] Using diffuse Mirror width = " << _diffuse_mirror.width << std::endl; } } - + if(MT_RAMPING == _type) { bool bRet = true; bRet = bRet && xmlconfig.getNodeValue("ramping/start", _rampingParams.startStep); bRet = bRet && xmlconfig.getNodeValue("ramping/stop", _rampingParams.stopStep); bRet = bRet && xmlconfig.getNodeValue("ramping/treatment", _rampingParams.treatment); - + if (not bRet) { - global_log->error() << "[Mirror] Ramping: Parameters for method 5 (MT_RAMPING) provided in config-file *.xml corrupted/incomplete. Program exit ..." << std::endl; + Log::global_log->error() << "[Mirror] Ramping: Parameters for method 5 (MT_RAMPING) provided in config-file *.xml corrupted/incomplete. Program exit ..." << std::endl; Simulation::exit(-1); } else { if(_rampingParams.startStep > _rampingParams.stopStep) { - global_log->error() << "[Mirror] Ramping: Start > Stop. Program exit ..." << std::endl; + Log::global_log->error() << "[Mirror] Ramping: Start > Stop. Program exit ..." << std::endl; Simulation::exit(-1); } else { - global_log->info() << "[Mirror] Ramping from " << _rampingParams.startStep << " to " << _rampingParams.stopStep << std::endl; + Log::global_log->info() << "[Mirror] Ramping from " << _rampingParams.startStep << " to " << _rampingParams.stopStep << std::endl; std::string treatmentStr = ""; switch(_rampingParams.treatment) { case 0 : treatmentStr = "Deletion"; @@ -184,10 +182,10 @@ void Mirror::readXML(XMLfileUnits& xmlconfig) case 1 : treatmentStr = "Transmission"; break; default: - global_log->error() << "[Mirror] Ramping: No proper treatment was set. Use 0 (Deletion) or 1 (Transmission). Program exit ..." << std::endl; + Log::global_log->error() << "[Mirror] Ramping: No proper treatment was set. Use 0 (Deletion) or 1 (Transmission). Program exit ..." << std::endl; Simulation::exit(-1); } - global_log->info() << "[Mirror] Ramping: Treatment for non-reflected particles: " << _rampingParams.treatment << " ( " << treatmentStr << " ) " << std::endl; + Log::global_log->info() << "[Mirror] Ramping: Treatment for non-reflected particles: " << _rampingParams.treatment << " ( " << treatmentStr << " ) " << std::endl; } } } @@ -235,7 +233,7 @@ void Mirror::beforeForces( it->componentid() + 1; // unity based componentid --> 0: arbitrary component, 1: first component if ((_targetComp != 0) and (cid_ub != _targetComp)) { continue; } - + double vy = it->v(1); if ( (_direction == MD_RIGHT_MIRROR && vy < 0.) || (_direction == MD_LEFT_MIRROR && vy > 0.) ) { continue; @@ -284,7 +282,7 @@ void Mirror::beforeForces( pbf = std::abs(vy_reflected / vy); } frnd = _rnd->rnd(); - global_log->debug() << "[Mirror] Meland: pbf = " << pbf << " ; frnd = " << frnd << " ; vy_reflected = " << vy_reflected << " ; vy = " << vy << std::endl; + Log::global_log->debug() << "[Mirror] Meland: pbf = " << pbf << " ; frnd = " << frnd << " ; vy_reflected = " << vy_reflected << " ; vy = " << vy << std::endl; // reflect particles and delete all not reflected if(frnd < pbf) { it->setv(1, vy_reflected); @@ -343,7 +341,7 @@ void Mirror::beforeForces( // ensure that we do not iterate over things outside of the container. regionHighCorner[1] = std::min(_position.coord, regionHighCorner[1]); } - + // reset local values for(auto& it:_particleManipCount.reflected.local) it = 0; @@ -359,14 +357,14 @@ void Mirror::beforeForces( if ((_targetComp != 0) and (cid_ub != _targetComp)) { continue; } double vy = it->v(1); - + if ( (_direction == MD_RIGHT_MIRROR && vy < 0.) || (_direction == MD_LEFT_MIRROR && vy > 0.) ) continue; - + float ratioRefl; float frnd = _rnd->rnd(); uint64_t currentSimstep = global_simulation->getSimulationStep(); - + if(currentSimstep <= _rampingParams.startStep) { ratioRefl = 1; } @@ -376,12 +374,12 @@ void Mirror::beforeForces( else { ratioRefl = 0; } - + if(frnd <= ratioRefl) { it->setv(1, -vy); _particleManipCount.reflected.local.at(0)++; _particleManipCount.reflected.local.at(cid_ub)++; - global_log->debug() << "[Mirror] Ramping: Velo. reversed at step " << currentSimstep << " , ReflRatio: " << ratioRefl << std::endl; + Log::global_log->debug() << "[Mirror] Ramping: Velo. reversed at step " << currentSimstep << " , ReflRatio: " << ratioRefl << std::endl; } else { if (_rampingParams.treatment == 0) { @@ -481,7 +479,7 @@ void Mirror::VelocityChange( ParticleContainer* particleContainer) { uint32_t cid_ub = it->componentid()+1; if ((_targetComp != 0) and (cid_ub != _targetComp)) { continue; } - + if(MT_REFLECT == _type) { if( (MD_RIGHT_MIRROR == _direction && vy > 0.) || (MD_LEFT_MIRROR == _direction && vy < 0.) ) { it->setv(1, -vy); diff --git a/src/plugins/Mirror.h b/src/plugins/Mirror.h index dd12dfa84f..c8425614da 100644 --- a/src/plugins/Mirror.h +++ b/src/plugins/Mirror.h @@ -141,7 +141,7 @@ class Mirror : public PluginBase, public ObserverBase, public ControlInstance double velo_target {0.4}; float fixed_probability_factor {-1}; } _melandParams; - + struct RampingParams { unsigned long startStep {1000}; unsigned long stopStep {2000}; @@ -152,13 +152,13 @@ class Mirror : public PluginBase, public ObserverBase, public ControlInstance CommVar > reflected; CommVar > deleted; } _particleManipCount; - + struct DiffuseMirror { bool enabled; float width; std::map pos_map; } _diffuse_mirror; - + struct SwitchComp { bool enabled; uint32_t cid_ub; // component id unity based diff --git a/src/plugins/MirrorSystem.cpp b/src/plugins/MirrorSystem.cpp index 8f18ca5254..60a994b60f 100644 --- a/src/plugins/MirrorSystem.cpp +++ b/src/plugins/MirrorSystem.cpp @@ -10,8 +10,6 @@ #include #include -using namespace std; -using Log::global_log; MirrorSystem::MirrorSystem() { @@ -34,7 +32,7 @@ void MirrorSystem::beforeEventNewTimestep( if(_bDone) return; - global_log->info() << "HELLO beforeEventNewTimestep() ..." << endl; + Log::global_log->info() << "HELLO beforeEventNewTimestep() ..." << std::endl; Domain* domain = global_simulation->getDomain(); @@ -59,15 +57,15 @@ void MirrorSystem::beforeEventNewTimestep( newPos.at(1) = oldPos.at(1) + width.at(1)*0.5; newPos.at(2) = oldPos.at(2) + width.at(2)*0.5; - cout << domainDecomp->getRank() << ": oldPos = " << oldPos.at(0) << "," << oldPos.at(1) << "," << oldPos.at(2); - cout << domainDecomp->getRank() << ": newPos = " << newPos.at(0) << "," << newPos.at(1) << "," << newPos.at(2) << endl; + std::cout << domainDecomp->getRank() << ": oldPos = " << oldPos.at(0) << "," << oldPos.at(1) << "," << oldPos.at(2); + std::cout << domainDecomp->getRank() << ": newPos = " << newPos.at(0) << "," << newPos.at(1) << "," << newPos.at(2) << std::endl; it->setr(0, newPos.at(0) ); it->setr(1, newPos.at(1) ); it->setr(2, newPos.at(2) ); } // particleContainer->update(); - global_log->info() << "System shifted." << endl; + Log::global_log->info() << "System shifted." << std::endl; } else if(_type == MST_ENLARGE) { // add vapor @@ -193,13 +191,13 @@ void MirrorSystem::beforeEventNewTimestep( arr.at(1) = -1; arr.at(2) = -1; - global_log->info() << "Adding new particles ..." << endl; + Log::global_log->info() << "Adding new particles ..." << std::endl; uint64_t numAdded = 0; double bbMin[3]; double bbMax[3]; domainDecomp->getBoundingBoxMinMax(domain, bbMin, bbMax); - cout << domainDecomp->getRank() << ": bbMin = " << bbMin[0] << "," << bbMin[1] << "," << bbMin[2] << endl; - cout << domainDecomp->getRank() << ": bbMax = " << bbMax[0] << "," << bbMax[1] << "," << bbMax[2] << endl; + std::cout << domainDecomp->getRank() << ": bbMin = " << bbMin[0] << "," << bbMin[1] << "," << bbMin[2] << std::endl; + std::cout << domainDecomp->getRank() << ": bbMax = " << bbMax[0] << "," << bbMax[1] << "," << bbMax[2] << std::endl; for(auto it = particleContainer->iterator(ParticleIterator::ONLY_INNER_AND_BOUNDARY); it.isValid(); ++it) { std::array oldPos; @@ -227,15 +225,15 @@ void MirrorSystem::beforeEventNewTimestep( mol.setr(1, newPos.at(1) ); mol.setr(2, newPos.at(2) ); - cout << domainDecomp->getRank() << ": newPos = " << newPos.at(0) << "," << newPos.at(1) << "," << newPos.at(2); - cout << domainDecomp->getRank() << ": oldPos = " << oldPos.at(0) << "," << oldPos.at(1) << "," << oldPos.at(2) << endl; + std::cout << domainDecomp->getRank() << ": newPos = " << newPos.at(0) << "," << newPos.at(1) << "," << newPos.at(2); + std::cout << domainDecomp->getRank() << ": oldPos = " << oldPos.at(0) << "," << oldPos.at(1) << "," << oldPos.at(2) << std::endl; particleContainer->addParticle(mol, true, false); numAdded++; } } } - cout << domainDecomp->getRank() << ": Added " << numAdded << " new particles." << endl; + std::cout << domainDecomp->getRank() << ": Added " << numAdded << " new particles." << std::endl; } else if(_type == MST_MIRROR) { @@ -257,7 +255,7 @@ void MirrorSystem::readXML(XMLfileUnits& xmlconfig) { // mirror position _yPos = 0.; xmlconfig.getNodeValue("yPos", _yPos); - global_log->info() << "MirrorSystem: y position = " << _yPos << endl; + Log::global_log->info() << "MirrorSystem: y position = " << _yPos << std::endl; // old box size xmlconfig.getNodeValue("box/old/x", _box_old.at(0)); diff --git a/src/plugins/NEMD/DensityControl.cpp b/src/plugins/NEMD/DensityControl.cpp index 93a77d8c01..a5cff5ebd0 100644 --- a/src/plugins/NEMD/DensityControl.cpp +++ b/src/plugins/NEMD/DensityControl.cpp @@ -32,7 +32,7 @@ DensityControl::DensityControl() = default; DensityControl::~DensityControl() = default; void DensityControl::init(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, Domain* domain) { - global_log->debug() << "DensityControl enabled" << std::endl; + Log::global_log->debug() << "DensityControl enabled" << std::endl; #ifdef ENABLE_MPI // Create new MPI data type to transport particle ID and component ID together in one object @@ -56,7 +56,7 @@ void DensityControl::readXML(XMLfileUnits& xmlconfig) { xmlconfig.getNodeValue("control/start", _control.start); xmlconfig.getNodeValue("control/frequency", _control.freq); xmlconfig.getNodeValue("control/stop", _control.stop); - global_log->info() << "[DensityControl] is acting start:freq:stop = " << _control.start << ":" << _control.freq + Log::global_log->info() << "[DensityControl] is acting start:freq:stop = " << _control.start << ":" << _control.freq << ":" << _control.stop << std::endl; // range @@ -82,7 +82,7 @@ void DensityControl::readXML(XMLfileUnits& xmlconfig) { _vecPriority.push_back(0); const uint32_t nRet = this->tokenize_int_list(_vecPriority, strPrio); if (nRet != numComponents) { - global_log->error() << "[DensityControl] Number of component IDs specified in element ..." + Log::global_log->error() << "[DensityControl] Number of component IDs specified in element ..." << " does not match the number of components in the simulation. Programm exit ..." << std::endl; Simulation::exit(-1); @@ -107,12 +107,12 @@ void DensityControl::readXML(XMLfileUnits& xmlconfig) { uint32_t numTargets = 0; const XMLfile::Query query = xmlconfig.query("targets/target"); numTargets = query.card(); - global_log->info() << "[DensityControl] Number of component targets: " << numTargets << std::endl; + Log::global_log->info() << "[DensityControl] Number of component targets: " << numTargets << std::endl; if (numTargets < 1) { - global_log->error() << "[DensityControl] No target parameters specified. Program exit ..." << std::endl; + Log::global_log->error() << "[DensityControl] No target parameters specified. Program exit ..." << std::endl; Simulation::exit(-1); } - const string oldpath = xmlconfig.getcurrentnodepath(); + const std::string oldpath = xmlconfig.getcurrentnodepath(); XMLfile::Query::const_iterator nodeIter; for (nodeIter = query.begin(); nodeIter; nodeIter++) { xmlconfig.changecurrentnode(nodeIter); @@ -229,7 +229,7 @@ void DensityControl::controlDensity(ParticleContainer* particleContainer, Domain std::map > pidMap; for (int32_t i = 0; i < numComponents + 1; i++) { const std::vector vec; - pidMap.insert(std::pair >(i, vec)); + pidMap.insert(std::pair >(i, vec)); } for (auto it : vec_pacID.global) { pidMap[it.cid].push_back(it.pid); @@ -276,8 +276,8 @@ void DensityControl::controlDensity(ParticleContainer* particleContainer, Domain } if (cid_ub_send > 0 && cid_ub_recv > 0) { - const uint64_t numSwap = min(vecBalance[cid_ub_send], abs(vecBalance[cid_ub_recv])); - global_log->debug() << "[DensityControl] numSwap = " << numSwap << std::endl; + const uint64_t numSwap = std::min(vecBalance[cid_ub_send], abs(vecBalance[cid_ub_recv])); + Log::global_log->debug() << "[DensityControl] numSwap = " << numSwap << std::endl; for (uint64_t i = 0; i < numSwap; i++) { const uint64_t pid = pidMap[cid_ub_send].back(); pidMap[cid_ub_send].pop_back(); @@ -328,8 +328,8 @@ void DensityControl::controlDensity(ParticleContainer* particleContainer, Domain // search for pid for (auto sid : swpMap[i]) { if (pid == sid) { - global_log->debug() << "[DensityControl] Swap pid=" << pid << " with cid=" << it->componentid() + 1 - << " to cid=" << i << endl; + Log::global_log->debug() << "[DensityControl] Swap pid=" << pid << " with cid=" << it->componentid() + 1 + << " to cid=" << i << std::endl; it->setComponent(compNew); } } @@ -339,8 +339,8 @@ void DensityControl::controlDensity(ParticleContainer* particleContainer, Domain for (uint32_t i = 1; i < numComponents + 1; i++) { std::vector& vec = delMap[i]; if (std::find(vec.begin(), vec.end(), pid) != vec.end()) { // found ID of to be deleted particle in vector - global_log->debug() << "[DensityControl] Delete particle with pid= " << pid - << " ; cid_ub= " << it->componentid() + 1 << endl; + Log::global_log->debug() << "[DensityControl] Delete particle with pid= " << pid + << " ; cid_ub= " << it->componentid() + 1 << std::endl; particleContainer->deleteMolecule(it, false); } } @@ -403,7 +403,7 @@ void DensityControl::updateBalanceVector(std::vector& vecBalance, } #ifndef NDEBUG - cout << "_densityTarget.count: "; + std::cout << "_densityTarget.count: "; for (auto i : _densityTarget.count) std::cout << i << ' '; std::cout << std::endl; @@ -508,8 +508,8 @@ void DensityControl::initTargetValues(ParticleContainer* particleContainer, Doma #ifndef NDEBUG // show target values for (uint32_t i = 0; i < numComponents + 1; i++) { - global_log->info() << "cID=" << i << ": target count=" << _densityTarget.count[i] - << ", target density=" << _densityTarget.density[i] << endl; + Log::global_log->info() << "cID=" << i << ": target count=" << _densityTarget.count[i] + << ", target density=" << _densityTarget.density[i] << std::endl; } #endif } diff --git a/src/plugins/NEMD/DistControl.cpp b/src/plugins/NEMD/DistControl.cpp index 3d0c5394e7..314cb1742a 100644 --- a/src/plugins/NEMD/DistControl.cpp +++ b/src/plugins/NEMD/DistControl.cpp @@ -26,7 +26,6 @@ #include #include -using namespace std; DistControl::DistControl() @@ -71,15 +70,15 @@ void DistControl::readXML(XMLfileUnits& xmlconfig) xmlconfig.getNodeValue("filenames/control", _strFilename); xmlconfig.getNodeValue("filenames/profiles", _strFilenameProfilesPrefix); - global_log->info() << "[DistControl] Writing control data to file: " << _strFilename << endl; - global_log->info() << "[DistControl] Writing profile data to files with prefix: " << _strFilenameProfilesPrefix << endl; + Log::global_log->info() << "[DistControl] Writing control data to file: " << _strFilename << std::endl; + Log::global_log->info() << "[DistControl] Writing profile data to files with prefix: " << _strFilenameProfilesPrefix << std::endl; // subdivision of system uint32_t nSubdivisionType = SDOPT_UNKNOWN; std::string strSubdivisionType; if( !xmlconfig.getNodeValue("subdivision@type", strSubdivisionType) ) { - global_log->error() << "[DistControl] Missing attribute \"subdivision@type\"! Programm exit..." << endl; + Log::global_log->error() << "[DistControl] Missing attribute \"subdivision@type\"! Programm exit..." << std::endl; exit(-1); } if("number" == strSubdivisionType) @@ -87,7 +86,7 @@ void DistControl::readXML(XMLfileUnits& xmlconfig) unsigned int nNumSlabs = 0; if( !xmlconfig.getNodeValue("subdivision/number", nNumSlabs) ) { - global_log->error() << "[DistControl] Missing element \"subdivision/number\"! Programm exit..." << endl; + Log::global_log->error() << "[DistControl] Missing element \"subdivision/number\"! Programm exit..." << std::endl; exit(-1); } else @@ -98,7 +97,7 @@ void DistControl::readXML(XMLfileUnits& xmlconfig) double dSlabWidth = 0.; if( !xmlconfig.getNodeValue("subdivision/width", dSlabWidth) ) { - global_log->error() << "[DistControl] Missing element \"subdivision/width\"! Programm exit..." << endl; + Log::global_log->error() << "[DistControl] Missing element \"subdivision/width\"! Programm exit..." << std::endl; exit(-1); } else @@ -106,7 +105,7 @@ void DistControl::readXML(XMLfileUnits& xmlconfig) } else { - global_log->error() << "[DistControl] Wrong attribute \"subdivision@type\". Expected: type=\"number|width\"! Programm exit..." << endl; + Log::global_log->error() << "[DistControl] Wrong attribute \"subdivision@type\". Expected: type=\"number|width\"! Programm exit..." << std::endl; exit(-1); } @@ -122,7 +121,7 @@ void DistControl::readXML(XMLfileUnits& xmlconfig) if("startconfig" == strInitMethodType) { _nMethodInit = DCIM_START_CONFIGURATION; - global_log->info() << "[DistControl] Init method 'startconfig', dertermining interface midpoints from start configuration." << endl; + Log::global_log->info() << "[DistControl] Init method 'startconfig', dertermining interface midpoints from start configuration." << std::endl; } else if("values" == strInitMethodType) { @@ -132,12 +131,12 @@ void DistControl::readXML(XMLfileUnits& xmlconfig) bInputIsValid = bInputIsValid && xmlconfig.getNodeValue("init/values/right", _dInterfaceMidRight); if(true == bInputIsValid) { - global_log->info() << "[DistControl] Init method 'values' => interface midpoint left: " << _dInterfaceMidLeft << ", " - "right: " << _dInterfaceMidRight << "." << endl; + Log::global_log->info() << "[DistControl] Init method 'values' => interface midpoint left: " << _dInterfaceMidLeft << ", " + "right: " << _dInterfaceMidRight << "." << std::endl; } else { - global_log->error() << "[DistControl] Missing elements \"init/values/left\" or \"init/values/right\" or both! Programm exit..." << endl; + Log::global_log->error() << "[DistControl] Missing elements \"init/values/left\" or \"init/values/right\" or both! Programm exit..." << std::endl; exit(-1); } } @@ -149,19 +148,19 @@ void DistControl::readXML(XMLfileUnits& xmlconfig) bInputIsValid = bInputIsValid && xmlconfig.getNodeValue("init/simstep", _nRestartTimestep); if(true == bInputIsValid) { - global_log->info() << "[DistControl] Init method 'file', reading from file: " << _strFilenameInit << ", " - "goto line with simstep == " << _nRestartTimestep << "." << endl; + Log::global_log->info() << "[DistControl] Init method 'file', reading from file: " << _strFilenameInit << ", " + "goto line with simstep == " << _nRestartTimestep << "." << std::endl; } else { - global_log->error() << "[DistControl] Missing elements \"init/file\" or \"init/simstep\" or both! Programm exit..." << endl; + Log::global_log->error() << "[DistControl] Missing elements \"init/file\" or \"init/simstep\" or both! Programm exit..." << std::endl; exit(-1); } } else { - global_log->error() << "[DistControl] Wrong attribute \"init@type\", type = " << strInitMethodType << ", " - "expected: type=\"startconfig|values|file\"! Programm exit..." << endl; + Log::global_log->error() << "[DistControl] Wrong attribute \"init@type\", type = " << strInitMethodType << ", " + "expected: type=\"startconfig|values|file\"! Programm exit..." << std::endl; exit(-1); } @@ -184,12 +183,12 @@ void DistControl::readXML(XMLfileUnits& xmlconfig) bInputIsValid = bInputIsValid && xmlconfig.getNodeValue("method/density", _dVaporDensity); if(true == bInputIsValid) { - global_log->info() << "[DistControl] Update method 'density', using constant value for vapor density rho_vap == " << _dVaporDensity << ", " - "target componentID: " << _nTargetCompID << "." << endl; + Log::global_log->info() << "[DistControl] Update method 'density', using constant value for vapor density rho_vap == " << _dVaporDensity << ", " + "target componentID: " << _nTargetCompID << "." << std::endl; } else { - global_log->error() << "[DistControl] Missing elements \"method/componentID\" or \"method/density\" or both! Programm exit..." << endl; + Log::global_log->error() << "[DistControl] Missing elements \"method/componentID\" or \"method/density\" or both! Programm exit..." << std::endl; exit(-1); } } @@ -208,19 +207,19 @@ void DistControl::readXML(XMLfileUnits& xmlconfig) _nNeighbourValsDerivate = (uint16_t)(nNeighbourValsDerivate); if(true == bInputIsValid) { - global_log->info() << "[DistControl] Update method 'denderiv', using " << _nNeighbourValsSmooth << " neigbour values for smoothing " - " and " << _nNeighbourValsDerivate << " neigbour values for derivation of the density profile, target componentID: " << _nTargetCompID << "." << endl; + Log::global_log->info() << "[DistControl] Update method 'denderiv', using " << _nNeighbourValsSmooth << " neigbour values for smoothing " + " and " << _nNeighbourValsDerivate << " neigbour values for derivation of the density profile, target componentID: " << _nTargetCompID << "." << std::endl; } else { - global_log->error() << "[DistControl] Missing elements \"method/componentID\" or \"method/density\" or both! Programm exit..." << endl; + Log::global_log->error() << "[DistControl] Missing elements \"method/componentID\" or \"method/density\" or both! Programm exit..." << std::endl; exit(-1); } } else { - global_log->error() << "[DistControl] Wrong attribute \"method@type\", type = " << strUpdateMethodType << ", " - "expected: type=\"density|denderiv\"! Programm exit..." << endl; + Log::global_log->error() << "[DistControl] Wrong attribute \"method@type\", type = " << strUpdateMethodType << ", " + "expected: type=\"density|denderiv\"! Programm exit..." << std::endl; exit(-1); } } @@ -266,7 +265,7 @@ void DistControl::PrepareSubdivision() break; case SDOPT_UNKNOWN: default: - global_log->error() << "[DistControl] PrepareSubdivision(): Neither _binParams.width nor _binParams.count was set correctly! Programm exit..." << endl; + Log::global_log->error() << "[DistControl] PrepareSubdivision(): Neither _binParams.width nor _binParams.count was set correctly! Programm exit..." << std::endl; exit(-1); } @@ -389,12 +388,12 @@ void DistControl::CalcProfiles() void DistControl::EstimateInterfaceMidpointsByForce() { // for(unsigned short cid=0; cid<_nNumComponents; ++cid) -// cout << "_nOffsets[cid] = " << _nOffsets[cid] << endl; +// std::cout << "_nOffsets[cid] = " << _nOffsets[cid] << std::endl; unsigned int nIndexMin = 0; unsigned int nIndexMax = 0; -// cout << "_nTargetCompID = " << _nTargetCompID << endl; -// cout << "_nOffsets[_nTargetCompID] = " << _nOffsets[_nTargetCompID] << endl; +// std::cout << "_nTargetCompID = " << _nTargetCompID << std::endl; +// std::cout << "_nOffsets[_nTargetCompID] = " << _nOffsets[_nTargetCompID] << std::endl; double* dProfile = _dDensityProfileSmoothedDerivation.data() + _nOffsets.at(_nTargetCompID); double dMin = dProfile[0]; double dMax = dProfile[0]; @@ -500,9 +499,9 @@ void DistControl::EstimateInterfaceMidpoint() // 1. ym bestimmen double ym = dMin + (dMax - dMin) / 2; -// cout << "dMin = " << dMin << endl; -// cout << "dMax = " << dMax << endl; -// cout << "ym = " << ym << endl; +// std::cout << "dMin = " << dMin << std::endl; +// std::cout << "dMax = " << dMax << std::endl; +// std::cout << "ym = " << ym << std::endl; // 2. Slab mit gerade niedrigerer Anzahl finden --> von links angefangen ersten Slab größer numMax finden --> Index -1 rechnen int nIndexSlabGreater = 0; @@ -518,11 +517,11 @@ void DistControl::EstimateInterfaceMidpoint() if(nIndexSlabGreater < 1) { - global_log->error() << "[DistControl] EstimateInterfaceMidpoint(): could not find valid index in density profile" << endl; + Log::global_log->error() << "[DistControl] EstimateInterfaceMidpoint(): could not find valid index in density profile" << std::endl; return; } -// cout << "nIndexSlabGreater = " << nIndexSlabGreater << endl; +// std::cout << "nIndexSlabGreater = " << nIndexSlabGreater << std::endl; //3. Interpolierte Distanz dInterpol berechnen, die von dem Slab mit N < Nsoll ausgehend in Richtung N > Nsoll gegangen werden muss double dx12, dx1m, y1, y2, dy12, dy1m; @@ -545,13 +544,13 @@ void DistControl::EstimateInterfaceMidpoint() x1 = dOuterBoundarySampleZone + nIndexSlabGreater * _binParams.width - _binParams.width*0.5; -// cout << "x1 = " << x1 << endl; -// cout << "dx1m = " << dx1m << endl; +// std::cout << "x1 = " << x1 << std::endl; +// std::cout << "dx1m = " << dx1m << std::endl; xm = x1 + dx1m; _dInterfaceMidLeft = xm; -// cout << "_dInterfaceMidLeft = " << _dInterfaceMidLeft << endl; +// std::cout << "_dInterfaceMidLeft = " << _dInterfaceMidLeft << std::endl; } @@ -589,7 +588,7 @@ void DistControl::EstimateInterfaceMidpoint() // 1. ym bestimmen double ym = dMin + (dMax - dMin) / 2; -// cout << "ym = " << ym << endl; +// std::cout << "ym = " << ym << std::endl; // 2. Slab mit gerade niedrigerer Anzahl finden --> von links angefangen ersten Slab größer numMax finden --> Index -1 rechnen unsigned int nIndexSlabGreater = 0; @@ -605,7 +604,7 @@ void DistControl::EstimateInterfaceMidpoint() if(nIndexSlabGreater < 1) { - global_log->error() << "[DistControl] EstimateInterfaceMidpoint(): could not find valid index in density profile" << endl; + Log::global_log->error() << "[DistControl] EstimateInterfaceMidpoint(): could not find valid index in density profile" << std::endl; return; } @@ -630,17 +629,17 @@ void DistControl::EstimateInterfaceMidpoint() double dOuterBoundarySampleZone = domain->getGlobalLength(1); //this->GetUpperCorner()[1]; unsigned int numShellsLower = _binParams.count-1 - nIndexSlabGreater; -// cout << "numShellsLower = " << numShellsLower << endl; +// std::cout << "numShellsLower = " << numShellsLower << std::endl; x1 = dOuterBoundarySampleZone - numShellsLower * _binParams.width + _binParams.width*0.5; -// cout << "x1 = " << x1 << endl; -// cout << "dx1m = " << dx1m << endl; +// std::cout << "x1 = " << x1 << std::endl; +// std::cout << "dx1m = " << dx1m << std::endl; xm = x1 - dx1m; _dInterfaceMidRight = xm; -// cout << "_dInterfaceMidRight = " << _dInterfaceMidRight << endl; +// std::cout << "_dInterfaceMidRight = " << _dInterfaceMidRight << std::endl; } } @@ -671,17 +670,17 @@ void DistControl::UpdatePositionsInit(ParticleContainer* particleContainer) break; case DCIM_READ_FROM_FILE: { -// cout << "_strFilenameInit = " << _strFilenameInit << endl; -// cout << "_nRestartTimestep = " << _nRestartTimestep << endl; +// std::cout << "_strFilenameInit = " << _strFilenameInit << std::endl; +// std::cout << "_nRestartTimestep = " << _nRestartTimestep << std::endl; - ifstream filein(_strFilenameInit.c_str(), ios::in); + std::ifstream filein(_strFilenameInit.c_str(), std::ios::in); - string strLine, strToken; - string strTokens[20]; + std::string strLine, strToken; + std::string strTokens[20]; while (getline (filein, strLine)) { - stringstream sstr; + std::stringstream sstr; sstr << strLine; sstr >> strToken; @@ -702,13 +701,13 @@ void DistControl::UpdatePositionsInit(ParticleContainer* particleContainer) } case DCIM_UNKNOWN: default: - global_log->error() << "[DistControl] Wrong Init Method! Programm exit..." << endl; + Log::global_log->error() << "[DistControl] Wrong Init Method! Programm exit..." << std::endl; exit(-1); } #ifndef NDEBUG - global_log->error() << "[DistControl] _dInterfaceMidLeft = " << _dInterfaceMidLeft << endl; - global_log->error() << "[DistControl] _dInterfaceMidRight = " << _dInterfaceMidRight << endl; + Log::global_log->error() << "[DistControl] _dInterfaceMidLeft = " << _dInterfaceMidLeft << std::endl; + Log::global_log->error() << "[DistControl] _dInterfaceMidRight = " << _dInterfaceMidRight << std::endl; #endif // update positions @@ -738,7 +737,7 @@ void DistControl::UpdatePositions(const uint64_t& simstep) break; case DCUM_UNKNOWN: default: - global_log->error() << "[DistControl] UpdatePositions() Corrupted code!!! Programm exit..." << endl; + Log::global_log->error() << "[DistControl] UpdatePositions() Corrupted code!!! Programm exit..." << std::endl; exit(-1); } @@ -764,7 +763,7 @@ void DistControl::WriteData(const uint64_t& simstep) DomainDecompBase& domainDecomp = global_simulation->domainDecomposition(); // write out data - stringstream outputstream; + std::stringstream outputstream; // write data if(simstep % _controlFreqs.write.data == 0) @@ -798,9 +797,9 @@ void DistControl::WriteData(const uint64_t& simstep) } } - outputstream << endl; + outputstream << std::endl; - ofstream fileout(_strFilename.c_str(), ios::out|ios::app); + std::ofstream fileout(_strFilename.c_str(), std::ios::out|std::ios::app); fileout << outputstream.str(); fileout.close(); #ifdef ENABLE_MPI @@ -815,7 +814,7 @@ void DistControl::WriteHeader() DomainDecompBase& domainDecomp = global_simulation->domainDecomposition(); // write header - stringstream outputstream; + std::stringstream outputstream; #ifdef ENABLE_MPI int rank = domainDecomp.getRank(); @@ -843,9 +842,9 @@ void DistControl::WriteHeader() if(nullptr != ctrlInst) outputstream << std::setw (24) << ctrlInst->getShortName(); } - outputstream << endl; + outputstream << std::endl; - ofstream fileout(_strFilename.c_str(), ios::out); + std::ofstream fileout(_strFilename.c_str(), std::ios::out); fileout << outputstream.str(); fileout.close(); @@ -863,13 +862,13 @@ void DistControl::WriteDataProfiles(const uint64_t& simstep) // domain decomposition DomainDecompBase& domainDecomp = global_simulation->domainDecomposition(); - stringstream outputstream; - stringstream filenamestream; + std::stringstream outputstream; + std::stringstream filenamestream; filenamestream << _strFilenameProfilesPrefix << "_TS"; filenamestream.fill('0'); filenamestream.width(9); - filenamestream << right << simstep; + filenamestream << std::right << simstep; filenamestream << ".dat"; #ifdef ENABLE_MPI @@ -889,7 +888,7 @@ void DistControl::WriteDataProfiles(const uint64_t& simstep) outputstream << " Fy[" << cid << "]"; outputstream << " Fy_smooth[" << cid << "]"; } - outputstream << endl; + outputstream << std::endl; // write data for(auto s=0u; s<_binParams.count; ++s) { @@ -903,9 +902,9 @@ void DistControl::WriteDataProfiles(const uint64_t& simstep) outputstream << FORMAT_SCI_MAX_DIGITS << _dForceProfile.at(nIndex); outputstream << FORMAT_SCI_MAX_DIGITS << _dForceProfileSmoothed.at(nIndex); } - outputstream << endl; + outputstream << std::endl; } - ofstream fileout(filenamestream.str().c_str(), ios::out|ios::out); + std::ofstream fileout(filenamestream.str().c_str(), std::ios::out|std::ios::out); fileout << outputstream.str(); fileout.close(); } @@ -992,8 +991,8 @@ void DistControl::DerivateProfile(double* dDataX, double* dDataY, double* dDeriv } */ - vector x; - vector y; + std::vector x; + std::vector y; for(auto s=0u; s #include -using namespace std; -using Log::global_log; DriftCtrl::DriftCtrl() { @@ -53,8 +51,8 @@ void DriftCtrl::init(ParticleContainer* particleContainer, DomainDecompBase* dom _sampling.at(cid).velocity.at(2).local.at(yPosID) = 0.; } } - global_log->debug() << "[DriftCtrl] Init data structures for " << numComponents << " components." << std::endl; - + Log::global_log->debug() << "[DriftCtrl] Init data structures for " << numComponents << " components." << std::endl; + // init files { const std::string fname = "DriftCtrl_drift.dat"; @@ -93,7 +91,7 @@ void DriftCtrl::readXML(XMLfileUnits& xmlconfig) xmlconfig.getNodeValue("control/start", _control.start); xmlconfig.getNodeValue("control/stop", _control.stop); - + // range _range.yl = 0.; _range.yr = _simulation.getDomain()->getGlobalLength(1); @@ -102,8 +100,8 @@ void DriftCtrl::readXML(XMLfileUnits& xmlconfig) xmlconfig.getNodeValue("range/yr", strVal); // accept "box" as input _range.yr = (strVal == "box") ? _simulation.getDomain()->getGlobalLength(1) : atof(strVal.c_str()); - global_log->info() << "[DriftCtrl] Enabled in range yl,yr=" << _range.yl << "," << _range.yr << std::endl; - global_log->info() << "[DriftCtrl] Enabled between simstep " << _control.start << " and " << _control.stop << std::endl; + Log::global_log->info() << "[DriftCtrl] Enabled in range yl,yr=" << _range.yl << "," << _range.yr << std::endl; + Log::global_log->info() << "[DriftCtrl] Enabled between simstep " << _control.start << " and " << _control.stop << std::endl; _range.width = _range.yr - _range.yl; // subdivision _range.subdivision.binWidth.init = 10.; @@ -141,13 +139,13 @@ void DriftCtrl::readXML(XMLfileUnits& xmlconfig) _directions.push_back(2); break; default: - global_log->warning() << "[DriftCtrl] Unknown direction: " << c << endl; + Log::global_log->warning() << "[DriftCtrl] Unknown direction: " << c << std::endl; } } - global_log->info() << "[DriftCtrl] Directions to be controlled: " << strDirs << endl; - global_log->info() << "[DriftCtrl] Target drift vx,vy,vz=" - << _target.drift.at(0) << "," << _target.drift.at(1) << "," << _target.drift.at(2) << ", cid=" << _target.cid << endl; + Log::global_log->info() << "[DriftCtrl] Directions to be controlled: " << strDirs << std::endl; + Log::global_log->info() << "[DriftCtrl] Target drift vx,vy,vz=" + << _target.drift.at(0) << "," << _target.drift.at(1) << "," << _target.drift.at(2) << ", cid=" << _target.cid << std::endl; } void DriftCtrl::beforeForces(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, unsigned long simstep) @@ -159,7 +157,7 @@ void DriftCtrl::beforeForces(ParticleContainer* particleContainer, DomainDecompB } int nRank = domainDecomp->getRank(); - + // sample if(simstep % _control.freq.sample == 0) { @@ -168,7 +166,7 @@ void DriftCtrl::beforeForces(ParticleContainer* particleContainer, DomainDecompB double yPos = it->r(1); if(yPos <= _range.yl || yPos > _range.yr) continue; - + const uint32_t cid_zb = it->componentid(); const uint32_t cid_ub = cid_zb+1; const uint32_t yPosID = floor( (yPos-_range.yl) / _range.subdivision.binWidth.actual); @@ -182,7 +180,7 @@ void DriftCtrl::beforeForces(ParticleContainer* particleContainer, DomainDecompB } } } - + // control if(simstep % _control.freq.control == 0) { @@ -202,7 +200,7 @@ void DriftCtrl::beforeForces(ParticleContainer* particleContainer, DomainDecompB numValsCheck += 4; } } - //~ cout << "numVals ?= numValsCheck: " << numVals << "?=" << numValsCheck << endl; + //~ cout << "numVals ?= numValsCheck: " << numVals << "?=" << numValsCheck << std::endl; // reduce domainDecomp->collCommAllreduceSum(); // collect global values @@ -215,11 +213,11 @@ void DriftCtrl::beforeForces(ParticleContainer* particleContainer, DomainDecompB numParticles = 1; double invNumParticles = 1./static_cast(numParticles); _sampling.at(cid).numParticles.global.at(yPosID) = numParticles; - //~ cout << "[" << nRank << "]: cid=" << cid << ",yPosID=" << yPosID << ",numParticles=" << numParticles << endl; + //~ cout << "[" << nRank << "]: cid=" << cid << ",yPosID=" << yPosID << ",numParticles=" << numParticles << std::endl; _sampling.at(cid).velocity.at(0).global.at(yPosID) = domainDecomp->collCommGetDouble() * invNumParticles; _sampling.at(cid).velocity.at(1).global.at(yPosID) = domainDecomp->collCommGetDouble() * invNumParticles; _sampling.at(cid).velocity.at(2).global.at(yPosID) = domainDecomp->collCommGetDouble() * invNumParticles; - + // reset local values _sampling.at(cid).numParticles.local.at(yPosID) = 0; _sampling.at(cid).velocity.at(0).local.at(yPosID) = 0.; @@ -229,7 +227,7 @@ void DriftCtrl::beforeForces(ParticleContainer* particleContainer, DomainDecompB } // finalize domainDecomp->collCommFinalize(); - + // calc correction for(uint32_t cid = 0; cid < numComponents; ++cid) { @@ -240,14 +238,14 @@ void DriftCtrl::beforeForces(ParticleContainer* particleContainer, DomainDecompB _sampling.at(cid).velo_corr.at(2).at(yPosID) = _target.drift.at(2) - _sampling.at(cid).velocity.at(2).global.at(yPosID); } } - + // do correction for(auto it = particleContainer->iterator(ParticleIterator::ONLY_INNER_AND_BOUNDARY); it.isValid(); ++it) { // check if inside range double yPos = it->r(1); if(yPos <= _range.yl || yPos > _range.yr) continue; - + // check if target component uint32_t cid_ub = 0; if (_target.cid != 0) { @@ -256,14 +254,14 @@ void DriftCtrl::beforeForces(ParticleContainer* particleContainer, DomainDecompB continue; } } - + uint32_t yPosID = floor( (yPos-_range.yl) / _range.subdivision.binWidth.actual); for (const auto d : _directions) { - it->setv(d, it->v(d) + _sampling.at(cid_ub).velo_corr.at(d).at(yPosID) ); + it->setv(d, it->v(d) + _sampling.at(cid_ub).velo_corr.at(d).at(yPosID) ); } } } - + // write to file if(simstep % _control.freq.write == 0 && nRank == 0) { @@ -271,7 +269,7 @@ void DriftCtrl::beforeForces(ParticleContainer* particleContainer, DomainDecompB const std::string fname = "DriftCtrl_drift.dat"; std::ofstream ofs; ofs.open(fname, std::ios::app); - ofs << setw(12) << simstep; + ofs << std::setw(12) << simstep; for(const auto &veloGlobalY : _sampling.at(_target.cid).velocity.at(1).global) { ofs << FORMAT_SCI_MAX_DIGITS << veloGlobalY; } @@ -282,9 +280,9 @@ void DriftCtrl::beforeForces(ParticleContainer* particleContainer, DomainDecompB const std::string fname = "DriftCtrl_numParticles.dat"; std::ofstream ofs; ofs.open(fname, std::ios::app); - ofs << setw(12) << simstep; + ofs << std::setw(12) << simstep; for(const auto &numPartsGlobal : _sampling.at(_target.cid).numParticles.global) { - ofs << setw(12) << numPartsGlobal; + ofs << std::setw(12) << numPartsGlobal; } ofs << std::endl; ofs.close(); diff --git a/src/plugins/NEMD/DriftCtrl.h b/src/plugins/NEMD/DriftCtrl.h index c49028bf24..82e5df2ff0 100644 --- a/src/plugins/NEMD/DriftCtrl.h +++ b/src/plugins/NEMD/DriftCtrl.h @@ -78,12 +78,12 @@ class DriftCtrl : public PluginBase { } binWidth; } subdivision; } _range; - + struct Target { std::array drift; uint32_t cid; } _target; - + std::vector _sampling; std::vector _directions; diff --git a/src/plugins/NEMD/MettDeamon.cpp b/src/plugins/NEMD/MettDeamon.cpp index ad0dae750e..aa1f0123eb 100644 --- a/src/plugins/NEMD/MettDeamon.cpp +++ b/src/plugins/NEMD/MettDeamon.cpp @@ -30,7 +30,6 @@ #include #include -using namespace std; template < typename T > void shuffle( std::list& lst ) // shuffle contents of a list { @@ -65,9 +64,9 @@ void update_velocity_vectors(Random* rnd, const uint64_t& numSamples, const doub std::vector& vxi, std::vector& vyi, std::vector& vzi) { double stdDev = sqrt(T); - vector v2xi(numSamples); - vector v2yi(numSamples); - vector v2zi(numSamples); + std::vector v2xi(numSamples); + std::vector v2yi(numSamples); + std::vector v2zi(numSamples); vxi.resize(numSamples); vyi.resize(numSamples); vzi.resize(numSamples); @@ -173,7 +172,7 @@ void update_velocity_vectors(Random* rnd, const uint64_t& numSamples, const doub sum_v2xi = std::accumulate(v2xi.begin(), v2xi.end(), 0.0); sum_v2yi = std::accumulate(v2yi.begin(), v2yi.end(), 0.0); sum_v2zi = std::accumulate(v2zi.begin(), v2zi.end(), 0.0); - + // <-- EKIN // calc drift again @@ -285,24 +284,24 @@ void MettDeamon::readXML(XMLfileUnits& xmlconfig) xmlconfig.getNodeValue("control/feed/method", nVal); if(1 == nVal) { _nFeedRateMethod = FRM_DELETED_MOLECULES; - global_log->info() << "[MettDeamon] Feed method 1: Calculating feed rate without additional plugins using deleted and changed particles" << std::endl; + Log::global_log->info() << "[MettDeamon] Feed method 1: Calculating feed rate without additional plugins using deleted and changed particles" << std::endl; } else if(2 == nVal) { _nFeedRateMethod = FRM_CHANGED_MOLECULES; - global_log->info() << "[MettDeamon] Feed method 2: Calculating feed rate without additional plugins using only changed particles" << std::endl; + Log::global_log->info() << "[MettDeamon] Feed method 2: Calculating feed rate without additional plugins using only changed particles" << std::endl; } else if(3 == nVal) { _nFeedRateMethod = FRM_DENSITY; - global_log->info() << "[MettDeamon] Feed method 3: Adjusting feed rate to meet target density" << std::endl; + Log::global_log->info() << "[MettDeamon] Feed method 3: Adjusting feed rate to meet target density" << std::endl; } else if(4 == nVal) { _nFeedRateMethod = FRM_CONSTANT; xmlconfig.getNodeValue("control/feed/target", _feedrate.feed.init); - global_log->info() << "[MettDeamon] Feed method 4: Using constant feed rate with v = " << _feedrate.feed.init << std::endl; + Log::global_log->info() << "[MettDeamon] Feed method 4: Using constant feed rate with v = " << _feedrate.feed.init << std::endl; } else if(5 == nVal) { _nFeedRateMethod = FRM_DIRECTED; - global_log->info() << "[MettDeamon] Feed method 5: Getting feed rate from MettDeamonFeedrateDirector" << std::endl; + Log::global_log->info() << "[MettDeamon] Feed method 5: Getting feed rate from MettDeamonFeedrateDirector" << std::endl; } _feedrate.release_velo.method = RVM_UNKNOWN; @@ -322,7 +321,7 @@ void MettDeamon::readXML(XMLfileUnits& xmlconfig) bRet = bRet && xmlconfig.getNodeValue("control/feed/release_velo/vxz", _norm.fname.vxz); bRet = bRet && xmlconfig.getNodeValue("control/feed/release_velo/vy", _norm.fname.vy); if(bRet) { // TODO: move this to method: init()? Has to be called before method: afterForces(), within method Simulation::prepare_start() - global_log->info() << "[MettDeamon] Release velocities uses MB from files." << std::endl; + Log::global_log->info() << "[MettDeamon] Release velocities uses MB from files." << std::endl; this->readNormDistr(); shuffle(_norm.vxz); // sequence should differ between processes shuffle(_norm.vy); // same here @@ -397,7 +396,7 @@ void MettDeamon::readXML(XMLfileUnits& xmlconfig) // reservoir { - string oldpath = xmlconfig.getcurrentnodepath(); + std::string oldpath = xmlconfig.getcurrentnodepath(); xmlconfig.changecurrentnode("reservoir"); _reservoir->readXML(xmlconfig); xmlconfig.changecurrentnode(oldpath); @@ -413,12 +412,12 @@ void MettDeamon::readXML(XMLfileUnits& xmlconfig) uint8_t numChanges = 0; XMLfile::Query query = xmlconfig.query("change"); numChanges = query.card(); - global_log->info() << "[MettDeamon] Number of fixed molecules components: " << numChanges << endl; + Log::global_log->info() << "[MettDeamon] Number of fixed molecules components: " << numChanges << std::endl; if(numChanges < 1) { - global_log->error() << "[MettDeamon] No component change defined in XML-config file. Program exit ..." << endl; + Log::global_log->error() << "[MettDeamon] No component change defined in XML-config file. Program exit ..." << std::endl; Simulation::exit(-1); } - string oldpath = xmlconfig.getcurrentnodepath(); + std::string oldpath = xmlconfig.getcurrentnodepath(); XMLfile::Query::const_iterator changeIter; for( changeIter = query.begin(); changeIter; changeIter++ ) { xmlconfig.changecurrentnode(changeIter); @@ -433,7 +432,7 @@ void MettDeamon::readXML(XMLfileUnits& xmlconfig) xmlconfig.changecurrentnode(".."); } else { - global_log->error() << "[MettDeamon] No component changes defined in XML-config file. Program exit ..." << endl; + Log::global_log->error() << "[MettDeamon] No component changes defined in XML-config file. Program exit ..." << std::endl; Simulation::exit(-1); } } @@ -494,8 +493,8 @@ void MettDeamon::prepare_start(DomainDecompBase* domainDecomp, ParticleContainer _reservoir->readParticleData(domainDecomp, particleContainer); _dInvDensityArea = 1. / (_dAreaXZ * _reservoir->getDensity() ); if(_reservoir->getDensity() < 1e-9) { - global_log->warning() << "[MettDeamon] ERROR: Reservoir density too low, _reservoir->getDensity()=" - << _reservoir->getDensity() << endl; + Log::global_log->warning() << "[MettDeamon] ERROR: Reservoir density too low, _reservoir->getDensity()=" + << _reservoir->getDensity() << std::endl; } // Activate reservoir bin with respect to restart information if(_bIsRestart) @@ -838,9 +837,9 @@ void MettDeamon::postForce_action(ParticleContainer* particleContainer, DomainDe this->calcDeltaY(); else if(FRM_DENSITY == _nFeedRateMethod) this->calcDeltaYbyDensity(); - global_log->debug() << "_numDeletedMolsSum = " << _numDeletedMolsSum << endl; - global_log->debug() << "_dDeletedMolsPerTimestep = " << _dDeletedMolsPerTimestep << endl; - global_log->debug() << "_feedrate.feed.actual = " << _feedrate.feed.actual << endl; + Log::global_log->debug() << "_numDeletedMolsSum = " << _numDeletedMolsSum << std::endl; + Log::global_log->debug() << "_dDeletedMolsPerTimestep = " << _dDeletedMolsPerTimestep << std::endl; + Log::global_log->debug() << "_feedrate.feed.actual = " << _feedrate.feed.actual << std::endl; } else { @@ -887,7 +886,7 @@ void MettDeamon::writeRestartfile() } else { ofs.open(fname, std::ios::app); } - ofs << setw(12) << simstep << setw(12) << _reservoir->getActualBinIndex(); + ofs << std::setw(12) << simstep << std::setw(12) << _reservoir->getActualBinIndex(); ofs << FORMAT_SCI_MAX_DIGITS << _feedrate.feed.sum << std::endl; ofs.close(); } @@ -899,13 +898,13 @@ void MettDeamon::writeRestartfile() const std::string fname = "MettDeamonRestart_movdir-"+std::to_string(_nMovingDirection); fnamestream << fname << "_TS" << fill_width('0', 9) << simstep << ".xml"; ofs.open(fnamestream.str().c_str(), std::ios::out); - ofs << "" << endl; - ofs << "" << endl; - ofs << "\t" << _reservoir->getActualBinIndex() << "" << endl; - ios::fmtflags f( ofs.flags() ); - ofs << "\t" << FORMAT_SCI_MAX_DIGITS_WIDTH_21 << _feedrate.feed.sum << "" << endl; + ofs << "" << std::endl; + ofs << "" << std::endl; + ofs << "\t" << _reservoir->getActualBinIndex() << "" << std::endl; + std::ios::fmtflags f( ofs.flags() ); + ofs << "\t" << FORMAT_SCI_MAX_DIGITS_WIDTH_21 << _feedrate.feed.sum << "" << std::endl; ofs.flags(f); // restore default format flags - ofs << "" << endl; + ofs << "" << std::endl; ofs.close(); } } @@ -935,7 +934,7 @@ void MettDeamon::logFeedrate() } else { ofs.open(fname, std::ios::app); } - ofs << setw(12) << global_simulation->getSimulationStep(); + ofs << std::setw(12) << global_simulation->getSimulationStep(); ofs << FORMAT_SCI_MAX_DIGITS << _feedrate.feed.actual << std::endl; ofs.close(); } @@ -976,7 +975,7 @@ void MettDeamon::logReleased() } else { ofs.open(fname, std::ios::app); } - ofs << setw(12) << global_simulation->getSimulationStep() << setw(12) << _released.count.global << setw(12) << _released.deleted.global << std::endl; + ofs << std::setw(12) << global_simulation->getSimulationStep() << std::setw(12) << _released.count.global << std::setw(12) << _released.deleted.global << std::endl; ofs.close(); } @@ -988,7 +987,7 @@ void MettDeamon::logReleasedVelocities() uint64_t simstep = global_simulation->getSimulationStep(); if(0 != (simstep % _released.log_freq_vel) ) return; - + if( simstep == global_simulation->getNumInitTimesteps() ) // do not write data directly after (re)start return; @@ -1059,14 +1058,14 @@ void MettDeamon::getAvailableParticleIDs(ParticleContainer* particleContainer, D domain->updateMaxMoleculeID(particleContainer, domainDecomp); maxID = domain->getMaxMoleculeID(); numMolecules.global = domain->getglobalNumMolecules(true, particleContainer, domainDecomp); - global_log->debug() << "[" << nRank << "]: maxID.local, maxID.global=" << maxID.local << ", " << maxID.global << endl; + Log::global_log->debug() << "[" << nRank << "]: maxID.local, maxID.global=" << maxID.local << ", " << maxID.global << std::endl; uint64_t numMoleculesAfterInsertion = numMolecules.global + numParticleIDs.global; uint64_t numIDs; if(maxID.global >= numMoleculesAfterInsertion) numIDs = maxID.global + 1; else numIDs = numMoleculesAfterInsertion + 1; - global_log->debug() << "[" << nRank << "]: numMoleculesAfterInsertion, numMolecules.global=" << numMoleculesAfterInsertion << ", " << numMolecules.global << endl; + Log::global_log->debug() << "[" << nRank << "]: numMoleculesAfterInsertion, numMolecules.global=" << numMoleculesAfterInsertion << ", " << numMolecules.global << std::endl; std::vector& vl = particleIDs_assigned.local; vl.resize(numIDs); std::fill(vl.begin(), vl.end(), 0); @@ -1085,7 +1084,7 @@ void MettDeamon::getAvailableParticleIDs(ParticleContainer* particleContainer, D vg.at(ii) = vl.at(ii); #endif - global_log->debug() << "[" << nRank << "]: assigned.local, assigned.global=" << particleIDs_assigned.local.size() << ", " << particleIDs_assigned.global.size() << endl; + Log::global_log->debug() << "[" << nRank << "]: assigned.local, assigned.global=" << particleIDs_assigned.local.size() << ", " << particleIDs_assigned.global.size() << std::endl; // check for available particle IDs for(uint64_t pid=1; piddebug() << "[" << nRank << "]: avail.local, avail.global=" << particleIDs_available.local.size() << ", " << particleIDs_available.global.size() << endl; + Log::global_log->debug() << "[" << nRank << "]: avail.local, avail.global=" << particleIDs_available.local.size() << ", " << particleIDs_available.global.size() << std::endl; #ifdef ENABLE_MPI // gather displacement (displs) @@ -1140,7 +1139,7 @@ void MettDeamon::InsertReservoirSlab(ParticleContainer* particleContainer) { DomainDecompBase& domainDecomp = global_simulation->domainDecomposition(); this->updateReservoir(&domainDecomp, particleContainer); - + int nRank = domainDecomp.getRank(); int numProcs = domainDecomp.getNumProcs(); std::vector* ptrComps = global_simulation->getEnsemble()->getComponents(); @@ -1187,10 +1186,10 @@ void MettDeamon::InsertReservoirSlab(ParticleContainer* particleContainer) } _feedrate.feed.sum -= _reservoir->getBinWidth(); // reset feed sum if(not _reservoir->nextBin(_nMaxMoleculeID.global) ) { - global_log->error() << "[MettDeamon] Failed to activate new bin of particle Reservoir's BinQueue => Program exit." << endl; + Log::global_log->error() << "[MettDeamon] Failed to activate new bin of particle Reservoir's BinQueue => Program exit." << std::endl; Simulation::exit(-1); } - global_log->debug() << "[" << nRank << "]: ADDED " << numAdded.local << "/" << numParticlesCurrentSlab.local << " particles (" << numAdded.local/static_cast(numParticlesCurrentSlab.local)*100 << ")%." << endl; + Log::global_log->debug() << "[" << nRank << "]: ADDED " << numAdded.local << "/" << numParticlesCurrentSlab.local << " particles (" << numAdded.local/static_cast(numParticlesCurrentSlab.local)*100 << ")%." << std::endl; // calc global values domainDecomp.collCommInit(1); domainDecomp.collCommAppendUnsLong(numAdded.local); @@ -1199,7 +1198,7 @@ void MettDeamon::InsertReservoirSlab(ParticleContainer* particleContainer) domainDecomp.collCommFinalize(); if(0 == nRank) - global_log->debug() << "[" << nRank << "]: ADDED " << numAdded.global << "/" << numParticlesCurrentSlab.global << " particles (" << numAdded.global/static_cast(numParticlesCurrentSlab.global)*100 << ")%." << endl; + Log::global_log->debug() << "[" << nRank << "]: ADDED " << numAdded.global << "/" << numParticlesCurrentSlab.global << " particles (" << numAdded.global/static_cast(numParticlesCurrentSlab.global)*100 << ")%." << std::endl; } void MettDeamon::initRestart() @@ -1207,7 +1206,7 @@ void MettDeamon::initRestart() bool bRet = _reservoir->activateBin(_restartInfo.nBindindex); if(not bRet) { - global_log->info() << "[MettDeamon] Failed to activate reservoir bin after restart! Program exit ... " << endl; + Log::global_log->info() << "[MettDeamon] Failed to activate reservoir bin after restart! Program exit ... " << std::endl; Simulation::exit(-1); } _feedrate.feed.sum = _restartInfo.dYsum; @@ -1249,13 +1248,13 @@ void MettDeamon::readNormDistr() void MettDeamon::updateRandVecTrappedIns() { create_rand_vec_ones(100, _feedrate.release_velo.normMB.a_neg, _feedrate.vec_rand_ins); - global_log->debug() << "_feedrate.vec_rand_ins: "; + Log::global_log->debug() << "_feedrate.vec_rand_ins: "; int nSum = 0; for(auto vi:_feedrate.vec_rand_ins) { - global_log->debug() << vi << ","; + Log::global_log->debug() << vi << ","; nSum += vi; } - global_log->debug() << "sum=" << nSum << endl; + Log::global_log->debug() << "sum=" << nSum << std::endl; } // class Reservoir @@ -1289,7 +1288,7 @@ void Reservoir::readXML(XMLfileUnits& xmlconfig) // update BinQueue before inserting new Reservoir slab _bUpdateBinQueue = true; xmlconfig.getNodeValue("@update", _bUpdateBinQueue); - + std::string strType = "unknown"; xmlconfig.getNodeValue("file@type", strType); xmlconfig.getNodeValue("binwidth", _dBinWidthInit); @@ -1307,7 +1306,7 @@ void Reservoir::readXML(XMLfileUnits& xmlconfig) xmlconfig.getNodeValue("file/data", _filepath.data); } else { - global_log->error() << "[MettDeamon] Reservoir file type not specified or unknown. Programm exit ..." << endl; + Log::global_log->error() << "[MettDeamon] Reservoir file type not specified or unknown. Programm exit ..." << std::endl; Simulation::exit(-1); } @@ -1317,10 +1316,10 @@ void Reservoir::readXML(XMLfileUnits& xmlconfig) XMLfile::Query query = xmlconfig.query("change"); numChanges = query.card(); if(numChanges < 1) { - global_log->error() << "[MettDeamon] No component change defined in XML-config file. Program exit ..." << endl; + Log::global_log->error() << "[MettDeamon] No component change defined in XML-config file. Program exit ..." << std::endl; Simulation::exit(-1); } - string oldpath = xmlconfig.getcurrentnodepath(); + std::string oldpath = xmlconfig.getcurrentnodepath(); XMLfile::Query::const_iterator changeIter; for( changeIter = query.begin(); changeIter; changeIter++ ) { xmlconfig.changecurrentnode(changeIter); @@ -1346,7 +1345,7 @@ void Reservoir::readParticleData(DomainDecompBase* domainDecomp, ParticleContain this->readFromFileBinary(domainDecomp, particleContainer); break; default: - global_log->error() << "[MettDeamon] Unknown (or ambiguous) method to read reservoir for feature MettDeamon. Program exit ..." << endl; + Log::global_log->error() << "[MettDeamon] Unknown (or ambiguous) method to read reservoir for feature MettDeamon. Program exit ..." << std::endl; Simulation::exit(-1); } @@ -1382,7 +1381,7 @@ void Reservoir::updateParticleData(DomainDecompBase* domainDecomp, ParticleConta ParticleData::MoleculeToParticleData(particle_buff[particle_buff_pos], _particleVector[i]); particle_buff_pos++; if ((particle_buff_pos >= PARTICLE_BUFFER_SIZE) || (i == num_particles - 1)) { - global_log->debug() << "broadcasting(sending) particles" << endl; + Log::global_log->debug() << "broadcasting(sending) particles" << std::endl; MPI_Bcast(particle_buff, PARTICLE_BUFFER_SIZE, mpi_Particle, rank, domainDecomp->getCommunicator()); particle_buff_pos = 0; } @@ -1391,14 +1390,14 @@ void Reservoir::updateParticleData(DomainDecompBase* domainDecomp, ParticleConta uint64_t numParticlesAdd = 0; for(unsigned long i = 0; i < num_particles; ++i) { if(i % PARTICLE_BUFFER_SIZE == 0) { - global_log->debug() << "broadcasting(receiving) particles" << endl; + Log::global_log->debug() << "broadcasting(receiving) particles" << std::endl; MPI_Bcast(particle_buff, PARTICLE_BUFFER_SIZE, mpi_Particle, rank, domainDecomp->getCommunicator()); particle_buff_pos = 0; } Molecule mol; ParticleData::ParticleDataToMolecule(particle_buff[particle_buff_pos], mol); particle_buff_pos++; - + bool bIsRelevant = this->isRelevant(domainDecomp, domain, mol); if (bIsRelevant) { _particleVector.push_back(mol); @@ -1406,10 +1405,10 @@ void Reservoir::updateParticleData(DomainDecompBase* domainDecomp, ParticleConta } } if(numParticlesAdd > 0) { - global_log->debug() << "Rank " << ownRank << " received " << numParticlesAdd << " particles from rank " << rank << "." << endl; + Log::global_log->debug() << "Rank " << ownRank << " received " << numParticlesAdd << " particles from rank " << rank << "." << std::endl; } } - global_log->debug() << "broadcasting(sending/receiving) particles complete" << endl; + Log::global_log->debug() << "broadcasting(sending/receiving) particles complete" << std::endl; } // delete particles out of bounding box @@ -1424,7 +1423,7 @@ void Reservoir::updateParticleData(DomainDecompBase* domainDecomp, ParticleConta _particleVector.resize(particleVectorTmp.size()); _particleVector = particleVectorTmp; if(_particleVector.size() < numParticlesOld) { - global_log->debug() << "Rank " << ownRank << " deleted " << numParticlesOld - _particleVector.size() << " particles from particle vector." << endl; + Log::global_log->debug() << "Rank " << ownRank << " deleted " << numParticlesOld - _particleVector.size() << " particles from particle vector." << std::endl; } // Refresh BinQueue uint32_t actual = _binQueue->getActualBinIndex(); @@ -1440,19 +1439,19 @@ void Reservoir::sortParticlesToBins(DomainDecompBase* domainDecomp, ParticleCont uint32_t numBins = _box.length.at(1) / _dBinWidthInit; _dBinWidth = _box.length.at(1) / static_cast(numBins); - if (_dBinWidthInit != _dBinWidth) { global_log->warning() << "[MettDeamon] Bin width changed from " << _dBinWidthInit << " to " << _dBinWidth << std::endl; } - global_log->debug() << "_arrBoxLength[1]="<<_box.length.at(1)<debug() << "_dBinWidthInit="<<_dBinWidthInit<debug() << "_numBins="<debug() << "_particleVector.size()=" << _particleVector.size() << endl; + if (_dBinWidthInit != _dBinWidth) { Log::global_log->warning() << "[MettDeamon] Bin width changed from " << _dBinWidthInit << " to " << _dBinWidth << std::endl; } + Log::global_log->debug() << "_arrBoxLength[1]="<<_box.length.at(1)<debug() << "_dBinWidthInit="<<_dBinWidthInit<debug() << "_numBins="<debug() << "_particleVector.size()=" << _particleVector.size() << std::endl; - global_log->debug() << "bbMin =" + Log::global_log->debug() << "bbMin =" << domainDecomp->getBoundingBoxMin(0, domain) << ", " << domainDecomp->getBoundingBoxMin(1, domain) << ", " << domainDecomp->getBoundingBoxMin(2, domain) << "; bbMax = " << domainDecomp->getBoundingBoxMax(0, domain) << ", " << domainDecomp->getBoundingBoxMax(1, domain) << ", " - << domainDecomp->getBoundingBoxMax(2, domain) << endl; + << domainDecomp->getBoundingBoxMax(2, domain) << std::endl; std::vector< std::vector > binVector; binVector.resize(numBins); uint32_t nBinIndex; @@ -1462,7 +1461,7 @@ void Reservoir::sortParticlesToBins(DomainDecompBase* domainDecomp, ParticleCont this->changeComponentID(mol, mol.componentid() ); double y = mol.r(1); nBinIndex = floor(y / _dBinWidth); - global_log->debug() << "[MettDeamon] y="<error() << "[MettDeamon] Unknown moving direction" << std::endl; } // check if molecule is in bounding box of the process domain bool bIsInsideBB = domainDecomp->procOwnsPos(mol.r(0), mol.r(1), mol.r(2), domain); bool bIsInsidePC = particleContainer->isInBoundingBox(mol.r_arr().data()); if(bIsInsideBB != bIsInsidePC) - global_log->debug() << "[MettDeamon] bIsInsideBB=" << bIsInsideBB << ", bIsInsidePC=" << bIsInsidePC << endl; + Log::global_log->debug() << "[MettDeamon] bIsInsideBB=" << bIsInsideBB << ", bIsInsidePC=" << bIsInsidePC << std::endl; if (bIsInsideBB) binVector.at(nBinIndex).push_back(mol); } @@ -1492,7 +1491,7 @@ void Reservoir::sortParticlesToBins(DomainDecompBase* domainDecomp, ParticleCont case MD_LEFT_TO_RIGHT: for (auto bit = binVector.rbegin(); bit != binVector.rend(); ++bit) { - global_log->debug() << "(*bit).size()=" << (*bit).size() << endl; + Log::global_log->debug() << "(*bit).size()=" << (*bit).size() << std::endl; _binQueue->enque(*bit); } break; @@ -1500,12 +1499,12 @@ void Reservoir::sortParticlesToBins(DomainDecompBase* domainDecomp, ParticleCont case MD_RIGHT_TO_LEFT: for(const auto& bin:binVector) { - global_log->debug() << "bin.size()=" << bin.size() << endl; + Log::global_log->debug() << "bin.size()=" << bin.size() << std::endl; _binQueue->enque(bin); } break; default: - global_log->error() << "[MettDeamon] Unknown moving direction" << endl; + Log::global_log->error() << "[MettDeamon] Unknown moving direction" << std::endl; } } @@ -1513,19 +1512,19 @@ void Reservoir::readFromFile(DomainDecompBase* domainDecomp, ParticleContainer* { Domain* domain = global_simulation->getDomain(); std::ifstream ifs; - global_log->info() << "[MettDeamon] Reservoir read in from ASCII file" << endl; - global_log->info() << "[MettDeamon] Opening Reservoirfile " << _filepath.data << endl; + Log::global_log->info() << "[MettDeamon] Reservoir read in from ASCII file" << std::endl; + Log::global_log->info() << "[MettDeamon] Opening Reservoirfile " << _filepath.data << std::endl; ifs.open( _filepath.data.c_str() ); if (!ifs.is_open()) { - global_log->error() << "[MettDeamon] Could not open Mettdeamon Reservoirfile " << _filepath.data << endl; + Log::global_log->error() << "[MettDeamon] Could not open Mettdeamon Reservoirfile " << _filepath.data << std::endl; Simulation::exit(1); } - global_log->info() << "[MettDeamon] Reading Mettdeamon Reservoirfile " << _filepath.data << endl; + Log::global_log->info() << "[MettDeamon] Reading Mettdeamon Reservoirfile " << _filepath.data << std::endl; - string token; - vector& dcomponents = *(_simulation.getEnsemble()->getComponents()); + std::string token; + std::vector& dcomponents = *(_simulation.getEnsemble()->getComponents()); unsigned int numcomponents = dcomponents.size(); - string ntypestring("ICRVQD"); + std::string ntypestring("ICRVQD"); enum Ndatatype { ICRVQDV, ICRVQD, IRV, ICRV } ntype = ICRVQD; double Xlength, Ylength, Zlength; @@ -1546,14 +1545,14 @@ void Reservoir::readFromFile(DomainDecompBase* domainDecomp, ParticleContainer* } if((token != "NumberOfMolecules") && (token != "N")) { - global_log->error() << "[MettDeamon] Expected the token 'NumberOfMolecules (N)' instead of '" << token << "'" << endl; + Log::global_log->error() << "[MettDeamon] Expected the token 'NumberOfMolecules (N)' instead of '" << token << "'" << std::endl; Simulation::exit(1); } ifs >> _numMoleculesRead; this->setDensity(_numMoleculesRead / dVolume); - streampos spos = ifs.tellg(); + std::streampos spos = ifs.tellg(); ifs >> token; if((token=="MoleculeFormat") || (token == "M")) { @@ -1566,16 +1565,16 @@ void Reservoir::readFromFile(DomainDecompBase* domainDecomp, ParticleContainer* else if (ntypestring == "ICRV") ntype = ICRV; else if (ntypestring == "IRV") ntype = IRV; else { - global_log->error() << "[MettDeamon] Unknown molecule format '" << ntypestring << "'" << endl; + Log::global_log->error() << "[MettDeamon] Unknown molecule format '" << ntypestring << "'" << std::endl; Simulation::exit(1); } } else { ifs.seekg(spos); } - global_log->info() << " molecule format: " << ntypestring << endl; + Log::global_log->info() << " molecule format: " << ntypestring << std::endl; if( numcomponents < 1 ) { - global_log->warning() << "[MettDeamon] No components defined! Setting up single one-centered LJ" << endl; + Log::global_log->warning() << "[MettDeamon] No components defined! Setting up single one-centered LJ" << std::endl; numcomponents = 1; dcomponents.resize( numcomponents ); dcomponents[0].setID(0); @@ -1608,15 +1607,15 @@ void Reservoir::readFromFile(DomainDecompBase* domainDecomp, ParticleContainer* ifs >> id >> x >> y >> z >> vx >> vy >> vz; break; default: - global_log->error() << "[MettDeamon] Unknown molecule format" << endl; + Log::global_log->error() << "[MettDeamon] Unknown molecule format" << std::endl; } if( componentid > numcomponents ) { - global_log->error() << "[MettDeamon] Molecule id " << id + Log::global_log->error() << "[MettDeamon] Molecule id " << id << " has a component ID greater than the existing number of components: " << componentid << ">" - << numcomponents << endl; + << numcomponents << std::endl; Simulation::exit(1); } // ComponentIDs are used as array IDs, hence need to start at 0. @@ -1632,7 +1631,7 @@ void Reservoir::readFromFile(DomainDecompBase* domainDecomp, ParticleContainer* // Print status message unsigned long iph = _numMoleculesRead / 100; if( iph != 0 && (i % iph) == 0 ) - global_log->info() << "[MettDeamon] Finished reading molecules: " << i/iph << "%\r" << flush; + Log::global_log->info() << "[MettDeamon] Finished reading molecules: " << i/iph << "%\r" << std::flush; } ifs.close(); @@ -1644,8 +1643,8 @@ void Reservoir::readFromFileBinaryHeader() XMLfileUnits inp(_filepath.header); if(not inp.changecurrentnode("/mardyn")) { - global_log->error() << "[MettDeamon] Could not find root node /mardyn in XML header file or file itself." << endl; - global_log->fatal() << "[MettDeamon] Not a valid MarDyn XML header file." << endl; + Log::global_log->error() << "[MettDeamon] Could not find root node /mardyn in XML header file or file itself." << std::endl; + Log::global_log->fatal() << "[MettDeamon] Not a valid MarDyn XML header file." << std::endl; Simulation::exit(1); } @@ -1673,7 +1672,7 @@ void Reservoir::readFromFileBinaryHeader() if(not bInputOk) { - global_log->error() << "[MettDeamon] Content of file: '" << _filepath.header << "' corrupted! Program exit ..." << endl; + Log::global_log->error() << "[MettDeamon] Content of file: '" << _filepath.header << "' corrupted! Program exit ..." << std::endl; Simulation::exit(1); } @@ -1685,7 +1684,7 @@ void Reservoir::readFromFileBinaryHeader() _nMoleculeFormat = ICRV; else { - global_log->error() << "[MettDeamon] Not a valid molecule format: " << strMoleculeFormat << ", program exit ..." << endl; + Log::global_log->error() << "[MettDeamon] Not a valid molecule format: " << strMoleculeFormat << ", program exit ..." << std::endl; Simulation::exit(1); } } @@ -1693,24 +1692,24 @@ void Reservoir::readFromFileBinaryHeader() void Reservoir::readFromFileBinary(DomainDecompBase* domainDecomp, ParticleContainer* particleContainer) { Domain* domain = global_simulation->getDomain(); - global_log->info() << "[MettDeamon] Reservoir read in from binary file" << endl; + Log::global_log->info() << "[MettDeamon] Reservoir read in from binary file" << std::endl; // read header this->readFromFileBinaryHeader(); #ifdef ENABLE_MPI if(domainDecomp->getRank() == 0) { #endif - global_log->info() << "[MettDeamon] Opening phase space file " << _filepath.data << endl; + Log::global_log->info() << "[MettDeamon] Opening phase space file " << _filepath.data << std::endl; std::ifstream ifs; - ifs.open(_filepath.data.c_str(), ios::binary | ios::in); + ifs.open(_filepath.data.c_str(), std::ios::binary | std::ios::in); if (!ifs.is_open()) { - global_log->error() << "[MettDeamon] Could not open reservoir phaseSpaceFile " << _filepath.data << endl; + Log::global_log->error() << "[MettDeamon] Could not open reservoir phaseSpaceFile " << _filepath.data << std::endl; Simulation::exit(1); } - global_log->info() << "[MettDeamon] Reading phase space file " << _filepath.data << endl; + Log::global_log->info() << "[MettDeamon] Reading phase space file " << _filepath.data << std::endl; - vector& components = *(_simulation.getEnsemble()->getComponents()); + std::vector& components = *(_simulation.getEnsemble()->getComponents()); // Select appropriate reader switch (_nMoleculeFormat) { @@ -1723,7 +1722,7 @@ void Reservoir::readFromFileBinary(DomainDecompBase* domainDecomp, ParticleConta case IRV: _moleculeDataReader = std::make_unique(); break; - default: global_log->error() << "[MettDeamon] Unknown molecule format" << endl; + default: Log::global_log->error() << "[MettDeamon] Unknown molecule format" << std::endl; } for (uint64_t pi=0; pi<_numMoleculesRead; pi++) { @@ -1752,7 +1751,7 @@ void Reservoir::readFromFileBinary(DomainDecompBase* domainDecomp, ParticleConta ParticleData::MoleculeToParticleData(particle_buff[particle_buff_pos], _particleVector[i]); particle_buff_pos++; if ((particle_buff_pos >= PARTICLE_BUFFER_SIZE) || (i == num_particles - 1)) { - global_log->debug() << "broadcasting(sending) particles" << endl; + Log::global_log->debug() << "broadcasting(sending) particles" << std::endl; MPI_Bcast(particle_buff, PARTICLE_BUFFER_SIZE, mpi_Particle, 0, domainDecomp->getCommunicator()); particle_buff_pos = 0; } @@ -1767,21 +1766,21 @@ void Reservoir::readFromFileBinary(DomainDecompBase* domainDecomp, ParticleConta } else { for(unsigned long i = 0; i < num_particles; ++i) { if(i % PARTICLE_BUFFER_SIZE == 0) { - global_log->debug() << "broadcasting(receiving) particles" << endl; + Log::global_log->debug() << "broadcasting(receiving) particles" << std::endl; MPI_Bcast(particle_buff, PARTICLE_BUFFER_SIZE, mpi_Particle, 0, domainDecomp->getCommunicator()); particle_buff_pos = 0; } Molecule mol; ParticleData::ParticleDataToMolecule(particle_buff[particle_buff_pos], mol); particle_buff_pos++; - + bool bIsRelevant = this->isRelevant(domainDecomp, domain, mol); if (bIsRelevant) { _particleVector.push_back(mol); } } } - global_log->debug() << "broadcasting(sending/receiving) particles complete" << endl; + Log::global_log->debug() << "broadcasting(sending/receiving) particles complete" << std::endl; #endif } @@ -1806,7 +1805,7 @@ bool Reservoir::isRelevant(DomainDecompBase* domainDecomp, Domain* domain, Molec dOffset = nBinIndex*_dBinWidth + (domain->getGlobalLength(1) - _dBinWidth); break; default: - global_log->error() << "[MettDeamon] Unknown moving direction" << endl; + Log::global_log->error() << "[MettDeamon] Unknown moving direction" << std::endl; } return domainDecomp->procOwnsPos(mol.r(0), y-dOffset, mol.r(2), domain); } @@ -1822,9 +1821,9 @@ bool Reservoir::activateBin(uint32_t nBinIndex){return _binQueue->activateBin(nB void Reservoir::clearBinQueue() {_binQueue->clear();} void Reservoir::printBinQueueInfo() { - global_log->debug() << "_binQueue->getActualBinIndex()=" << _binQueue->getActualBinIndex() << endl; - global_log->debug() << "_binQueue->getNumBins()=" << _binQueue->getNumBins() << endl; - global_log->debug() << "_binQueue->getRoundCount()=" << _binQueue->getRoundCount() << endl; - global_log->debug() << "_binQueue->getNumParticles()=" << _binQueue->getNumParticles() << endl; - global_log->debug() << "_binQueue->getMaxID()=" << _binQueue->getMaxID() << endl; + Log::global_log->debug() << "_binQueue->getActualBinIndex()=" << _binQueue->getActualBinIndex() << std::endl; + Log::global_log->debug() << "_binQueue->getNumBins()=" << _binQueue->getNumBins() << std::endl; + Log::global_log->debug() << "_binQueue->getRoundCount()=" << _binQueue->getRoundCount() << std::endl; + Log::global_log->debug() << "_binQueue->getNumParticles()=" << _binQueue->getNumParticles() << std::endl; + Log::global_log->debug() << "_binQueue->getMaxID()=" << _binQueue->getMaxID() << std::endl; } diff --git a/src/plugins/NEMD/MettDeamon.h b/src/plugins/NEMD/MettDeamon.h index ae21fe957c..08aaa91496 100644 --- a/src/plugins/NEMD/MettDeamon.h +++ b/src/plugins/NEMD/MettDeamon.h @@ -220,17 +220,17 @@ class MettDeamon : public PluginBase void setActualFeedrate(const double& feed_actual) { if (FRM_DIRECTED == _nFeedRateMethod) { _feedrate.feed.actual = feed_actual; - global_log->info() << "[MettDeamon]: Set new feed rate by MDFRD to vf= " << _feedrate.feed.actual << std::endl; + Log::global_log->info() << "[MettDeamon]: Set new feed rate by MDFRD to vf= " << _feedrate.feed.actual << std::endl; } else { - global_log->warning() << "[MettDeamon]: Feed rate not set because current feed method ( " << _nFeedRateMethod << " ) is not set to communicate with MDFRD (method " << FRM_DIRECTED << ")" << std::endl; + Log::global_log->warning() << "[MettDeamon]: Feed rate not set because current feed method ( " << _nFeedRateMethod << " ) is not set to communicate with MDFRD (method " << FRM_DIRECTED << ")" << std::endl; } } void setInitFeedrate(const double& feed_init) { if (FRM_DIRECTED == _nFeedRateMethod) { _feedrate.feed.init = feed_init; - global_log->info() << "[MettDeamon]: Set init feed rate by MDFRD to vf= " << _feedrate.feed.init << std::endl; + Log::global_log->info() << "[MettDeamon]: Set init feed rate by MDFRD to vf= " << _feedrate.feed.init << std::endl; } else { - global_log->warning() << "[MettDeamon]: Feed rate not set because current feed method ( " << _nFeedRateMethod << " ) is not set to communicate with MDFRD (method " << FRM_DIRECTED << ")" << std::endl; + Log::global_log->warning() << "[MettDeamon]: Feed rate not set because current feed method ( " << _nFeedRateMethod << " ) is not set to communicate with MDFRD (method " << FRM_DIRECTED << ")" << std::endl; } } double getInvDensityArea() {return _dInvDensityArea;} @@ -261,7 +261,7 @@ class MettDeamon : public PluginBase void updateReservoir(DomainDecompBase* domainDecomp, ParticleContainer* particleContainer); void InsertReservoirSlab(ParticleContainer* particleContainer); void initRestart(); - + // stat. evap void readNormDistr(); @@ -306,7 +306,7 @@ class MettDeamon : public PluginBase uint32_t cid_ub; } _manipfree; FeedRateStruct _feedrate; - + // stat. evap. struct{ bool enabled; @@ -323,7 +323,7 @@ class MettDeamon : public PluginBase } right; } cid; } _vap_trans_plane; - + struct NormMB{ struct NormFnames{ std::string vxz; @@ -332,7 +332,7 @@ class MettDeamon : public PluginBase std::list vxz; std::list vy; } _norm; - + struct{ CommVar count; CommVar deleted; @@ -556,7 +556,7 @@ class BinQueue _last->_next = _first; // connect tail to head } } - + void clear() { while (!isEmpty()) { @@ -575,7 +575,7 @@ class BinQueue void showActualBin() { for(auto& p:_actual->_particles) std::cout << p << ", "; - std::cout << endl; + std::cout << std::endl; } void connectTailToHead() diff --git a/src/plugins/NEMD/MettDeamonFeedrateDirector.cpp b/src/plugins/NEMD/MettDeamonFeedrateDirector.cpp index 41ae21af21..602b4509a1 100644 --- a/src/plugins/NEMD/MettDeamonFeedrateDirector.cpp +++ b/src/plugins/NEMD/MettDeamonFeedrateDirector.cpp @@ -17,8 +17,6 @@ #include #include -using namespace std; -using Log::global_log; MettDeamonFeedrateDirector::MettDeamonFeedrateDirector() : @@ -40,7 +38,7 @@ MettDeamonFeedrateDirector::~MettDeamonFeedrateDirector() void MettDeamonFeedrateDirector::init(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, Domain* domain) { - global_log->debug() << "MettDeamonFeedrateDirector enabled." << std::endl; + Log::global_log->debug() << "MettDeamonFeedrateDirector enabled." << std::endl; // set actual feedrate MettDeamon* mettDeamon = nullptr; @@ -71,7 +69,7 @@ void MettDeamonFeedrateDirector::readXML(XMLfileUnits& xmlconfig) _updateControl.sampledTimestepCount = 0; _updateControl.updateFreq = 1000; xmlconfig.getNodeValue("mirror/control/update_freq", _updateControl.updateFreq); - global_log->info() << "[MettDeamonFeedrateDirector] Update frequency of Mirror = " << _updateControl.updateFreq << endl; + Log::global_log->info() << "[MettDeamonFeedrateDirector] Update frequency of Mirror = " << _updateControl.updateFreq << std::endl; // feedrate _feedrate.init = 0.; @@ -97,17 +95,17 @@ void MettDeamonFeedrateDirector::readXML(XMLfileUnits& xmlconfig) this->csv_str2list(strCSV, _feedrate.list); } #ifndef NDEBUG - cout << "feedrate.list:" << endl; + std::cout << "feedrate.list:" << std::endl; for (std::list::iterator it=_feedrate.list.begin(); it != _feedrate.list.end(); ++it) std::cout << ' ' << *it; - cout << endl; + std::cout << std::endl; #endif // init actual feed rate _feedrate.actual = _feedrate.list.back(); // _forceConstant = 100.; // xmlconfig.getNodeValue("forceConstant", _forceConstant); -// global_log->info() << "MettDeamonFeedrateDirector: force constant = " << _forceConstant << endl; +// Log::global_log->info() << "MettDeamonFeedrateDirector: force constant = " << _forceConstant << std::endl; // restart information _restart.writefreq = 1000; @@ -134,11 +132,11 @@ void MettDeamonFeedrateDirector::beforeForces( // Check if other plugins were found if(nullptr == mirror) { - global_log->error() << "[MettDeamonFeedrateDirector] No Mirror plugin found in plugin list. Program exit ..." << std::endl; + Log::global_log->error() << "[MettDeamonFeedrateDirector] No Mirror plugin found in plugin list. Program exit ..." << std::endl; Simulation::exit(-2004); } if(nullptr == mettDeamon) { - global_log->error() << "[MettDeamonFeedrateDirector] No MettDeamon plugin found in plugin list. Program exit ..." << std::endl; + Log::global_log->error() << "[MettDeamonFeedrateDirector] No MettDeamon plugin found in plugin list. Program exit ..." << std::endl; Simulation::exit(-2004); } @@ -196,17 +194,17 @@ void MettDeamonFeedrateDirector::calcFeedrate(MettDeamon* mettDeamon) _feedrate.avg = _feedrate.sum * dInvNumvals; #ifndef NDEBUG - cout << "[MDFD] Rank: " << domainDecomp.getRank() << " : feedrate.list: "; + std::cout << "[MDFD] Rank: " << domainDecomp.getRank() << " : feedrate.list: "; for (std::list::iterator it=_feedrate.list.begin(); it != _feedrate.list.end(); ++it) std::cout << " " << *it; - cout << endl; - cout << "[MDFD] Rank: " << domainDecomp.getRank() << " : _particleManipCount.deleted.local.at(cid)=" << _particleManipCount.deleted.local.at(cid) << endl; - cout << "[MDFD] Rank: " << domainDecomp.getRank() << " : _particleManipCount.deleted.global.at(cid)=" << _particleManipCount.deleted.global.at(cid) << endl; - cout << "[MDFD] Rank: " << domainDecomp.getRank() << " : deletedParticlesPerTimestep=" << deletedParticlesPerTimestep << endl; - cout << "[MDFD] Rank: " << domainDecomp.getRank() << " : _feedrate.actual=" << _feedrate.actual << endl; - cout << "[MDFD] Rank: " << domainDecomp.getRank() << " : _feedrate.sum=" << _feedrate.sum << endl; - cout << "[MDFD] Rank: " << domainDecomp.getRank() << " : _feedrate.avg=" << _feedrate.avg << endl; - cout << "[MDFD] Rank: " << domainDecomp.getRank() << " : mettDeamon->getInvDensityArea()=" << mettDeamon->getInvDensityArea() << endl; + std::cout << std::endl; + std::cout << "[MDFD] Rank: " << domainDecomp.getRank() << " : _particleManipCount.deleted.local.at(cid)=" << _particleManipCount.deleted.local.at(cid) << std::endl; + std::cout << "[MDFD] Rank: " << domainDecomp.getRank() << " : _particleManipCount.deleted.global.at(cid)=" << _particleManipCount.deleted.global.at(cid) << std::endl; + std::cout << "[MDFD] Rank: " << domainDecomp.getRank() << " : deletedParticlesPerTimestep=" << deletedParticlesPerTimestep << std::endl; + std::cout << "[MDFD] Rank: " << domainDecomp.getRank() << " : _feedrate.actual=" << _feedrate.actual << std::endl; + std::cout << "[MDFD] Rank: " << domainDecomp.getRank() << " : _feedrate.sum=" << _feedrate.sum << std::endl; + std::cout << "[MDFD] Rank: " << domainDecomp.getRank() << " : _feedrate.avg=" << _feedrate.avg << std::endl; + std::cout << "[MDFD] Rank: " << domainDecomp.getRank() << " : mettDeamon->getInvDensityArea()=" << mettDeamon->getInvDensityArea() << std::endl; #endif } @@ -246,17 +244,17 @@ void MettDeamonFeedrateDirector::writeRestartfile() std::stringstream fnamestream; fnamestream << "MettDeamonFeedrateDirectorRestart" << "_TS" << fill_width('0', 9) << simstep << ".xml"; std::ofstream ofs(fnamestream.str().c_str(), std::ios::out); - ofs << "" << endl; - ofs << "" << endl; - ofs << "\t" << _feedrate.numvals << "" << endl; - ios::fmtflags f( ofs.flags() ); + ofs << "" << std::endl; + ofs << "" << std::endl; + ofs << "\t" << _feedrate.numvals << "" << std::endl; + std::ios::fmtflags f( ofs.flags() ); ofs << "\t" << FORMAT_SCI_MAX_DIGITS_WIDTH_21 << _feedrate.list.front(); std::list::iterator it=_feedrate.list.begin(); for(std::advance(it, 1); it!=_feedrate.list.end(); ++it) ofs << "," << FORMAT_SCI_MAX_DIGITS_WIDTH_21 << *it; - ofs << "" << endl; + ofs << "
" << std::endl; ofs.flags(f); // restore default format flags - ofs << "" << endl; + ofs << "" << std::endl; ofs.close(); } } diff --git a/src/plugins/NEMD/RegionSampling.cpp b/src/plugins/NEMD/RegionSampling.cpp index 585ea0b5a9..9457ffbd00 100644 --- a/src/plugins/NEMD/RegionSampling.cpp +++ b/src/plugins/NEMD/RegionSampling.cpp @@ -29,7 +29,6 @@ #define M_PI 3.14159265358979323846 #endif -using namespace std; // init static ID --> instance counting @@ -108,21 +107,21 @@ void SampleRegion::initComponentSpecificParamsVDF() void SampleRegion::showComponentSpecificParamsVDF() { - global_log->info() << ">>>> ComponentSpecificParamsVDF" << endl; - global_log->info() << "-----------------------------------------------------" << endl; + Log::global_log->info() << ">>>> ComponentSpecificParamsVDF" << std::endl; + Log::global_log->info() << "-----------------------------------------------------" << std::endl; uint32_t cid = 0; for(auto&& csp : _vecComponentSpecificParamsVDF) { - global_log->info() << "bSamplingEnabled = " << csp.bSamplingEnabled << endl; - global_log->info() << "dVeloMax = " << csp.dVeloMax << endl; - global_log->info() << "dVelocityClassWidth = " << csp.dVelocityClassWidth << endl; - global_log->info() << "dInvVelocityClassWidth = " << csp.dInvVelocityClassWidth << endl; - global_log->info() << "numVelocityClasses = " << csp.numVelocityClasses << endl; - global_log->info() << "numVals = " << csp.numVals << endl; - global_log->info() << "nOffsetDataStructure = " << csp.nOffsetDataStructure << endl; - global_log->info() << "-----------------------------------------------------" << endl; + Log::global_log->info() << "bSamplingEnabled = " << csp.bSamplingEnabled << std::endl; + Log::global_log->info() << "dVeloMax = " << csp.dVeloMax << std::endl; + Log::global_log->info() << "dVelocityClassWidth = " << csp.dVelocityClassWidth << std::endl; + Log::global_log->info() << "dInvVelocityClassWidth = " << csp.dInvVelocityClassWidth << std::endl; + Log::global_log->info() << "numVelocityClasses = " << csp.numVelocityClasses << std::endl; + Log::global_log->info() << "numVals = " << csp.numVals << std::endl; + Log::global_log->info() << "nOffsetDataStructure = " << csp.nOffsetDataStructure << std::endl; + Log::global_log->info() << "-----------------------------------------------------" << std::endl; } - global_log->info() << "<<<< ComponentSpecificParamsVDF" << endl; + Log::global_log->info() << "<<<< ComponentSpecificParamsVDF" << std::endl; } void SampleRegion::readXML(XMLfileUnits& xmlconfig) @@ -144,8 +143,8 @@ void SampleRegion::readXML(XMLfileUnits& xmlconfig) for(uint8_t d=0; d<3; ++d) uc[d] = (strVal[d] == "box") ? domain->getGlobalLength(d) : atof(strVal[d].c_str() ); - global_log->info() << "RegionSampling->region["<GetID()<<"]: lower corner: " << lc[0] << ", " << lc[1] << ", " << lc[2] << std::endl; - global_log->info() << "RegionSampling->region["<GetID()<<"]: upper corner: " << uc[0] << ", " << uc[1] << ", " << uc[2] << std::endl; + Log::global_log->info() << "RegionSampling->region["<GetID()<<"]: lower corner: " << lc[0] << ", " << lc[1] << ", " << lc[2] << std::endl; + Log::global_log->info() << "RegionSampling->region["<GetID()<<"]: upper corner: " << uc[0] << ", " << uc[1] << ", " << uc[2] << std::endl; for(uint8_t d=0; d<3; ++d) { _dLowerCorner[d] = lc[d]; @@ -171,7 +170,7 @@ void SampleRegion::readXML(XMLfileUnits& xmlconfig) distControl->registerObserver(this); else { - global_log->error() << "RegionSampling->region["<GetID()<<"]: Initialization of plugin DistControl is needed before! Program exit..." << endl; + Log::global_log->error() << "RegionSampling->region["<GetID()<<"]: Initialization of plugin DistControl is needed before! Program exit..." << std::endl; Simulation::exit(-1); } } @@ -181,9 +180,9 @@ void SampleRegion::readXML(XMLfileUnits& xmlconfig) uint32_t numSamplingModules = 0; XMLfile::Query query = xmlconfig.query("sampling"); numSamplingModules = query.card(); - global_log->info() << "RegionSampling->region["<GetID()-1<<"]: Number of sampling modules: " << numSamplingModules << endl; + Log::global_log->info() << "RegionSampling->region["<GetID()-1<<"]: Number of sampling modules: " << numSamplingModules << std::endl; if(numSamplingModules < 1) { - global_log->error() << "RegionSampling->region["<GetID()-1<<"]: No sampling module parameters specified. Program exit ..." << endl; + Log::global_log->error() << "RegionSampling->region["<GetID()-1<<"]: No sampling module parameters specified. Program exit ..." << std::endl; Simulation::exit(-1); } @@ -202,7 +201,7 @@ void SampleRegion::readXML(XMLfileUnits& xmlconfig) _boolSingleComp = bVal; if(_boolSingleComp) { _numComponents=2; - global_log->info() << "Pretend single component sampling: _numComponents=" << _numComponents << endl; + Log::global_log->info() << "Pretend single component sampling: _numComponents=" << _numComponents << std::endl; } // enable profile sampling _SamplingEnabledProfiles = true; @@ -211,15 +210,15 @@ void SampleRegion::readXML(XMLfileUnits& xmlconfig) xmlconfig.getNodeValue("control/frequency", _writeFrequencyProfiles); xmlconfig.getNodeValue("control/stop", _stopSamplingProfiles); this->setParamProfiles(); - global_log->info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<setSubdivisionProfiles(nNumSlabs); - global_log->info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<setSubdivisionProfiles(dSlabWidth); - global_log->info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region[" << this->GetID()-1 << "]: Single component enabled ( " << _boolSingleComp << " ) " << endl; + Log::global_log->info() << "RegionSampling->region[" << this->GetID()-1 << "]: Single component enabled ( " << _boolSingleComp << " ) " << std::endl; } else { - global_log->info() << "RegionSampling->region[" << this->GetID()-1 << "]: Single component disabled ( " << _boolSingleComp << " ) " << endl; + Log::global_log->info() << "RegionSampling->region[" << this->GetID()-1 << "]: Single component disabled ( " << _boolSingleComp << " ) " << std::endl; } // velocity dicretization { - string oldpath = xmlconfig.getcurrentnodepath(); + std::string oldpath = xmlconfig.getcurrentnodepath(); xmlconfig.changecurrentnode("discretizations"); uint32_t numDiscretizations = 0; XMLfile::Query query_vd = xmlconfig.query("discretization"); numDiscretizations = query_vd.card(); - global_log->info() << "RegionSampling->region["<GetID()-1<<"]: Number of velocity discretizations: " << numDiscretizations << endl; + Log::global_log->info() << "RegionSampling->region["<GetID()-1<<"]: Number of velocity discretizations: " << numDiscretizations << std::endl; if(numDiscretizations < 1) { - global_log->error() << "RegionSampling->region["<GetID()-1<<"]: No velocity discretizations specified for VDF sampling. Program exit ..." << endl; + Log::global_log->error() << "RegionSampling->region["<GetID()-1<<"]: No velocity discretizations specified for VDF sampling. Program exit ..." << std::endl; Simulation::exit(-1); } XMLfile::Query::const_iterator nodeIter; @@ -306,34 +305,34 @@ void SampleRegion::readXML(XMLfileUnits& xmlconfig) uint32_t cid = 0; bool bVal = xmlconfig.getNodeValue("@cid", cid); if( (cid > _numComponents) || ((not bVal) && (not _boolSingleComp)) ){ - global_log->error() << "RegionSampling->region["<GetID()-1<<"]: VDF velocity discretization corrupted. Program exit ..." << endl; + Log::global_log->error() << "RegionSampling->region["<GetID()-1<<"]: VDF velocity discretization corrupted. Program exit ..." << std::endl; Simulation::exit(-1); } if(_boolSingleComp){ cid = 1; - global_log->info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<setSubdivisionVDF(nNumSlabs); - global_log->info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<setSubdivisionVDF(dSlabWidth); - global_log->info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]: Found " << numSubdivisions << " 'subdivision' elements, " - "expected: 2. Program exit ..." << endl; + Log::global_log->error() << "RegionSampling->region["<GetID()-1<<"]: Found " << numSubdivisions << " 'subdivision' elements, " + "expected: 2. Program exit ..." << std::endl; Simulation::exit(-1); } - string oldpath = xmlconfig.getcurrentnodepath(); + std::string oldpath = xmlconfig.getcurrentnodepath(); XMLfile::Query::const_iterator outputSubdivisionIter; for( outputSubdivisionIter = query_sd.begin(); outputSubdivisionIter != query_sd.end(); outputSubdivisionIter++ ) { @@ -442,12 +441,12 @@ void SampleRegion::readXML(XMLfileUnits& xmlconfig) if("number" == strSubdivisionType) { _nSubdivisionOptFieldYR_Y = SDOPT_BY_NUM_SLABS; bInputIsValid = bInputIsValid && xmlconfig.getNodeValue("number", _nNumBinsFieldYR); - global_log->info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]: Wrong attribute 'sampling@type', expected type='profiles|VDF|fieldYR'! Program exit..." << endl; + Log::global_log->error() << "RegionSampling->region["<GetID()-1<<"]: Wrong attribute 'sampling@type', expected type='profiles|VDF|fieldYR'! Program exit..." << std::endl; Simulation::exit(-1); } } // for( outputSamplingIter = query.begin(); outputSamplingIter; outputSamplingIter++ ) @@ -506,7 +505,7 @@ void SampleRegion::prepareSubdivisionProfiles() break; case SDOPT_UNKNOWN: default: - global_log->error() << "tec::ControlRegion::PrepareSubdivisionProfiles(): Unknown subdivision type! Program exit..." << endl; + Log::global_log->error() << "tec::ControlRegion::PrepareSubdivisionProfiles(): Unknown subdivision type! Program exit..." << std::endl; exit(-1); } } @@ -530,7 +529,7 @@ void SampleRegion::prepareSubdivisionVDF() break; case SDOPT_UNKNOWN: default: - global_log->error() << "ERROR in SampleRegion::PrepareSubdivisionVDF(): Unknown subdivision type! Program exit..." << endl; + Log::global_log->error() << "ERROR in SampleRegion::PrepareSubdivisionVDF(): Unknown subdivision type! Program exit..." << std::endl; exit(-1); } } @@ -554,7 +553,7 @@ void SampleRegion::prepareSubdivisionFieldYR() break; case SDOPT_UNKNOWN: default: - global_log->error() << "SampleRegion::PrepareSubdivisionFieldYR(): Unknown subdivision type! Program exit..." << endl; + Log::global_log->error() << "SampleRegion::PrepareSubdivisionFieldYR(): Unknown subdivision type! Program exit..." << std::endl; Simulation::exit(-1); } @@ -573,7 +572,7 @@ void SampleRegion::prepareSubdivisionFieldYR() break; case SDOPT_UNKNOWN: default: - global_log->error() << "SampleRegion::PrepareSubdivisionFieldYR(): Unknown subdivision type! Program exit..." << endl; + Log::global_log->error() << "SampleRegion::PrepareSubdivisionFieldYR(): Unknown subdivision type! Program exit..." << std::endl; Simulation::exit(-1); } } @@ -620,10 +619,10 @@ void SampleRegion::initSamplingProfiles(int nDimension) _nNumValsVector = _nNumValsScalar * 3; // * 3: x, y, z-component #ifndef NDEBUG - cout << "_nNumBinsProfiles = " << _nNumBinsProfiles << endl; - cout << "_numComponents = " << _numComponents << endl; - cout << "_nNumValsScalar = " << _nNumValsScalar << endl; - cout << "_nNumValsVector = " << _nNumValsVector << endl; + std::cout << "_nNumBinsProfiles = " << _nNumBinsProfiles << std::endl; + std::cout << "_numComponents = " << _numComponents << std::endl; + std::cout << "_nNumValsScalar = " << _nNumValsScalar << std::endl; + std::cout << "_nNumValsVector = " << _nNumValsVector << std::endl; #endif // Offsets @@ -825,10 +824,10 @@ void SampleRegion::initSamplingFieldYR(int nDimension) _nNumValsFieldYR = 3ul * _numComponents * _nNumShellsFieldYR * _nNumBinsFieldYR; // *3: number of sections: 0: all, 1: upper, 2: lower section #ifndef NDEBUG - cout << "_numComponents = " << _numComponents << endl; - cout << "_nNumShellsFieldYR = " << _nNumShellsFieldYR << endl; - cout << "_nNumBinsFieldYR = " << _nNumBinsFieldYR << endl; - cout << "_nNumValsFieldYR = " << _nNumValsFieldYR << endl; + std::cout << "_numComponents = " << _numComponents << std::endl; + std::cout << "_nNumShellsFieldYR = " << _nNumShellsFieldYR << std::endl; + std::cout << "_nNumBinsFieldYR = " << _nNumBinsFieldYR << std::endl; + std::cout << "_nNumValsFieldYR = " << _nNumValsFieldYR << std::endl; #endif // Offsets @@ -965,7 +964,7 @@ void SampleRegion::sampleProfiles(Molecule* molecule, int nDimension, unsigned l { if(not _SamplingEnabledProfiles) return; - + if( (simstep <= _initSamplingProfiles) or (simstep > _stopSamplingProfiles) ) return; @@ -1619,8 +1618,8 @@ void SampleRegion::writeDataProfiles(DomainDecompBase* domainDecomp, unsigned lo outputstream_vect << " py[" << cid << "]"; outputstream_vect << " pz[" << cid << "]"; } - outputstream_scal << endl; - outputstream_vect << endl; + outputstream_scal << std::endl; + outputstream_vect << std::endl; // data for(uint32_t s=0; s<_nNumBinsProfiles; ++s) @@ -1698,17 +1697,17 @@ void SampleRegion::writeDataProfiles(DomainDecompBase* domainDecomp, unsigned lo outputstream_vect << std::setw(24) << std::scientific << std::setprecision(std::numeric_limits::digits10) << PressureY; outputstream_vect << std::setw(24) << std::scientific << std::setprecision(std::numeric_limits::digits10) << PressureZ; } // loop: cid - outputstream_scal << endl; - outputstream_vect << endl; + outputstream_scal << std::endl; + outputstream_vect << std::endl; } // loop: pos // open file for writing // scalar - ofstream fileout_scal(filenamestream_scal[dir].str().c_str(), ios::out); + std::ofstream fileout_scal(filenamestream_scal[dir].str().c_str(), std::ios::out); fileout_scal << outputstream_scal.str(); fileout_scal.close(); // vector - ofstream fileout_vect(filenamestream_vect[dir].str().c_str(), ios::out); + std::ofstream fileout_vect(filenamestream_vect[dir].str().c_str(), std::ios::out); fileout_vect << outputstream_vect.str(); fileout_vect.close(); } // loop: dir @@ -1788,11 +1787,11 @@ void SampleRegion::writeDataVDF(DomainDecompBase* domainDecomp, unsigned long si sstrFilename[fi] << _fnamePrefixVDF << "_reg" << this->GetID() << "_cid" << cid << strSubPrefixes.at(fi) << "_TS" << fill_width('0', 9) << simstep << ".dat"; // write to string streams - sstrOutput[numFiles-1] << " classes_cid" << cid << endl; + sstrOutput[numFiles-1] << " classes_cid" << cid << std::endl; for(auto&& dvv : csp.dDiscreteVelocityValues) { sstrOutput[numFiles-1] << std::setw(24) << std::scientific << std::setprecision(std::numeric_limits::digits10) << dvv; - sstrOutput[numFiles-1] << endl; + sstrOutput[numFiles-1] << std::endl; } // loop over vdf data structures @@ -1815,7 +1814,7 @@ void SampleRegion::writeDataVDF(DomainDecompBase* domainDecomp, unsigned long si // write to file streams for(uint8_t fi=0; fiGetID() << "_bin_coords" << "_TS" << fill_width('0', 9) << simstep << ".dat"; // write to string stream - sstrOutput << " coords" << endl; + sstrOutput << " coords" << std::endl; for(auto&& bmp : _dBinMidpointsVDF) { sstrOutput << std::setw(24) << std::scientific << std::setprecision(std::numeric_limits::digits10) << bmp; - sstrOutput << endl; + sstrOutput << std::endl; } // write to file stream - ofstream ofs(sstrFilename.str().c_str(), ios::out); + std::ofstream ofs(sstrFilename.str().c_str(), std::ios::out); ofs << sstrOutput.str(); ofs.close(); } @@ -1887,9 +1886,9 @@ void SampleRegion::writeDataFieldYR(DomainDecompBase* domainDecomp, unsigned lon mardyn_assert( (nOffset+bi) < _nNumValsFieldYR ); outputstream << FORMAT_SCI_MAX_DIGITS << _dDensityFieldYR[nOffset+bi]; } - outputstream << endl; + outputstream << std::endl; } - ofstream fileout(filenamestream.str().c_str(), std::ios::out); + std::ofstream fileout(filenamestream.str().c_str(), std::ios::out); fileout << outputstream.str(); fileout.close(); } @@ -1907,7 +1906,7 @@ void SampleRegion::writeDataFieldYR(DomainDecompBase* domainDecomp, unsigned lon outputstream.write(reinterpret_cast(&dVal), 8); } } - ofstream fileout(filenamestream.str().c_str(), std::ios::out | std::ios::binary); + std::ofstream fileout(filenamestream.str().c_str(), std::ios::out | std::ios::binary); fileout << outputstream.str(); fileout.close(); } @@ -2045,12 +2044,12 @@ void RegionSampling::readXML(XMLfileUnits& xmlconfig) uint32_t nRegID = 0; XMLfile::Query query = xmlconfig.query("region"); numRegions = query.card(); - global_log->info() << "RegionSampling: Number of sampling regions: " << numRegions << endl; + Log::global_log->info() << "RegionSampling: Number of sampling regions: " << numRegions << std::endl; if(numRegions < 1) { - global_log->warning() << "RegionSampling: No region parameters specified. Program exit ..." << endl; + Log::global_log->warning() << "RegionSampling: No region parameters specified. Program exit ..." << std::endl; Simulation::exit(-1); } - string oldpath = xmlconfig.getcurrentnodepath(); + std::string oldpath = xmlconfig.getcurrentnodepath(); XMLfile::Query::const_iterator outputRegionIter; for( outputRegionIter = query.begin(); outputRegionIter; outputRegionIter++ ) { diff --git a/src/plugins/NEMD/RegionSampling.h b/src/plugins/NEMD/RegionSampling.h index c70d245ef7..8916f46974 100644 --- a/src/plugins/NEMD/RegionSampling.h +++ b/src/plugins/NEMD/RegionSampling.h @@ -312,7 +312,7 @@ class SampleRegion : public CuboidRegionObs // output file std::string _strFilePrefixFieldYR; uint8_t _nFileTypeFieldYR; - + bool _boolSingleComp; }; @@ -426,7 +426,7 @@ class RegionSampling : public ControlInstance, public PluginBase private: std::vector _vecSampleRegions; - + unsigned long _initSamplingProfiles; unsigned long _writeFrequencyProfiles; unsigned long _initSamplingVDF; diff --git a/src/plugins/NEMD/VelocityExchange.cpp b/src/plugins/NEMD/VelocityExchange.cpp index dfaa05895a..2926936e9f 100644 --- a/src/plugins/NEMD/VelocityExchange.cpp +++ b/src/plugins/NEMD/VelocityExchange.cpp @@ -30,14 +30,14 @@ void VelocityExchange::readXML(XMLfileUnits& xmlconfig) { xmlconfig.getNodeValue("control/start", _control.start); xmlconfig.getNodeValue("control/frequency", _control.freq); xmlconfig.getNodeValue("control/stop", _control.stop); - global_log->info() << "[VelocityExchange] takes place start:freq:stop = " << _control.start << ":" << _control.freq << ":" << _control.stop << std::endl; + Log::global_log->info() << "[VelocityExchange] takes place start:freq:stop = " << _control.start << ":" << _control.freq << ":" << _control.stop << std::endl; // Needed here as readXML() is run before init() Domain* domain = global_simulation->getDomain(); for (unsigned short d = 0; d < 3; d++) { _boxLength[d] = domain->getGlobalLength(d); } - + // set default in x and z direction to box size // default case is symmetric with region sizes arbitrarily set to 5.0 // cold region in middle of simulation box @@ -74,21 +74,21 @@ void VelocityExchange::readXML(XMLfileUnits& xmlconfig) { _warm_region.max[1] = (strVal[4] == "box") ? _boxLength[1] : atof(strVal[4].c_str()); _warm_region.max[2] = (strVal[5] == "box") ? _boxLength[2] : atof(strVal[5].c_str()); - global_log->info() << "[VelocityExchange] Cold region:" + Log::global_log->info() << "[VelocityExchange] Cold region:" << " x = " << _cold_region.min[0] << " - " << _cold_region.max[0] << " ;" << " y = " << _cold_region.min[1] << " - " << _cold_region.max[1] << " ;" - << " z = " << _cold_region.min[2] << " - " << _cold_region.max[2] << endl; + << " z = " << _cold_region.min[2] << " - " << _cold_region.max[2] << std::endl; - global_log->info() << "[VelocityExchange] Warm region" << ((_symmetry) ? " (left)" : "") << ":" + Log::global_log->info() << "[VelocityExchange] Warm region" << ((_symmetry) ? " (left)" : "") << ":" << " x = " << _warm_region.min[0] << " - " << _warm_region.max[0] << " ;" << " y = " << _warm_region.min[1] << " - " << _warm_region.max[1] << " ;" - << " z = " << _warm_region.min[2] << " - " << _warm_region.max[2] << endl; + << " z = " << _warm_region.min[2] << " - " << _warm_region.max[2] << std::endl; if (_symmetry) { - global_log->info() << "[VelocityExchange] Warm region (right):" + Log::global_log->info() << "[VelocityExchange] Warm region (right):" << " x = " << _warm_region.min[0] << " - " << _warm_region.max[0] << " ;" << " y = " << _boxLength[1]-_warm_region.max[1] << " - " << _boxLength[1]-_warm_region.min[1] << " ;" - << " z = " << _warm_region.min[2] << " - " << _warm_region.max[2] << endl; + << " z = " << _warm_region.min[2] << " - " << _warm_region.max[2] << std::endl; } } @@ -271,7 +271,7 @@ void VelocityExchange::exchangeVelocities(ParticleContainer* particleContainer, } for (uint32_t cid = 0; cid < _numComp; cid++) { - global_log->info() << " [VelocityExchange] flipped velocities of molecules " + Log::global_log->info() << " [VelocityExchange] flipped velocities of molecules " << molID_coldP.global[cid] << " (in warm region, v_new = " << velocity_abs_warmP.global[cid] << ") and " << molID_warmP.global[cid] << " (in cold region v_new = " << velocity_abs_coldP.global[cid] << ") of component " << cid+1 << std::endl; } diff --git a/src/plugins/Permittivity.cpp b/src/plugins/Permittivity.cpp index a91be5df67..3d2098ffc7 100644 --- a/src/plugins/Permittivity.cpp +++ b/src/plugins/Permittivity.cpp @@ -4,13 +4,13 @@ * Created on: November 2019 * Author: Joshua Marx */ - + // DESCRIPTION: Samples the relative permittivity of Stockmayer fluids in the NVT ensemble // Important: Always plot the running average data to make sure convergence has been achieved. Permittivity may take a long time to converge, i.e. a few million steps with ~1000 particles. Reducing number of slabs for the thermostat can drastically improve results/convergence! // If a simulation is resumed from a restart file, then the existing running average file is ammended but the computation of the running averages starts anew at the time step of the restart file #include "Permittivity.h" void Permittivity::readXML(XMLfileUnits& xmlconfig) { - global_log->info() << "Calculation of relative permittivity enabled." << std::endl; + Log::global_log->info() << "Calculation of relative permittivity enabled." << std::endl; xmlconfig.getNodeValue("writefrequency", _writeFrequency); xmlconfig.getNodeValue("initstatistics", _initStatistics); xmlconfig.getNodeValue("recordingtimesteps", _recordingTimesteps); @@ -20,8 +20,8 @@ void Permittivity::readXML(XMLfileUnits& xmlconfig) { void Permittivity::init(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, Domain* domain) { _totalNumTimeSteps = _simulation.getNumTimesteps(); - global_log->warning() << "Permittivity is being sampled. Using slab thermostat is not recommended" << endl; - global_log->info() << "Number of blocks for calculation of permittivity: "<<_numOutputs << endl; + Log::global_log->warning() << "Permittivity is being sampled. Using slab thermostat is not recommended" << std::endl; + Log::global_log->info() << "Number of blocks for calculation of permittivity: "<<_numOutputs << std::endl; _readStartingStep = false; _currentOutputNum = 0; _accumulatedSteps = 1; @@ -30,14 +30,14 @@ void Permittivity::init(ParticleContainer* particleContainer, DomainDecompBase* _MSquaredRAV = 0.; _RAVCounter = 0; - string permName = _outputPrefix + ".permRAV"; + std::string permName = _outputPrefix + ".permRAV"; int mpi_rank = domainDecomp->getRank(); if (mpi_rank == 0) { _ravStream.open(permName.c_str(), std::ios::app); _ravStream.precision(7); } - _V = domain->getGlobalLength(0) * domain->getGlobalLength(1) * domain->getGlobalLength(2); - _T = domain->getTargetTemperature(0); + _V = domain->getGlobalLength(0) * domain->getGlobalLength(1) * domain->getGlobalLength(2); + _T = domain->getTargetTemperature(0); for (unsigned long i = 0; i<_writeFrequency;i++){ for (unsigned int j = 0; j<3; j++){ @@ -71,39 +71,39 @@ void Permittivity::init(ParticleContainer* particleContainer, DomainDecompBase* bool orientationIsCorrect = ci.dipole(0).e() == std::array{0,0,1}; _myAbs[i] = ci.dipole(0).abs(); if(not orientationIsCorrect){ - global_log->error() << "Wrong dipole vector chosen! Please always choose [eMyx eMyy eMyz] = [0 0 1] when using the permittivity plugin" << endl; + Log::global_log->error() << "Wrong dipole vector chosen! Please always choose [eMyx eMyy eMyz] = [0 0 1] when using the permittivity plugin" << std::endl; } } } } void Permittivity::record(ParticleContainer* particleContainer) { - + double Quaternion[4]; double orientationVector[3]; - + for(ParticleIterator tempMol = particleContainer->iterator(ParticleIterator::ONLY_INNER_AND_BOUNDARY); tempMol.isValid(); ++tempMol){ - + Quaternion[0] = tempMol->q().qw(); Quaternion[1] = tempMol->q().qx(); Quaternion[2] = tempMol->q().qy(); Quaternion[3] = tempMol->q().qz(); - + // Calculates dipole moment vector from quaternions orientationVector[0] = 2 * (Quaternion[1] * Quaternion[3] + Quaternion[0] * Quaternion[2]); orientationVector[1] = 2 * (Quaternion[2] * Quaternion[3] - Quaternion[0] * Quaternion[1]); orientationVector[2] = 1 - 2 * (Quaternion[1] * Quaternion[1] + Quaternion[2] * Quaternion[2]); - - _numParticlesLocal++; + + _numParticlesLocal++; for (unsigned int i = 0; i < 3; i++) { // Calculates M as sum of all molecular dipole moment vectors for current time step - _localM[_accumulatedSteps][i] += orientationVector[i] * _myAbs[tempMol->getComponentLookUpID()]; + _localM[_accumulatedSteps][i] += orientationVector[i] * _myAbs[tempMol->getComponentLookUpID()]; } - } + } } void Permittivity::writeRunningAverage(unsigned long indexM, double tempMX, double tempMY, double tempMZ, double tempMSquared) { // writes instantaneous values, temporary averages and running averages of Mx, My, Mz, and epsilon - double timestep; + double timestep; if (_startingStep <= 1) { timestep = _initStatistics + _RAVCounter * _runningAverageSteps; } @@ -114,18 +114,18 @@ void Permittivity::writeRunningAverage(unsigned long indexM, double tempMX, doub unsigned long RAVsteps = _RAVCounter * _runningAverageSteps; double Msquared = _MSquaredRAV / (double)RAVsteps; double MsquaredInst = 0.; - + for (unsigned int i = 0; i < 3; i++) { M[i] = _MRAV[i] / (double)RAVsteps; MsquaredInst += _globalM[indexM][i] * _globalM[indexM][i]; } - + double perm = 1. + 4. * M_PI * Msquared / (3. * _T * _V); double permInst = 1. + 4. * M_PI * MsquaredInst / (3. * _T * _V); double permTemp = 1. + 4. * M_PI * tempMSquared / (_runningAverageSteps * 3. * _T * _V); - - _ravStream << timestep << "\t" << RAVsteps << "\t" << _globalM[indexM][0] << "\t" << _globalM[indexM][1] << "\t" << _globalM[indexM][2] << "\t" << MsquaredInst << "\t" << permInst << "\t" << tempMX / (double)(_runningAverageSteps) << "\t" << tempMY / (double)(_runningAverageSteps) << "\t" << tempMZ / (double)(_runningAverageSteps) << "\t" - << tempMSquared / (double)(_runningAverageSteps) << "\t" << permTemp << "\t" << M[0] << "\t" << M[1] << "\t" << M[2] << "\t" << Msquared << "\t" << perm << endl; + + _ravStream << timestep << "\t" << RAVsteps << "\t" << _globalM[indexM][0] << "\t" << _globalM[indexM][1] << "\t" << _globalM[indexM][2] << "\t" << MsquaredInst << "\t" << permInst << "\t" << tempMX / (double)(_runningAverageSteps) << "\t" << tempMY / (double)(_runningAverageSteps) << "\t" << tempMZ / (double)(_runningAverageSteps) << "\t" + << tempMSquared / (double)(_runningAverageSteps) << "\t" << permTemp << "\t" << M[0] << "\t" << M[1] << "\t" << M[2] << "\t" << Msquared << "\t" << perm << std::endl; } void Permittivity::collect(DomainDecompBase* domainDecomp) { @@ -143,7 +143,7 @@ void Permittivity::collect(DomainDecompBase* domainDecomp) { _globalM[j][i] = domainDecomp->collCommGetDouble(); } } - + domainDecomp->collCommFinalize(); double tempM[3]; @@ -151,44 +151,44 @@ void Permittivity::collect(DomainDecompBase* domainDecomp) { for (unsigned int i=1; i < 3; i++) { tempM[i] = 0.; } - + // Calculates ensemble averages and for current block for (unsigned long i = 1; i < _accumulatedSteps; i++) { - + tempMSquared += _globalM[i][0] * _globalM[i][0] + _globalM[i][1] * _globalM[i][1] + _globalM[i][2] * _globalM[i][2]; _MSquaredRAV += _globalM[i][0] * _globalM[i][0] + _globalM[i][1] * _globalM[i][1] + _globalM[i][2] * _globalM[i][2]; _outputSquaredM[_currentOutputNum] += _globalM[i][0] * _globalM[i][0] + _globalM[i][1] * _globalM[i][1] + _globalM[i][2] * _globalM[i][2]; - + for (unsigned int j = 0; j < 3; j++) { - - _outputM[_currentOutputNum][j] += _globalM[i][j]; + + _outputM[_currentOutputNum][j] += _globalM[i][j]; _MRAV[j] += _globalM[i][j]; tempM[j] += _globalM[i][j]; } - + if (i % _runningAverageSteps == 0 && i > 0) { - + _RAVCounter++; - writeRunningAverage(i, tempM[0], tempM[1], tempM[2], tempMSquared); + writeRunningAverage(i, tempM[0], tempM[1], tempM[2], tempMSquared); tempMSquared = 0.; - + for (unsigned int j=0; j < 3; j++) { - - tempM[j] = 0.; + + tempM[j] = 0.; } } } - + for (unsigned int i = 0; i < 3; i++) { _outputM[_currentOutputNum][i] /= ((double)_accumulatedSteps-1); } - + _outputSquaredM[_currentOutputNum] /= ((double)_accumulatedSteps-1); domainDecomp->collCommInit(1); domainDecomp->collCommAppendUnsLong(_numParticlesLocal); domainDecomp->collCommAllreduceSum(); _numParticles[_currentOutputNum] = domainDecomp->collCommGetUnsLong(); - domainDecomp->collCommFinalize(); + domainDecomp->collCommFinalize(); _currentOutputNum++; } @@ -204,17 +204,17 @@ void Permittivity::reset() { } void Permittivity::endStep(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, Domain* domain, unsigned long simstep) { - + if (_readStartingStep == false) { // this if-statement is used to differentiate between a simulation that is newly started and one that is resumed from a restart file. For restarted simulations, the running average file from _startingStep = simstep; // the original simulation is then simply continued if (_startingStep <= 1) { _numOutputs = (unsigned int)ceil(((double)_totalNumTimeSteps - (double)_initStatistics)/ (double)_writeFrequency); - _ravStream << "//Output generated by Permittivity plugin\n" << endl; - _ravStream << "time steps\trecording steps\tMx_inst\tMy_inst\tMz_inst\tMsquared_inst\tperm_inst\tMx_temp\tMy_temp\tMz_temp\tMsquared_temp\tperm_temp\tMx_rav\tMy_rav\tMz_rav\tMsquared_rav\tperm_rav\t" << endl; + _ravStream << "//Output generated by Permittivity plugin\n" << std::endl; + _ravStream << "time steps\trecording steps\tMx_inst\tMy_inst\tMz_inst\tMsquared_inst\tperm_inst\tMx_temp\tMy_temp\tMz_temp\tMsquared_temp\tperm_temp\tMx_rav\tMy_rav\tMz_rav\tMsquared_rav\tperm_rav\t" << std::endl; } else { _numOutputs = (unsigned int)ceil(((double)_totalNumTimeSteps - (double)_startingStep)/ (double)_writeFrequency); - } + } _readStartingStep = true; return; } @@ -223,12 +223,12 @@ void Permittivity::endStep(ParticleContainer* particleContainer, DomainDecompBas record(particleContainer); _accumulatedSteps++; } - + if (simstep > _initStatistics && simstep % _writeFrequency == 0) { collect(domainDecomp); reset(); } - + int mpi_rank = domainDecomp->getRank(); if (simstep == _totalNumTimeSteps) { if (mpi_rank == 0){ @@ -237,10 +237,10 @@ void Permittivity::endStep(ParticleContainer* particleContainer, DomainDecompBas } } -void Permittivity::output(Domain* domain, unsigned long timestep) { +void Permittivity::output(Domain* domain, unsigned long timestep) { double writeInit; - double averagePermittivity = 0.; - double averagePermittivity2 = 0.; + double averagePermittivity = 0.; + double averagePermittivity2 = 0.; double blockPermittivity = 0.; double blockPermittivity2 = 0.; double correctionFirstBlock; @@ -260,57 +260,57 @@ void Permittivity::output(Domain* domain, unsigned long timestep) { else { writeInit = floor((double)_initStatistics / (double)_writeFrequency); } - string prefix; - ostringstream osstrm; + std::string prefix; + std::ostringstream osstrm; osstrm << _outputPrefix; - osstrm << right << _startingStep; + osstrm << std::right << _startingStep; prefix = osstrm.str(); osstrm.str(""); osstrm.clear(); - string permName = prefix + ".perm"; - ofstream writer(permName.c_str()); + std::string permName = prefix + ".perm"; + std::ofstream writer(permName.c_str()); writer.precision(7); - + writer << "//Output generated by Permittivity plugin\n" << "//Two values for the permittivity are calculated: a block average epsilon_avg and an average for the whole simulation epsilon_total\n" << "//For epsilon2, the ensemble average 2, which is supposed to converge to zero, is omitted in the calculation\n" << "timestep\tN_particles\tMx\tMy\tMz\tsquared\t\tepsilon\tepsilon2\n"; - + for (unsigned int i = 0; i < _numOutputs; i++) { double squaredM = _outputM[i][0] * _outputM[i][0] + _outputM[i][1] * _outputM[i][1] + _outputM[i][2] * _outputM[i][2]; // Calculate ² from for each block - blockPermittivity = 1. + 4. * M_PI /(3. * _T * _V) * (_outputSquaredM[i] - squaredM); // Calculates relative permittivity for each block + blockPermittivity = 1. + 4. * M_PI /(3. * _T * _V) * (_outputSquaredM[i] - squaredM); // Calculates relative permittivity for each block blockPermittivity2 = 1. + 4. * M_PI /(3. * _T * _V) * (_outputSquaredM[i]); if ( i == 0) { - averagePermittivity += blockPermittivity * (1. - correctionFirstBlock); // Sums up permittivities for total block average + averagePermittivity += blockPermittivity * (1. - correctionFirstBlock); // Sums up permittivities for total block average averagePermittivity2 += blockPermittivity2 * (1. - correctionFirstBlock); } else { - averagePermittivity += blockPermittivity; // Sums up permittivities for total block average + averagePermittivity += blockPermittivity; // Sums up permittivities for total block average averagePermittivity2 += blockPermittivity2; } numSteps = (i + 1 + writeInit) * _writeFrequency + _startingStep; writer << numSteps << "\t" << _numParticles[i] << "\t" << _outputM[i][0] << "\t" << _outputM[i][1] << "\t" << _outputM[i][2] << "\t" << squaredM <<"\t" << _outputSquaredM[i] << "\t" << blockPermittivity << "\t" << blockPermittivity2 << "\n"; - + if (i == 0) { // Sums up block values for and to calculate total simulation averages _totalAverageSquaredM += _outputSquaredM[i] * (1. - correctionFirstBlock); - for (unsigned int j = 0; j < 3; j++){ - _totalAverageM[j] += _outputM[i][j] * (1. - correctionFirstBlock); + for (unsigned int j = 0; j < 3; j++){ + _totalAverageM[j] += _outputM[i][j] * (1. - correctionFirstBlock); } } else { _totalAverageSquaredM += _outputSquaredM[i]; - for (unsigned int j = 0; j < 3; j++){ - _totalAverageM[j] += _outputM[i][j]; + for (unsigned int j = 0; j < 3; j++){ + _totalAverageM[j] += _outputM[i][j]; } } } // Permittivity as total simulation average (i.e. NOT block average) double permittivityTotal = 1. + 4. * M_PI /(3. * _T * _V) * (_totalAverageSquaredM / ((double)_numOutputs - correctionFirstBlock)- (_totalAverageM[0] * _totalAverageM[0] + _totalAverageM[1] * _totalAverageM[1] + _totalAverageM[2] * _totalAverageM[2]) / (((double)_numOutputs - correctionFirstBlock) * ((double)_numOutputs - correctionFirstBlock))); double permittivityTotal2 = 1. + 4. * M_PI /(3. * _T * _V) * (_totalAverageSquaredM / ((double)_numOutputs - correctionFirstBlock)); - writer << "\n\n epsilon_total = " << permittivityTotal <<"\tepsilon_total2 = " << permittivityTotal2<<"\t epsilon_avg = "<< averagePermittivity / ((double)_numOutputs - correctionFirstBlock) <<"\tepsilon_avg2 = " << averagePermittivity2 / ((double)_numOutputs - correctionFirstBlock)<<"\tT = " << _T << "\tV = " << _V << "\t = " << _totalAverageSquaredM / ((double)_numOutputs - correctionFirstBlock) <<"\t2 = " << (_totalAverageM[0] * _totalAverageM[0] + _totalAverageM[1] * _totalAverageM[1] + _totalAverageM[2] * _totalAverageM[2]) / (((double)_numOutputs - correctionFirstBlock) * ((double)_numOutputs - correctionFirstBlock)) << endl; + writer << "\n\n epsilon_total = " << permittivityTotal <<"\tepsilon_total2 = " << permittivityTotal2<<"\t epsilon_avg = "<< averagePermittivity / ((double)_numOutputs - correctionFirstBlock) <<"\tepsilon_avg2 = " << averagePermittivity2 / ((double)_numOutputs - correctionFirstBlock)<<"\tT = " << _T << "\tV = " << _V << "\t = " << _totalAverageSquaredM / ((double)_numOutputs - correctionFirstBlock) <<"\t2 = " << (_totalAverageM[0] * _totalAverageM[0] + _totalAverageM[1] * _totalAverageM[1] + _totalAverageM[2] * _totalAverageM[2]) / (((double)_numOutputs - correctionFirstBlock) * ((double)_numOutputs - correctionFirstBlock)) << std::endl; writer.close(); _ravStream.close(); } - + diff --git a/src/plugins/Permittivity.h b/src/plugins/Permittivity.h index db41f78516..31e367e1ed 100644 --- a/src/plugins/Permittivity.h +++ b/src/plugins/Permittivity.h @@ -4,10 +4,10 @@ * Created on: November 2019 * Author: Joshua Marx */ - + // DESCRIPTION: Samples the relative permittivity of Stockmayer fluids in the NVT ensemble // Important: Permittivity may take a long time to converge, i.e. a few million steps with ~1000 particles. Reducing number of slabs for the thermostat can drastically improve results! - + #ifndef SRC_PLUGINS_PERMITTIVITY_H_ #define SRC_PLUGINS_PERMITTIVITY_H_ @@ -31,9 +31,9 @@ class Permittivity: public PluginBase { void finish(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, Domain* domain) override{}; std::string getPluginName() override { return std::string("Permittivity"); } static PluginBase* createInstance() { return new Permittivity();} - - - + + + private: bool _readStartingStep; // Auxiliary bool variable to read the current time step during the first iteration of endStep unsigned long _writeFrequency; // Write frequency for all profiles -> Length of recording frame before output diff --git a/src/plugins/PluginFactory.cpp b/src/plugins/PluginFactory.cpp index 72ef336ca7..8781b56cfa 100644 --- a/src/plugins/PluginFactory.cpp +++ b/src/plugins/PluginFactory.cpp @@ -83,7 +83,7 @@ */ template <> void PluginFactory::registerDefaultPlugins() { - global_log->debug() << "REGISTERING PLUGINS" << endl; + Log::global_log->debug() << "REGISTERING PLUGINS" << std::endl; #ifdef ENABLE_ADIOS2 REGISTER_PLUGIN(Adios2Writer); @@ -152,32 +152,32 @@ void PluginFactory::registerDefaultPlugins() { template <> long PluginFactory::enablePlugins(std::list& _plugins, XMLfileUnits& xmlconfig, std::string category, Domain* _domain) { - string oldpath = xmlconfig.getcurrentnodepath(); + std::string oldpath = xmlconfig.getcurrentnodepath(); // plugins long numPlugins = 0; XMLfile::Query query = xmlconfig.query(category); numPlugins = query.card(); - global_log->info() << "Number of plugins with tag " << category << ": " << numPlugins << endl; + Log::global_log->info() << "Number of plugins with tag " << category << ": " << numPlugins << std::endl; if (numPlugins < 1) { - global_log->warning() << "No plugins specified for tag " << category << "." << endl; + Log::global_log->warning() << "No plugins specified for tag " << category << "." << std::endl; } for (auto pluginIter = query.begin(); pluginIter; ++pluginIter) { xmlconfig.changecurrentnode(pluginIter); - string pluginname(""); + std::string pluginname(""); xmlconfig.getNodeValue("@name", pluginname); bool enabled = true; xmlconfig.getNodeValue("@enabled", enabled); if (not enabled) { - global_log->debug() << "skipping disabled plugin: " << pluginname << endl; + Log::global_log->debug() << "skipping disabled plugin: " << pluginname << std::endl; continue; } - global_log->info() << "Enabling plugin: " << pluginname << endl; + Log::global_log->info() << "Enabling plugin: " << pluginname << std::endl; PluginBase* plugin = this->create(pluginname); if (plugin == nullptr) { - global_log->warning() << "Could not create plugin using factory: " << pluginname << endl; + Log::global_log->warning() << "Could not create plugin using factory: " << pluginname << std::endl; } //@TODO: add plugin specific functions @@ -192,8 +192,8 @@ long PluginFactory::enablePlugins(std::list& _plugins, } else if ("multi" == sphere_representation) { plugin = new MmpldWriterMultiSphere(); } else { - global_log->error() << "[MMPLD Writer] Unknown sphere representation type: " << sphere_representation - << endl; + Log::global_log->error() << "[MMPLD Writer] Unknown sphere representation type: " << sphere_representation + << std::endl; Simulation::exit(-1); } } else if (pluginname == "DomainProfiles") { @@ -206,7 +206,7 @@ long PluginFactory::enablePlugins(std::list& _plugins, plugin->readXML(xmlconfig); _plugins.push_back(plugin); } else { - global_log->warning() << "Unknown plugin " << pluginname << endl; + Log::global_log->warning() << "Unknown plugin " << pluginname << std::endl; } } diff --git a/src/plugins/SpatialProfile.cpp b/src/plugins/SpatialProfile.cpp index 6d42f74640..5f4d8a9315 100644 --- a/src/plugins/SpatialProfile.cpp +++ b/src/plugins/SpatialProfile.cpp @@ -20,16 +20,16 @@ */ void SpatialProfile::readXML(XMLfileUnits& xmlconfig) { - global_log->debug() << "[SpatialProfile] enabled" << std::endl; + Log::global_log->debug() << "[SpatialProfile] enabled" << std::endl; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "[SpatialProfile] Write frequency: " << _writeFrequency << endl; + Log::global_log->info() << "[SpatialProfile] Write frequency: " << _writeFrequency << std::endl; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "[SpatialProfile] Output prefix: " << _outputPrefix << endl; + Log::global_log->info() << "[SpatialProfile] Output prefix: " << _outputPrefix << std::endl; xmlconfig.getNodeValue("mode", _mode); - global_log->info() << "[SpatialProfile] Mode " << _mode << endl; + Log::global_log->info() << "[SpatialProfile] Mode " << _mode << std::endl; xmlconfig.getNodeValue("profiledComponent", _profiledCompString); - global_log->info() << "[SpatialProfile] Profiled Component:" << _profiledCompString << endl; - + Log::global_log->info() << "[SpatialProfile] Profiled Component:" << _profiledCompString << std::endl; + if (_profiledCompString != "all") { _profiledComp = std::stoi(_profiledCompString); } @@ -45,48 +45,48 @@ void SpatialProfile::readXML(XMLfileUnits& xmlconfig) { xmlconfig.getNodeValue("z", samplInfo.universalProfileUnit[2]); samplInfo.cylinder = false; } else { - global_log->error() << "[SpatialProfile] Invalid mode. cylinder/cartesian" << endl; + Log::global_log->error() << "[SpatialProfile] Invalid mode. cylinder/cartesian" << std::endl; Simulation::exit(-1); } - global_log->info() << "[SpatialProfile] Binning units: " << samplInfo.universalProfileUnit[0] << " " + Log::global_log->info() << "[SpatialProfile] Binning units: " << samplInfo.universalProfileUnit[0] << " " << samplInfo.universalProfileUnit[1] << " " << samplInfo.universalProfileUnit[2] << "\n"; // CHECKING FOR ENABLED PROFILES int numProfiles = 0; xmlconfig.getNodeValue("profiles/density", _DENSITY); if (_DENSITY) { - global_log->info() << "[SpatialProfile] DENSITY PROFILE ENABLED\n"; + Log::global_log->info() << "[SpatialProfile] DENSITY PROFILE ENABLED\n"; numProfiles++; } xmlconfig.getNodeValue("profiles/velocity", _VELOCITY); if (_VELOCITY) { - global_log->info() << "[SpatialProfile] VELOCITY PROFILE ENABLED\n"; + Log::global_log->info() << "[SpatialProfile] VELOCITY PROFILE ENABLED\n"; numProfiles++; } xmlconfig.getNodeValue("profiles/velocity3d", _VELOCITY3D); if (_VELOCITY) { - global_log->info() << "[SpatialProfile] VELOCITY3D PROFILE ENABLED\n"; + Log::global_log->info() << "[SpatialProfile] VELOCITY3D PROFILE ENABLED\n"; numProfiles++; } xmlconfig.getNodeValue("profiles/temperature", _TEMPERATURE); if (_TEMPERATURE) { - global_log->info() << "[SpatialProfile] TEMPERATURE PROFILE ENABLED\n"; + Log::global_log->info() << "[SpatialProfile] TEMPERATURE PROFILE ENABLED\n"; numProfiles++; } xmlconfig.getNodeValue("profiles/virial", _VIRIAL); if (_VIRIAL) { - global_log->info() << "[SpatialProfile] VIRIAL PROFILE ENABLED\n"; + Log::global_log->info() << "[SpatialProfile] VIRIAL PROFILE ENABLED\n"; numProfiles++; } xmlconfig.getNodeValue("profiles/virial2D", _VIRIAL2D); if (_VIRIAL2D) { - global_log->info() << "[SpatialProfile] 2D VIRIAL PROFILE ENABLED\n"; + Log::global_log->info() << "[SpatialProfile] 2D VIRIAL PROFILE ENABLED\n"; numProfiles++; } - global_log->info() << "[SpatialProfile] Number of profiles: " << numProfiles << "\n"; + Log::global_log->info() << "[SpatialProfile] Number of profiles: " << numProfiles << "\n"; if (numProfiles < 1) { - global_log->warning() << "[SpatialProfile] NO PROFILES SPECIFIED -> Outputting all\n"; + Log::global_log->warning() << "[SpatialProfile] NO PROFILES SPECIFIED -> Outputting all\n"; _ALL = true; } @@ -127,9 +127,9 @@ void SpatialProfile::readXML(XMLfileUnits& xmlconfig) { } xmlconfig.getNodeValue("timesteps/init", _initStatistics); - global_log->info() << "[SpatialProfile] init statistics: " << _initStatistics << endl; + Log::global_log->info() << "[SpatialProfile] init statistics: " << _initStatistics << std::endl; xmlconfig.getNodeValue("timesteps/recording", _profileRecordingTimesteps); - global_log->info() << "[SpatialProfile] profile recording timesteps: " << _profileRecordingTimesteps << endl; + Log::global_log->info() << "[SpatialProfile] profile recording timesteps: " << _profileRecordingTimesteps << std::endl; } @@ -147,7 +147,7 @@ void SpatialProfile::init(ParticleContainer* particleContainer, DomainDecompBase // Get Global length for (unsigned d = 0; d < 3; d++) { samplInfo.globalLength[d] = domain->getGlobalLength(d); - global_log->info() << "[SpatialProfile] globalLength " << samplInfo.globalLength[d] << "\n"; + Log::global_log->info() << "[SpatialProfile] globalLength " << samplInfo.globalLength[d] << "\n"; } // Get global number of molecules samplInfo.globalNumMolecules = domain->getglobalNumMolecules(true, particleContainer, domainDecomp); @@ -157,7 +157,7 @@ void SpatialProfile::init(ParticleContainer* particleContainer, DomainDecompBase } else { samplInfo.numMolFixRegion = 0; } - global_log->info() << "getDomain was called with Molecules in Fix Region: " << samplInfo.numMolFixRegion << endl; + Log::global_log->info() << "getDomain was called with Molecules in Fix Region: " << samplInfo.numMolFixRegion << std::endl; // Calculate sampling units if (samplInfo.cylinder) { @@ -174,13 +174,13 @@ void SpatialProfile::init(ParticleContainer* particleContainer, DomainDecompBase samplInfo.universalInvProfileUnit[1] = this->samplInfo.universalProfileUnit[1] / (samplInfo.globalLength[1]); // delta_H samplInfo.universalInvProfileUnit[2] = this->samplInfo.universalProfileUnit[2] / (2 * M_PI); // delta_Phi - global_log->info() << "[CylinderProfile] dR: " << samplInfo.universalInvProfileUnit[0] + Log::global_log->info() << "[CylinderProfile] dR: " << samplInfo.universalInvProfileUnit[0] << " dH: " << samplInfo.universalInvProfileUnit[1] << " dPhi: " << samplInfo.universalInvProfileUnit[2]; } else { for (unsigned i = 0; i < 3; i++) { samplInfo.universalInvProfileUnit[i] = samplInfo.universalProfileUnit[i] / samplInfo.globalLength[i]; - global_log->info() << "[SpatialProfile] universalInvProfileUnit " << samplInfo.universalInvProfileUnit[i] + Log::global_log->info() << "[SpatialProfile] universalInvProfileUnit " << samplInfo.universalInvProfileUnit[i] << "\n"; } } @@ -190,7 +190,7 @@ void SpatialProfile::init(ParticleContainer* particleContainer, DomainDecompBase * this->samplInfo.universalProfileUnit[2]); - global_log->info() << "[SpatialProfile] number uID " << _uIDs << "\n"; + Log::global_log->info() << "[SpatialProfile] number uID " << _uIDs << "\n"; // Calculate bin Volume if (samplInfo.cylinder) { @@ -204,14 +204,14 @@ void SpatialProfile::init(ParticleContainer* particleContainer, DomainDecompBase / (this->samplInfo.universalProfileUnit[0] * this->samplInfo.universalProfileUnit[1] * this->samplInfo.universalProfileUnit[2]); } - global_log->info() << "[SpatialProfile] segmentVolume " << samplInfo.segmentVolume << "\n"; + Log::global_log->info() << "[SpatialProfile] segmentVolume " << samplInfo.segmentVolume << "\n"; // Calculate Centre for cylinder coords samplInfo.universalCentre[0] = 0.5 * samplInfo.globalLength[0]; samplInfo.universalCentre[1] = 0; samplInfo.universalCentre[2] = 0.5 * samplInfo.globalLength[2]; - global_log->info() << "[SpatialProfile] profile init" << std::endl; + Log::global_log->info() << "[SpatialProfile] profile init" << std::endl; // Init profiles with sampling information and reset maps for (unsigned long uID = 0; uID < _uIDs; uID++) { for (unsigned i = 0; i < _profiles.size(); i++) { @@ -240,9 +240,9 @@ void SpatialProfile::endStep(ParticleContainer* particleContainer, DomainDecompB // Loop over all particles and bin them with uIDs for (auto thismol = particleContainer->iterator(ParticleIterator::ONLY_INNER_AND_BOUNDARY); thismol.isValid(); ++thismol) { - + if ((_profiledCompString != "all") && (thismol->componentid() == _profiledComp-1)) { - + // Get uID if (samplInfo.cylinder) { uID = getCylUID(thismol); @@ -258,9 +258,9 @@ void SpatialProfile::endStep(ParticleContainer* particleContainer, DomainDecompB _profiles[i]->record(*thismol, (unsigned) uID); } } - + if (_profiledCompString == "all"){ - + // Get uID if (samplInfo.cylinder) { uID = getCylUID(thismol); @@ -284,7 +284,7 @@ void SpatialProfile::endStep(ParticleContainer* particleContainer, DomainDecompB if ((simstep >= _initStatistics) && (simstep % _writeFrequency == 0)) { // COLLECTIVE COMMUNICATION - global_log->info() << "[SpatialProfile] uIDs: " << _uIDs << " acc. Data: " << _accumulatedDatasets << "\n"; + Log::global_log->info() << "[SpatialProfile] uIDs: " << _uIDs << " acc. Data: " << _accumulatedDatasets << "\n"; // Initialize Communication with number of bins * number of total comms needed per bin by all profiles. domainDecomp->collCommInit(_comms * _uIDs); @@ -311,7 +311,7 @@ void SpatialProfile::endStep(ParticleContainer* particleContainer, DomainDecompB // Initialize Output from rank 0 process if (mpi_rank == 0) { - global_log->info() << "[SpatialProfile] Writing profile output" << std::endl; + Log::global_log->info() << "[SpatialProfile] Writing profile output" << std::endl; for (unsigned i = 0; i < _profiles.size(); i++) { _profiles[i]->output(_outputPrefix + "_" + std::to_string(simstep), _accumulatedDatasets); } @@ -394,23 +394,23 @@ long SpatialProfile::getCylUID(ParticleIterator& thismol) { unID = (long) (hUn * samplInfo.universalProfileUnit[0] * samplInfo.universalProfileUnit[2] + rUn * samplInfo.universalProfileUnit[2] + phiUn); } else { - global_log->error() << "INV PROFILE UNITS " << samplInfo.universalInvProfileUnit[0] << " " + Log::global_log->error() << "INV PROFILE UNITS " << samplInfo.universalInvProfileUnit[0] << " " << samplInfo.universalInvProfileUnit[1] << " " << samplInfo.universalInvProfileUnit[2] << "\n"; - global_log->error() << "PROFILE UNITS " << samplInfo.universalProfileUnit[0] << " " + Log::global_log->error() << "PROFILE UNITS " << samplInfo.universalProfileUnit[0] << " " << samplInfo.universalProfileUnit[1] << " " << samplInfo.universalProfileUnit[2] << "\n"; - global_log->error() << "Severe error!! Invalid profile ID (" << rUn << " / " << hUn << " / " << phiUn + Log::global_log->error() << "Severe error!! Invalid profile ID (" << rUn << " / " << hUn << " / " << phiUn << ").\n\n"; - global_log->error() << "Severe error!! Invalid profile unit (" << R2 << " / " << yc << " / " << phi << ").\n\n"; - global_log->error() << "Coordinates off center (" << xc << " / " << yc << " / " << zc << ").\n"; - global_log->error() << "unID = " << unID << "\n"; + Log::global_log->error() << "Severe error!! Invalid profile unit (" << R2 << " / " << yc << " / " << phi << ").\n\n"; + Log::global_log->error() << "Coordinates off center (" << xc << " / " << yc << " / " << zc << ").\n"; + Log::global_log->error() << "unID = " << unID << "\n"; Simulation::exit(707); } return unID; } void SpatialProfile::addProfile(ProfileBase* profile) { - global_log->info() << "[SpatialProfile] Profile added: \n"; + Log::global_log->info() << "[SpatialProfile] Profile added: \n"; _profiles.push_back(profile); _comms += profile->comms(); } diff --git a/src/plugins/TestPlugin.h b/src/plugins/TestPlugin.h index 26789c5c1f..4ad6de540b 100755 --- a/src/plugins/TestPlugin.h +++ b/src/plugins/TestPlugin.h @@ -22,11 +22,11 @@ class TestPlugin: public PluginBase { //! be called once at the beginning of the simulation (see Simulation.cpp) void init(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, Domain* domain) { - global_log->debug() << "[TESTPLUGIN] TESTPLUGIN INIT" << std::endl; + Log::global_log->debug() << "[TESTPLUGIN] TESTPLUGIN INIT" << std::endl; } void readXML(XMLfileUnits& xmlconfig) { - global_log -> debug() << "[TESTPLUGIN] READING XML" << endl; + Log::global_log -> debug() << "[TESTPLUGIN] READING XML" << std::endl; } /** @brief Method will be called first thing in a new timestep. */ @@ -34,7 +34,7 @@ class TestPlugin: public PluginBase { ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, unsigned long simstep ) { - global_log -> debug() << "[TESTPLUGIN] BEFORE EVENT NEW TIMESTEP" << endl; + Log::global_log -> debug() << "[TESTPLUGIN] BEFORE EVENT NEW TIMESTEP" << std::endl; }; /** @brief Method beforeForces will be called before forcefields have been applied @@ -46,7 +46,7 @@ class TestPlugin: public PluginBase { ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, unsigned long simstep ) { - global_log -> debug() << "[TESTPLUGIN] BEFORE FORCES" << endl; + Log::global_log -> debug() << "[TESTPLUGIN] BEFORE FORCES" << std::endl; } /** @brief Method afterForces will be called after forcefields have been applied @@ -57,7 +57,7 @@ class TestPlugin: public PluginBase { ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, unsigned long simstep ) { - global_log->debug() << "[TESTPLUGIN] TESTPLUGIN AFTER FORCES" << endl; + Log::global_log->debug() << "[TESTPLUGIN] TESTPLUGIN AFTER FORCES" << std::endl; } /** @brief Method endStep will be called at the end of each time step. @@ -72,7 +72,7 @@ class TestPlugin: public PluginBase { ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, Domain* domain, unsigned long simstep ) { - global_log->debug() << "[TESTPLUGIN] ENDSTEP" << endl; + Log::global_log->debug() << "[TESTPLUGIN] ENDSTEP" << std::endl; } /** @brief Method finalOutput will be called at the end of the simulation @@ -85,15 +85,15 @@ class TestPlugin: public PluginBase { */ void finish(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, Domain* domain) { - global_log->debug() << "[TESTPLUGIN] FINISHING" << endl; + Log::global_log->debug() << "[TESTPLUGIN] FINISHING" << std::endl; } /** @brief return the name of the plugin */ std::string getPluginName() { - global_log->debug() << "[TESTPLUGIN] GETTING NAME" << endl; + Log::global_log->debug() << "[TESTPLUGIN] GETTING NAME" << std::endl; return "TestPlugin";} static PluginBase* createInstance() { - global_log->debug() << "[TESTPLUGIN] CREATE INSTANCE" << endl; + Log::global_log->debug() << "[TESTPLUGIN] CREATE INSTANCE" << std::endl; return new TestPlugin(); } private: diff --git a/src/plugins/VectorizationTuner.cpp b/src/plugins/VectorizationTuner.cpp index 34a6779228..5dae120ef0 100644 --- a/src/plugins/VectorizationTuner.cpp +++ b/src/plugins/VectorizationTuner.cpp @@ -33,22 +33,22 @@ void VectorizationTuner::readXML(XMLfileUnits& xmlconfig) { } else if (mode == "file") { vtWriter.reset(new VTWriter()); } else { - global_log->error() << R"(Unknown FlopRateOutputPlugin::mode. Choose "stdout" or "file".)" << endl; + Log::global_log->error() << R"(Unknown FlopRateOutputPlugin::mode. Choose "stdout" or "file".)" << std::endl; Simulation::exit(1); } _outputPrefix = "mardyn"; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "Output prefix: " << _outputPrefix << std::endl; + Log::global_log->info() << "Output prefix: " << _outputPrefix << std::endl; xmlconfig.getNodeValue("minmoleculecnt", _minMoleculeCnt); - global_log->info() << "Minimal molecule count: " << _minMoleculeCnt << std::endl; + Log::global_log->info() << "Minimal molecule count: " << _minMoleculeCnt << std::endl; xmlconfig.getNodeValue("maxmoleculecnt", _maxMoleculeCnt); - global_log->info() << "Maximal molecule count: " << _maxMoleculeCnt << std::endl; + Log::global_log->info() << "Maximal molecule count: " << _maxMoleculeCnt << std::endl; xmlconfig.getNodeValue("numRepetitionsMax", _numRepetitionsMax); - global_log->info() << "Maximal number of repetitions: " << _numRepetitionsMax << std::endl; + Log::global_log->info() << "Maximal number of repetitions: " << _numRepetitionsMax << std::endl; //! @todo This is a very improper way to do this - user does not know what the int values stand for std::string incTypeStr="both"; @@ -60,12 +60,12 @@ void VectorizationTuner::readXML(XMLfileUnits& xmlconfig) { } else if (incTypeStr == "both") { _moleculeCntIncreaseType = MoleculeCntIncreaseTypeEnum::both; } else { - global_log->error() + Log::global_log->error() << R"(Unknown FlopRateOutputPlugin::moleculecntincreasetype. Choose "linear" or "exponential" or "both".)" - << endl; + << std::endl; Simulation::exit(798123); } - global_log->info() << "Molecule count increase type: " << incTypeStr << std::endl; + Log::global_log->info() << "Molecule count increase type: " << incTypeStr << std::endl; } @@ -91,19 +91,19 @@ void VectorizationTuner::finish(ParticleContainer * /*particleContainer*/, void VectorizationTuner::writeFile(const TunerLoad& vecs){ int rank = global_simulation->domainDecomposition().getRank(); - ofstream myfile; - string resultfile(_outputPrefix + '.' + std::to_string(rank) + ".VT.data"); - global_log->info() << "VT: Writing to file " << resultfile << std::endl; - myfile.open(resultfile.c_str(), ofstream::out | ofstream::trunc); + std::ofstream myfile; + std::string resultfile(_outputPrefix + '.' + std::to_string(rank) + ".VT.data"); + Log::global_log->info() << "VT: Writing to file " << resultfile << std::endl; + myfile.open(resultfile.c_str(), std::ofstream::out | std::ofstream::trunc); TunerLoad::write(myfile, vecs); } bool VectorizationTuner::readFile(TunerLoad& times) { - ifstream myfile; + std::ifstream myfile; int rank = global_simulation->domainDecomposition().getRank(); - string resultfile(_outputPrefix + '.' + std::to_string(rank) + ".VT.data"); - global_log->info() << "VT: Reading from file " << resultfile << std::endl; - myfile.open(resultfile.c_str(), ifstream::in); + std::string resultfile(_outputPrefix + '.' + std::to_string(rank) + ".VT.data"); + Log::global_log->info() << "VT: Reading from file " << resultfile << std::endl; + myfile.open(resultfile.c_str(), std::ifstream::in); if(!myfile.good()){ return false; } @@ -113,7 +113,7 @@ bool VectorizationTuner::readFile(TunerLoad& times) { void VectorizationTuner::tune(std::vector& ComponentList) { - global_log->info() << "VT: begin VECTORIZATION TUNING "<< std::endl; + Log::global_log->info() << "VT: begin VECTORIZATION TUNING "<< std::endl; double gflopsOwnBig=0., gflopsPairBig=0., gflopsOwnNormal=0., gflopsPairNormalFace=0., gflopsPairNormalEdge=0., gflopsPairNormalCorner=0.,gflopsOwnZero=0., gflopsPairZero=0.; @@ -149,7 +149,7 @@ void VectorizationTuner::tune(std::vector& ComponentList) { _flopCounterBigRc->resetCounters(); _flopCounterNormalRc->resetCounters(); - global_log->info() << "VECTORIZATION TUNING completed "<< std::endl; + Log::global_log->info() << "VECTORIZATION TUNING completed "<< std::endl; } @@ -163,11 +163,11 @@ void VectorizationTuner::iterateOwn(unsigned int numRepetitions, // get Gflops for pair computations double tuningTime = global_simulation->timers()->getTime("VECTORIZATION_TUNER_TUNER"); gflopsPair = flopCounter.getTotalFlopCount() * numRepetitions / tuningTime / (1024*1024*1024); - global_log->info() << "single rank: FLOP-Count per Iteration: " << flopCounter.getTotalFlopCount() << " FLOPs" << std::endl; - global_log->info() << "single rank: FLOP-rate: " << gflopsPair << " GFLOPS" << std::endl; - global_log->info() << "single rank: number of iterations: " << numRepetitions << std::endl; - global_log->info() << "single rank: total time: " << tuningTime << "s" << std::endl; - global_log->info() << "single rank: time per iteration: " << tuningTime / numRepetitions << "s " << std::endl << std::endl; + Log::global_log->info() << "single rank: FLOP-Count per Iteration: " << flopCounter.getTotalFlopCount() << " FLOPs" << std::endl; + Log::global_log->info() << "single rank: FLOP-rate: " << gflopsPair << " GFLOPS" << std::endl; + Log::global_log->info() << "single rank: number of iterations: " << numRepetitions << std::endl; + Log::global_log->info() << "single rank: total time: " << tuningTime << "s" << std::endl; + Log::global_log->info() << "single rank: time per iteration: " << tuningTime / numRepetitions << "s " << std::endl << std::endl; flopCounter.resetCounters(); global_simulation->timers()->reset("VECTORIZATION_TUNER_TUNER"); } @@ -252,13 +252,13 @@ void VectorizationTuner::tune(std::vector& componentList, TunerLoad& bool allowMpi = allowMPIReduce; if(useExistingFiles && readFile(times)){ - global_log->info() << "Read tuner values from file" << std::endl; + Log::global_log->info() << "Read tuner values from file" << std::endl; return; } else if(useExistingFiles) { - global_log->info() << "Couldn't read tuner values from file" << std::endl; + Log::global_log->info() << "Couldn't read tuner values from file" << std::endl; } - global_log->info() << "starting tuning..." << std::endl; + Log::global_log->info() << "starting tuning..." << std::endl; CellBorderAndFlagManager saveFlagManager = ParticleCell::_cellBorderAndFlagManager; @@ -281,7 +281,7 @@ void VectorizationTuner::tune(std::vector& componentList, TunerLoad& mardyn_assert(componentList.size() == particleNums.size()); if(componentList.size() > 2){ - global_log->error_always_output() << "The tuner currently supports only two different particle types!" << std::endl; + Log::global_log->error_always_output() << "The tuner currently supports only two different particle types!" << std::endl; Simulation::exit(1); } @@ -308,7 +308,7 @@ void VectorizationTuner::tune(std::vector& componentList, TunerLoad& cornerValues.reserve(static_cast(maxMols+1)*(maxMols2+1)); for(int numMols1 = 0; numMols1 <= maxMols; numMols1++){ - global_log->info() << numMols1 << " Molecule(s)" << std::endl; + Log::global_log->info() << numMols1 << " Molecule(s)" << std::endl; for(int numMols2 = 0; numMols2 <= maxMols2; ++numMols2){ initUniformRandomMolecules(c1, c2, mainCell, numMols1, numMols2); @@ -364,7 +364,7 @@ void VectorizationTuner::tune(std::vector& componentList, TunerLoad& _cellProcessor->setCutoffRadiusSquare(restoreCutoff); _cellProcessor->setLJCutoffRadiusSquare(restoreLJCutoff); - global_log->info() << "finished tuning" << std::endl; + Log::global_log->info() << "finished tuning" << std::endl; // restore the _cellBorderAndFlagManager to its original value. ParticleCell::_cellBorderAndFlagManager = saveFlagManager; @@ -381,11 +381,11 @@ void VectorizationTuner::iteratePair(unsigned int numRepetitions, ParticleCell& // get Gflops for pair computations double tuningTime = global_simulation->timers()->getTime("VECTORIZATION_TUNER_TUNER"); gflopsPair = flopCounter.getTotalFlopCount() * numRepetitions / tuningTime / (1024 * 1024 * 1024); - global_log->info() << "FLOP-Count per Iteration: " << flopCounter.getTotalFlopCount() << " FLOPs" << std::endl; - global_log->info() << "FLOP-rate: " << gflopsPair << " GFLOPS" << std::endl; - global_log->info() << "number of iterations: " << numRepetitions << std::endl; - global_log->info() << "total time: " << tuningTime << "s" << std::endl; - global_log->info() << "time per iteration: " << tuningTime / numRepetitions << "s " << std::endl << std::endl; + Log::global_log->info() << "FLOP-Count per Iteration: " << flopCounter.getTotalFlopCount() << " FLOPs" << std::endl; + Log::global_log->info() << "FLOP-rate: " << gflopsPair << " GFLOPS" << std::endl; + Log::global_log->info() << "number of iterations: " << numRepetitions << std::endl; + Log::global_log->info() << "total time: " << tuningTime << "s" << std::endl; + Log::global_log->info() << "time per iteration: " << tuningTime / numRepetitions << "s " << std::endl << std::endl; flopCounter.resetCounters(); global_simulation->timers()->reset("VECTORIZATION_TUNER_TUNER"); } @@ -440,7 +440,7 @@ void VectorizationTuner::iterate(std::vector& ComponentList, unsigned //double diryplus[3] = {0., 1., 0.}; //double dirzplus[3] = {0., 0., 1.}; - global_log->info() << "--------------------------Molecule count: " << numMols << "--------------------------" << std::endl; + Log::global_log->info() << "--------------------------Molecule count: " << numMols << "--------------------------" << std::endl; //initialize both cells with molecules between 0,0,0 and 1,1,1 initUniformRandomMolecules(comp, firstCell, numMols); @@ -754,11 +754,11 @@ void VectorizationTuner::init(ParticleContainer *particleContainer, DomainDecomp void VectorizationTuner::VTWriter::initWrite(const std::string& outputPrefix, double cutoffRadius, double LJCutoffRadius, double cutoffRadiusBig, double LJCutoffRadiusBig) { - string resultfile(outputPrefix + ".VT.csv"); - global_log->info() << "VT: Writing to file " << resultfile << std::endl; + std::string resultfile(outputPrefix + ".VT.csv"); + Log::global_log->info() << "VT: Writing to file " << resultfile << std::endl; _rank = global_simulation->domainDecomposition().getRank(); if (_rank == 0) { - _myfile.open(resultfile.c_str(), ofstream::out | ofstream::trunc); + _myfile.open(resultfile.c_str(), std::ofstream::out | std::ofstream::trunc); _myfile << "Vectorization Tuner File" << std::endl << "The Cutoff Radii were: " << std::endl << "NormalRc=" << cutoffRadius << " , LJCutoffRadiusNormal=" << LJCutoffRadius << std::endl << "BigRC=" << cutoffRadiusBig << " , BigLJCR=" << LJCutoffRadiusBig << std::endl; @@ -793,11 +793,11 @@ void VectorizationTuner::VTWriter::write(unsigned int numMols, double gflopsOwnB void VectorizationTuner::VTWriterStatistics::initWrite(const std::string& /*outputPrefix*/, double cutoffRadius, double LJCutoffRadius, double cutoffRadiusBig, double LJCutoffRadiusBig) { - global_log->info() << "VT: Writing to global_log " << std::endl; + Log::global_log->info() << "VT: Writing to Log::global_log " << std::endl; _rank = global_simulation->domainDecomposition().getRank(); if (_rank == 0) { - global_log->info() << "Vectorization Tuner File" << std::endl << "The Cutoff Radii were: " << std::endl + Log::global_log->info() << "Vectorization Tuner File" << std::endl << "The Cutoff Radii were: " << std::endl << "NormalRc=" << cutoffRadius << " , LJCutoffRadiusNormal=" << LJCutoffRadius << std::endl << "BigRC=" << cutoffRadiusBig << " , BigLJCR=" << LJCutoffRadiusBig << std::endl; } @@ -843,7 +843,7 @@ void VectorizationTuner::VTWriterStatistics::writeStatistics(double input, const if (not std::isfinite(stddev)) stddev = 0.; if (average > 0.) { - global_log->info() << name << ":\tAverage: " << average << "\tstd.deviation(abs): " << stddev << "\tMin: " + Log::global_log->info() << name << ":\tAverage: " << average << "\tstd.deviation(abs): " << stddev << "\tMin: " << min << "\tMax: " << max << std::endl; } } @@ -853,10 +853,10 @@ void VectorizationTuner::VTWriterStatistics::write(unsigned int numMols, double double gflopsOwnZero, double gflopsPairZero) { - global_log->info() << "Vectorization Tuner Statistics:" << std::endl; - global_log->info() << "Number of molecules per cell: " << numMols << std::endl; + Log::global_log->info() << "Vectorization Tuner Statistics:" << std::endl; + Log::global_log->info() << "Number of molecules per cell: " << numMols << std::endl; - global_log->info() << "values in GFlop/s" << std::endl; + Log::global_log->info() << "values in GFlop/s" << std::endl; writeStatistics(gflopsOwnBig, "gflopsOwnBig"); writeStatistics(gflopsPairBig, "gflopsPairBig"); writeStatistics(gflopsOwnNormal, "gflopsOwnNormal"); diff --git a/src/plugins/VectorizationTuner.h b/src/plugins/VectorizationTuner.h index 81e9863379..cc5e5dabbd 100644 --- a/src/plugins/VectorizationTuner.h +++ b/src/plugins/VectorizationTuner.h @@ -270,7 +270,7 @@ class VectorizationTuner: public PluginBase { double gflopsOwnZero, double gflopsPairZero) override; void close() override; private: - ofstream _myfile; + std::ofstream _myfile; }; class VTWriterStatistics: public VTWriterI { diff --git a/src/plugins/WallPotential.cpp b/src/plugins/WallPotential.cpp index f2d85265d5..a1b426af27 100755 --- a/src/plugins/WallPotential.cpp +++ b/src/plugins/WallPotential.cpp @@ -1,368 +1,368 @@ -// -// Created by kruegener on 6/8/2018. -// moved from /molecules/Wall.cpp by mheinen -// - -#include "WallPotential.h" - -/** - * @brief reads in configuration from config.xml. see class doc for example .xml - * - * @param xmlconfig config.xml - */ -void WallPotential::readXML(XMLfileUnits &xmlconfig) { - double density, sigma, epsilon, yoff, ycut; - xmlconfig.getNodeValue("density", density); - xmlconfig.getNodeValue("sigma", sigma); - xmlconfig.getNodeValue("epsilon", epsilon); - xmlconfig.getNodeValue("yoff", yoff); - xmlconfig.getNodeValue("ycut", ycut); - xmlconfig.getNodeValue("width", _dWidth); - xmlconfig.getNodeValue("delta", _delta); - _dWidthHalf = _dWidth * 0.5; - global_log->info() << "[WallPotential] Using plugin with parameters: density=" << density << ", sigma=" << sigma - << ", epsilon=" << epsilon << ", yoff=" << yoff << ", ycut=" << ycut << ", width=" << _dWidth - << ", delta=" << _delta << endl; - - int potential; - xmlconfig.getNodeValue("potential", potential); - if(potential == 93){ - _potential = LJ9_3; - } - else if(potential == 104){ - _potential = LJ10_4; - } - else{ - global_log -> info() << "[WallPotential] No valid potential was specified -> Default: LJ9_3" << std::endl; - _potential = LJ9_3; - // TODO: is this allowed or should simulation be halted - // HALT SIM - //global_simulation -> exit(1); - } - - XMLfile::Query query = xmlconfig.query("component"); - unsigned int numComponentsConsidered = query.card(); - global_log->info() << "[WallPotential] Setting parameters 'xi', 'eta' for " << numComponentsConsidered << " components." << endl; - - std::vector* components = global_simulation->getEnsemble()->getComponents(); - unsigned int numComponents = components->size(); - std::vector xi_sf(numComponents); - std::vector eta_sf(numComponents); - - _bConsiderComponent.resize(numComponents); - - if(numComponentsConsidered == 0){ - for(auto&& bi : _bConsiderComponent) - bi = true; - } - else { - for (auto &&bi : _bConsiderComponent) - bi = false; - - string oldpath = xmlconfig.getcurrentnodepath(); - XMLfile::Query::const_iterator componentIter; - for (componentIter = query.begin(); componentIter; componentIter++) { - xmlconfig.changecurrentnode(componentIter); - unsigned int cid; - xmlconfig.getNodeValue("@id", cid); - xmlconfig.getNodeValue("xi", xi_sf.at(cid - 1)); - xmlconfig.getNodeValue("eta", eta_sf.at(cid - 1)); - _bConsiderComponent.at(cid - 1) = true; - global_log->info() << "[WallPotential] " << cid << " " << xi_sf.at(cid - 1) << " " << eta_sf.at(cid - 1) - << " " << std::endl; - } - xmlconfig.changecurrentnode(oldpath); - } - - - if(_potential == LJ9_3){ - this->initializeLJ93(components, density, sigma, epsilon, xi_sf, eta_sf, yoff, ycut); - global_log->info() << "[WallPotential] LJ9_3 initialized." << endl; - } - else if(_potential == LJ10_4){ - this->initializeLJ1043(components, density, sigma, epsilon, xi_sf, eta_sf, yoff, ycut); - global_log->info() << "[WallPotential] LJ10_4 initialized." << endl; - } - else{ - global_log -> error() << "[WallPotential] UNKNOWN WALL POTENTIAL! EXITING!" << std::endl; - global_simulation -> exit(11); - } - -} - -/** - * @brief initialize the LJ93 potential and calculate potential energy at cutoff - * - * @param components vector of components - * @param in_rhoWall density in wall - * @param in_sigWall sigmal of wall - * @param in_epsWall epsilon of wall - * @param in_xi vector for xi - * @param in_eta vector for eta - * @param in_yOffWall y-offset for wall - * @param in_yWallCut y-cutoff relative to wall - */ -void WallPotential::initializeLJ93(const std::vector* components, - double in_rhoWall, double in_sigWall, double in_epsWall, std::vector in_xi, std::vector in_eta, - double in_yOffWall, double in_yWallCut) { - - global_log->info() << "[WallPotential] Initializing the wall function LJ-9-3.\n"; - this->_rhoW = in_rhoWall; - this->_yc = in_yWallCut; - this->_yOff = in_yOffWall; - - _nc = components->size(); - _eps_wi = new double[_nc]; - _sig3_wi = new double[_nc]; - _uShift_9_3 = new double[_nc]; - _uPot_9_3 = new double[_nc]; - - for (unsigned i = 0; i < _nc; i++) { - _eps_wi[i] = in_xi[i] * sqrt(in_epsWall * (components->at(i)).ljcenter(0).eps()); - - double sig_wi = 0.5 * in_eta[i] * (in_sigWall + (components->at(i)).ljcenter(0).sigma()); - _sig3_wi[i] = sig_wi * sig_wi * sig_wi; - double sig9_sf = _sig3_wi[i] * _sig3_wi[i] * _sig3_wi[i]; - - double y = _yc; - double y3 = y * y * y; - double y9 = y3 * y3 * y3; - - _uShift_9_3[i] = 4.0 / 3.0 * M_PI * _rhoW * _eps_wi[i] *_sig3_wi[i] * (sig9_sf / 15.0 / y9 - _sig3_wi[i] / 2.0 / y3); - _uPot_9_3[i] = 0.0; - } -} -/** - * @brief initialize the LJ1043 potential and calculate potential energy at cutoff - * - * @param components vector of components - * @param in_rhoWall density in wall - * @param in_sigWall sigmal of wall - * @param in_epsWall epsilon of wall - * @param in_xi vector for xi of components - * @param in_eta vector for eta of components - * @param in_yOffWall y-offset for wall - * @param in_yWallCut y-cutoff relative to wall - */ -void WallPotential::initializeLJ1043(const std::vector *components, - double in_rhoWall, double in_sigWall, double in_epsWall, std::vector in_xi, - std::vector in_eta, - double in_yOffWall, double in_yWallCut) { - - global_log->info() << "[WallPotential] Initializing the wall function LJ-10-4-3 with " << _nc << " components.\n" << endl; - - this->_rhoW = in_rhoWall; - this->_yc = in_yWallCut; - this->_yOff = in_yOffWall; - - _nc = components->size(); - _eps_wi = new double[_nc]; - _sig3_wi = new double[_nc]; - _sig2_wi = new double[_nc]; - _sig_wi = new double[_nc]; - _uShift_10_4_3 = new double[_nc]; - _uPot_10_4_3 = new double[_nc]; - - for (unsigned i = 0; i < _nc; i++) { - _eps_wi[i] = in_xi[i] * sqrt(in_epsWall * (components->at(i)).ljcenter(0).eps()); - - double sig_wi = 0.5 * in_eta[i] * (in_sigWall + (components->at(i)).ljcenter(0).sigma()); - _sig_wi[i] = sig_wi; - _sig2_wi[i] = sig_wi * sig_wi; - _sig3_wi[i] = sig_wi * sig_wi * sig_wi; - double sig10_sf = _sig3_wi[i] * _sig3_wi[i] * _sig3_wi[i] * _sig_wi[i]; - double sig4_sf = _sig2_wi[i] * _sig2_wi[i]; - - double y = _yc; - double y2 = y * y; - double y4 = y2 * y2; - double y10 = y4 * y4 * y2; - - double bracket = y + 0.61 * _delta; - double bracket3 = bracket * bracket * bracket; - - _uShift_10_4_3[i] = 2 * M_PI * _eps_wi[i] * _rhoW * _sig2_wi[i] * _delta * ((2 / 5) * (sig10_sf / y10) - sig4_sf / y4 - sig4_sf / (3 * _delta * bracket3)); - _uPot_10_4_3[i] = 0.0; - } -} - -/** - * @brief Calculate and add forces to lennard-jones-sites. Also calculate new potential energy addition. - * @param partContainer - */ -void WallPotential::calcTSLJ_9_3(ParticleContainer *partContainer) { - double regionLowCorner[3], regionHighCorner[3]; - - /*! LJ-9-3 potential applied in y-direction */ - if(partContainer->getBoundingBoxMin(1) < _yc + _yOff) { // if linked cell within the potential range (inside the potential's cutoff) - for(unsigned d = 0; d < 3; d++){ - regionLowCorner[d] = partContainer->getBoundingBoxMin(d); - regionHighCorner[d] = partContainer->getBoundingBoxMax(d); - } - -#if defined (_OPENMP) -#pragma omp parallel shared(regionLowCorner, regionHighCorner) -#endif - { - auto begin = partContainer->regionIterator(regionLowCorner, regionHighCorner, ParticleIterator::ALL_CELLS); - - double f[3]; - for(unsigned d=0; d<3; d++) - f[d] = 0.; - - for(auto i = begin; i.isValid(); ++i){ - unsigned cid = (*i).componentid(); - if(false == _bConsiderComponent.at(cid) ) - continue; // only add Wall force to molecules of component that should be considered - - for(unsigned int si=0; sinumLJcenters(); ++si) { - double y, y3, y9, ry, ryRel; - const std::array arrSite = i->ljcenter_d_abs(si); - const double *posSite = arrSite.data(); - ry = posSite[1]; - ryRel = (ry > _yOff) ? (ry - (_yOff + _dWidthHalf)) : (ry - (_yOff - _dWidthHalf)); - y = abs(ryRel); - //y = ryRel; - - if (y < _yc) { - y3 = y * y * y; - y9 = y3 * y3 * y3; - for (unsigned d = 0; d < 3; d++) { - f[d] = 0.0; - } - - double sig9_wi; - sig9_wi = _sig3_wi[cid] * _sig3_wi[cid] * _sig3_wi[cid]; - f[1] = 4.0 * M_PI * _rhoW * _eps_wi[cid] * _sig3_wi[cid] * - (sig9_wi / 5.0 / y9 - _sig3_wi[cid] / 2.0 / y3) / y; - if(ryRel < 0){ - f[1] = -f[1]; - } - _uPot_9_3[cid] += 4.0 * M_PI * _rhoW * _eps_wi[cid] * _sig3_wi[cid] * - (sig9_wi / 45.0 / y9 - _sig3_wi[cid] / 6.0 / y3) - _uShift_9_3[cid]; - f[0] = 0; - f[2] = 0; - i->Fljcenteradd(si, f); - } - } - } - } - } - - double u_pot; - u_pot = _uPot_9_3[0] + _domain -> getLocalUpotCompSpecific(); - _domain->setLocalUpotCompSpecific(u_pot); - for(unsigned cid = 0; cid < _nc; cid++) { - _uPot_9_3[cid] = 0.0; - } -} // end method calcTSLJ_9_3(...) - -/** - * @brief Calculate and add forces to lennard-jones-sites. Also calculate new potential energy addition. - * @param partContainer - */ -void WallPotential::calcTSLJ_10_4(ParticleContainer *partContainer) { - - double regionLowCorner[3], regionHighCorner[3]; - - - /*! LJ-10-4 potential applied in y-direction */ - //if(partContainer->getBoundingBoxMin(1)< _yc+_yOff ){ // if linked cell within the potential range (inside the potential's cutoff) - for(unsigned d = 0; d < 3; d++){ - regionLowCorner[d] = partContainer->getBoundingBoxMin(d); - regionHighCorner[d] = partContainer->getBoundingBoxMax(d); - } - - - -#if defined (_OPENMP) -#pragma omp parallel shared(regionLowCorner, regionHighCorner) -#endif - { - auto begin = partContainer->regionIterator(regionLowCorner, regionHighCorner, ParticleIterator::ALL_CELLS); - - for(auto i = begin; i.isValid() ; ++i){ - double ry, ryRel, y, y2, y4, y5, y10, y11; - unsigned cid = (*i).componentid(); - if(false == _bConsiderComponent.at(cid) ) - continue; // only add Wall force to molecules of component that should be considered - - for(unsigned int si=0; sinumLJcenters(); ++si) { - const std::array arrSite = i->ljcenter_d_abs(si); - const double* posSite = arrSite.data(); - //y = (*i).r(1) - _yOff; - ry = posSite[1]; - ryRel = (ry > _yOff) ? (ry - (_yOff + _dWidthHalf)) : (ry - (_yOff - _dWidthHalf)); - y = abs(ryRel); - if (y < _yc) { - y2 = y * y; - y4 = y2 * y2; - y5 = y4 * y; - y10 = y5 * y5; - y11 = y10 * y; - double f[3]; - for (unsigned d = 0; d < 3; d++) { - f[d] = 0.0; - } - - double sig2_wi = _sig2_wi[cid]; - double sig4_wi = _sig2_wi[cid] * _sig2_wi[cid]; - double sig5_wi = sig4_wi * _sig_wi[cid]; - double sig10_wi = sig5_wi * sig5_wi; - double bracket = y + 0.61 * _delta; - double bracket3 = bracket * bracket * bracket; - double term1 = sig10_wi / y10; - double term2 = sig4_wi / y4; - double term3 = sig4_wi / (3 * _delta * bracket3); - double preFactor = 2 * M_PI * _eps_wi[cid] * _rhoW * sig2_wi * _delta; - _uPot_10_4_3[cid] += preFactor * ((2 / 5) * term1 - term2 - term3) - _uShift_10_4_3[cid]; - f[1] = preFactor * (4 * (sig10_wi / y11) - 4 * (sig4_wi / y5) - term3 * 3 / bracket); - if(ryRel < 0){ - f[1] = -f[1]; - } - f[0] = 0; - f[2] = 0; - - i->Fljcenteradd(si, f); - //i->calcFM_site(i->ljcenter_d(si), i->ljcenter_F(si)); - //i->Fadd(f); - } - } - } - } - - double u_pot; - // TODO: sum up upot for all components - u_pot = _uPot_10_4_3[0] + _domain -> getLocalUpotCompSpecific(); - _domain->setLocalUpotCompSpecific(u_pot); - for(unsigned cid = 0; cid < _nc; cid++) { - _uPot_10_4_3[cid] = 0.0; - } -} -// end method calcTSLJ_10_4(...) - -/** - * @brief gets called during the force update step. calls the appropriate calculation function. - * - * @param particleContainer - * @param domainDecomp - * @param simstep - */ -void WallPotential::siteWiseForces(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, - unsigned long simstep) { - - if(simstep == 0){ - return; - } - if(_potential == LJ9_3){ - //global_log->debug() << "[WallPotential] LJ9_3 afterForces." << endl; - this->calcTSLJ_9_3(particleContainer); - //global_log->debug() << "[WallPotential] LJ9_3 applied." << endl; - } - else if(_potential == LJ10_4){ - //global_log->debug() << "[WallPotential] LJ10_4 afterForces. " << endl; - this->calcTSLJ_10_4(particleContainer); - //global_log->debug() << "[WallPotential] LJ10_4 applied." << endl; - } - -} \ No newline at end of file +// +// Created by kruegener on 6/8/2018. +// moved from /molecules/Wall.cpp by mheinen +// + +#include "WallPotential.h" + +/** + * @brief reads in configuration from config.xml. see class doc for example .xml + * + * @param xmlconfig config.xml + */ +void WallPotential::readXML(XMLfileUnits &xmlconfig) { + double density, sigma, epsilon, yoff, ycut; + xmlconfig.getNodeValue("density", density); + xmlconfig.getNodeValue("sigma", sigma); + xmlconfig.getNodeValue("epsilon", epsilon); + xmlconfig.getNodeValue("yoff", yoff); + xmlconfig.getNodeValue("ycut", ycut); + xmlconfig.getNodeValue("width", _dWidth); + xmlconfig.getNodeValue("delta", _delta); + _dWidthHalf = _dWidth * 0.5; + Log::global_log->info() << "[WallPotential] Using plugin with parameters: density=" << density << ", sigma=" << sigma + << ", epsilon=" << epsilon << ", yoff=" << yoff << ", ycut=" << ycut << ", width=" << _dWidth + << ", delta=" << _delta << std::endl; + + int potential; + xmlconfig.getNodeValue("potential", potential); + if(potential == 93){ + _potential = LJ9_3; + } + else if(potential == 104){ + _potential = LJ10_4; + } + else{ + Log::global_log -> info() << "[WallPotential] No valid potential was specified -> Default: LJ9_3" << std::endl; + _potential = LJ9_3; + // TODO: is this allowed or should simulation be halted + // HALT SIM + //global_simulation -> exit(1); + } + + XMLfile::Query query = xmlconfig.query("component"); + unsigned int numComponentsConsidered = query.card(); + Log::global_log->info() << "[WallPotential] Setting parameters 'xi', 'eta' for " << numComponentsConsidered << " components." << std::endl; + + std::vector* components = global_simulation->getEnsemble()->getComponents(); + unsigned int numComponents = components->size(); + std::vector xi_sf(numComponents); + std::vector eta_sf(numComponents); + + _bConsiderComponent.resize(numComponents); + + if(numComponentsConsidered == 0){ + for(auto&& bi : _bConsiderComponent) + bi = true; + } + else { + for (auto &&bi : _bConsiderComponent) + bi = false; + + std::string oldpath = xmlconfig.getcurrentnodepath(); + XMLfile::Query::const_iterator componentIter; + for (componentIter = query.begin(); componentIter; componentIter++) { + xmlconfig.changecurrentnode(componentIter); + unsigned int cid; + xmlconfig.getNodeValue("@id", cid); + xmlconfig.getNodeValue("xi", xi_sf.at(cid - 1)); + xmlconfig.getNodeValue("eta", eta_sf.at(cid - 1)); + _bConsiderComponent.at(cid - 1) = true; + Log::global_log->info() << "[WallPotential] " << cid << " " << xi_sf.at(cid - 1) << " " << eta_sf.at(cid - 1) + << " " << std::endl; + } + xmlconfig.changecurrentnode(oldpath); + } + + + if(_potential == LJ9_3){ + this->initializeLJ93(components, density, sigma, epsilon, xi_sf, eta_sf, yoff, ycut); + Log::global_log->info() << "[WallPotential] LJ9_3 initialized." << std::endl; + } + else if(_potential == LJ10_4){ + this->initializeLJ1043(components, density, sigma, epsilon, xi_sf, eta_sf, yoff, ycut); + Log::global_log->info() << "[WallPotential] LJ10_4 initialized." << std::endl; + } + else{ + Log::global_log -> error() << "[WallPotential] UNKNOWN WALL POTENTIAL! EXITING!" << std::endl; + global_simulation -> exit(11); + } + +} + +/** + * @brief initialize the LJ93 potential and calculate potential energy at cutoff + * + * @param components vector of components + * @param in_rhoWall density in wall + * @param in_sigWall sigmal of wall + * @param in_epsWall epsilon of wall + * @param in_xi vector for xi + * @param in_eta vector for eta + * @param in_yOffWall y-offset for wall + * @param in_yWallCut y-cutoff relative to wall + */ +void WallPotential::initializeLJ93(const std::vector* components, + double in_rhoWall, double in_sigWall, double in_epsWall, std::vector in_xi, std::vector in_eta, + double in_yOffWall, double in_yWallCut) { + + Log::global_log->info() << "[WallPotential] Initializing the wall function LJ-9-3.\n"; + this->_rhoW = in_rhoWall; + this->_yc = in_yWallCut; + this->_yOff = in_yOffWall; + + _nc = components->size(); + _eps_wi = new double[_nc]; + _sig3_wi = new double[_nc]; + _uShift_9_3 = new double[_nc]; + _uPot_9_3 = new double[_nc]; + + for (unsigned i = 0; i < _nc; i++) { + _eps_wi[i] = in_xi[i] * sqrt(in_epsWall * (components->at(i)).ljcenter(0).eps()); + + double sig_wi = 0.5 * in_eta[i] * (in_sigWall + (components->at(i)).ljcenter(0).sigma()); + _sig3_wi[i] = sig_wi * sig_wi * sig_wi; + double sig9_sf = _sig3_wi[i] * _sig3_wi[i] * _sig3_wi[i]; + + double y = _yc; + double y3 = y * y * y; + double y9 = y3 * y3 * y3; + + _uShift_9_3[i] = 4.0 / 3.0 * M_PI * _rhoW * _eps_wi[i] *_sig3_wi[i] * (sig9_sf / 15.0 / y9 - _sig3_wi[i] / 2.0 / y3); + _uPot_9_3[i] = 0.0; + } +} +/** + * @brief initialize the LJ1043 potential and calculate potential energy at cutoff + * + * @param components vector of components + * @param in_rhoWall density in wall + * @param in_sigWall sigmal of wall + * @param in_epsWall epsilon of wall + * @param in_xi vector for xi of components + * @param in_eta vector for eta of components + * @param in_yOffWall y-offset for wall + * @param in_yWallCut y-cutoff relative to wall + */ +void WallPotential::initializeLJ1043(const std::vector *components, + double in_rhoWall, double in_sigWall, double in_epsWall, std::vector in_xi, + std::vector in_eta, + double in_yOffWall, double in_yWallCut) { + + Log::global_log->info() << "[WallPotential] Initializing the wall function LJ-10-4-3 with " << _nc << " components.\n" << std::endl; + + this->_rhoW = in_rhoWall; + this->_yc = in_yWallCut; + this->_yOff = in_yOffWall; + + _nc = components->size(); + _eps_wi = new double[_nc]; + _sig3_wi = new double[_nc]; + _sig2_wi = new double[_nc]; + _sig_wi = new double[_nc]; + _uShift_10_4_3 = new double[_nc]; + _uPot_10_4_3 = new double[_nc]; + + for (unsigned i = 0; i < _nc; i++) { + _eps_wi[i] = in_xi[i] * sqrt(in_epsWall * (components->at(i)).ljcenter(0).eps()); + + double sig_wi = 0.5 * in_eta[i] * (in_sigWall + (components->at(i)).ljcenter(0).sigma()); + _sig_wi[i] = sig_wi; + _sig2_wi[i] = sig_wi * sig_wi; + _sig3_wi[i] = sig_wi * sig_wi * sig_wi; + double sig10_sf = _sig3_wi[i] * _sig3_wi[i] * _sig3_wi[i] * _sig_wi[i]; + double sig4_sf = _sig2_wi[i] * _sig2_wi[i]; + + double y = _yc; + double y2 = y * y; + double y4 = y2 * y2; + double y10 = y4 * y4 * y2; + + double bracket = y + 0.61 * _delta; + double bracket3 = bracket * bracket * bracket; + + _uShift_10_4_3[i] = 2 * M_PI * _eps_wi[i] * _rhoW * _sig2_wi[i] * _delta * ((2 / 5) * (sig10_sf / y10) - sig4_sf / y4 - sig4_sf / (3 * _delta * bracket3)); + _uPot_10_4_3[i] = 0.0; + } +} + +/** + * @brief Calculate and add forces to lennard-jones-sites. Also calculate new potential energy addition. + * @param partContainer + */ +void WallPotential::calcTSLJ_9_3(ParticleContainer *partContainer) { + double regionLowCorner[3], regionHighCorner[3]; + + /*! LJ-9-3 potential applied in y-direction */ + if(partContainer->getBoundingBoxMin(1) < _yc + _yOff) { // if linked cell within the potential range (inside the potential's cutoff) + for(unsigned d = 0; d < 3; d++){ + regionLowCorner[d] = partContainer->getBoundingBoxMin(d); + regionHighCorner[d] = partContainer->getBoundingBoxMax(d); + } + +#if defined (_OPENMP) +#pragma omp parallel shared(regionLowCorner, regionHighCorner) +#endif + { + auto begin = partContainer->regionIterator(regionLowCorner, regionHighCorner, ParticleIterator::ALL_CELLS); + + double f[3]; + for(unsigned d=0; d<3; d++) + f[d] = 0.; + + for(auto i = begin; i.isValid(); ++i){ + unsigned cid = (*i).componentid(); + if(false == _bConsiderComponent.at(cid) ) + continue; // only add Wall force to molecules of component that should be considered + + for(unsigned int si=0; sinumLJcenters(); ++si) { + double y, y3, y9, ry, ryRel; + const std::array arrSite = i->ljcenter_d_abs(si); + const double *posSite = arrSite.data(); + ry = posSite[1]; + ryRel = (ry > _yOff) ? (ry - (_yOff + _dWidthHalf)) : (ry - (_yOff - _dWidthHalf)); + y = abs(ryRel); + //y = ryRel; + + if (y < _yc) { + y3 = y * y * y; + y9 = y3 * y3 * y3; + for (unsigned d = 0; d < 3; d++) { + f[d] = 0.0; + } + + double sig9_wi; + sig9_wi = _sig3_wi[cid] * _sig3_wi[cid] * _sig3_wi[cid]; + f[1] = 4.0 * M_PI * _rhoW * _eps_wi[cid] * _sig3_wi[cid] * + (sig9_wi / 5.0 / y9 - _sig3_wi[cid] / 2.0 / y3) / y; + if(ryRel < 0){ + f[1] = -f[1]; + } + _uPot_9_3[cid] += 4.0 * M_PI * _rhoW * _eps_wi[cid] * _sig3_wi[cid] * + (sig9_wi / 45.0 / y9 - _sig3_wi[cid] / 6.0 / y3) - _uShift_9_3[cid]; + f[0] = 0; + f[2] = 0; + i->Fljcenteradd(si, f); + } + } + } + } + } + + double u_pot; + u_pot = _uPot_9_3[0] + _domain -> getLocalUpotCompSpecific(); + _domain->setLocalUpotCompSpecific(u_pot); + for(unsigned cid = 0; cid < _nc; cid++) { + _uPot_9_3[cid] = 0.0; + } +} // end method calcTSLJ_9_3(...) + +/** + * @brief Calculate and add forces to lennard-jones-sites. Also calculate new potential energy addition. + * @param partContainer + */ +void WallPotential::calcTSLJ_10_4(ParticleContainer *partContainer) { + + double regionLowCorner[3], regionHighCorner[3]; + + + /*! LJ-10-4 potential applied in y-direction */ + //if(partContainer->getBoundingBoxMin(1)< _yc+_yOff ){ // if linked cell within the potential range (inside the potential's cutoff) + for(unsigned d = 0; d < 3; d++){ + regionLowCorner[d] = partContainer->getBoundingBoxMin(d); + regionHighCorner[d] = partContainer->getBoundingBoxMax(d); + } + + + +#if defined (_OPENMP) +#pragma omp parallel shared(regionLowCorner, regionHighCorner) +#endif + { + auto begin = partContainer->regionIterator(regionLowCorner, regionHighCorner, ParticleIterator::ALL_CELLS); + + for(auto i = begin; i.isValid() ; ++i){ + double ry, ryRel, y, y2, y4, y5, y10, y11; + unsigned cid = (*i).componentid(); + if(false == _bConsiderComponent.at(cid) ) + continue; // only add Wall force to molecules of component that should be considered + + for(unsigned int si=0; sinumLJcenters(); ++si) { + const std::array arrSite = i->ljcenter_d_abs(si); + const double* posSite = arrSite.data(); + //y = (*i).r(1) - _yOff; + ry = posSite[1]; + ryRel = (ry > _yOff) ? (ry - (_yOff + _dWidthHalf)) : (ry - (_yOff - _dWidthHalf)); + y = abs(ryRel); + if (y < _yc) { + y2 = y * y; + y4 = y2 * y2; + y5 = y4 * y; + y10 = y5 * y5; + y11 = y10 * y; + double f[3]; + for (unsigned d = 0; d < 3; d++) { + f[d] = 0.0; + } + + double sig2_wi = _sig2_wi[cid]; + double sig4_wi = _sig2_wi[cid] * _sig2_wi[cid]; + double sig5_wi = sig4_wi * _sig_wi[cid]; + double sig10_wi = sig5_wi * sig5_wi; + double bracket = y + 0.61 * _delta; + double bracket3 = bracket * bracket * bracket; + double term1 = sig10_wi / y10; + double term2 = sig4_wi / y4; + double term3 = sig4_wi / (3 * _delta * bracket3); + double preFactor = 2 * M_PI * _eps_wi[cid] * _rhoW * sig2_wi * _delta; + _uPot_10_4_3[cid] += preFactor * ((2 / 5) * term1 - term2 - term3) - _uShift_10_4_3[cid]; + f[1] = preFactor * (4 * (sig10_wi / y11) - 4 * (sig4_wi / y5) - term3 * 3 / bracket); + if(ryRel < 0){ + f[1] = -f[1]; + } + f[0] = 0; + f[2] = 0; + + i->Fljcenteradd(si, f); + //i->calcFM_site(i->ljcenter_d(si), i->ljcenter_F(si)); + //i->Fadd(f); + } + } + } + } + + double u_pot; + // TODO: sum up upot for all components + u_pot = _uPot_10_4_3[0] + _domain -> getLocalUpotCompSpecific(); + _domain->setLocalUpotCompSpecific(u_pot); + for(unsigned cid = 0; cid < _nc; cid++) { + _uPot_10_4_3[cid] = 0.0; + } +} +// end method calcTSLJ_10_4(...) + +/** + * @brief gets called during the force update step. calls the appropriate calculation function. + * + * @param particleContainer + * @param domainDecomp + * @param simstep + */ +void WallPotential::siteWiseForces(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, + unsigned long simstep) { + + if(simstep == 0){ + return; + } + if(_potential == LJ9_3){ + //global_log->debug() << "[WallPotential] LJ9_3 afterForces." << std::endl; + this->calcTSLJ_9_3(particleContainer); + //global_log->debug() << "[WallPotential] LJ9_3 applied." << std::endl; + } + else if(_potential == LJ10_4){ + //global_log->debug() << "[WallPotential] LJ10_4 afterForces. " << std::endl; + this->calcTSLJ_10_4(particleContainer); + //global_log->debug() << "[WallPotential] LJ10_4 applied." << std::endl; + } + +} diff --git a/src/plugins/WallPotential.h b/src/plugins/WallPotential.h index 6b2a4d05c3..9610b69c42 100755 --- a/src/plugins/WallPotential.h +++ b/src/plugins/WallPotential.h @@ -94,7 +94,7 @@ class WallPotential : public PluginBase{ }; void init(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, Domain* domain) override { - global_log -> debug() << "[WallPotential] Wall enabled" << std::endl; + Log::global_log -> debug() << "[WallPotential] Wall enabled" << std::endl; _domain = domain; } @@ -111,11 +111,11 @@ class WallPotential : public PluginBase{ static PluginBase* createInstance(){return new WallPotential();} - void initializeLJ93(const vector *components, double in_rhoWall, double in_sigWall, double in_epsWall, - vector in_xi, vector in_eta, double in_yOffWall, double in_yWallCut); + void initializeLJ93(const std::vector *components, double in_rhoWall, double in_sigWall, double in_epsWall, + std::vector in_xi, std::vector in_eta, double in_yOffWall, double in_yWallCut); - void initializeLJ1043(const vector *components, double in_rhoWall, double in_sigWall, double in_epsWall, - vector in_xi, vector in_eta, double in_yOffWall, double in_yWallCut); + void initializeLJ1043(const std::vector *components, double in_rhoWall, double in_sigWall, double in_epsWall, + std::vector in_xi, std::vector in_eta, double in_yOffWall, double in_yWallCut); void calcTSLJ_9_3(ParticleContainer *partContainer); diff --git a/src/plugins/compression.cpp b/src/plugins/compression.cpp index 0152b2fdbd..676ba1dc33 100644 --- a/src/plugins/compression.cpp +++ b/src/plugins/compression.cpp @@ -28,7 +28,7 @@ void Lz4Compression::compress(ByteIterator uncompressedStart, ByteIterator uncom &(*uncompressedStart), //input data begin of type char* temp.data()+sizeof(_compressedSize), //output data pointer of type char* uncompressedSize, //input data size (decltype of _uncompressedSize, usually size_t), imp. cast to int - temp.size()); //output data pointer of decltype(temp.size()), most probably size_t, imp. cast to int + temp.size()); //output data pointer of decltype(temp.size()), most probably size_t, imp. cast to int //following may throw (duh) if (actualCompressedSize == 0) { std::string const errormsg( diff --git a/src/plugins/compression.h b/src/plugins/compression.h index 54493ad9ef..f60f290035 100644 --- a/src/plugins/compression.h +++ b/src/plugins/compression.h @@ -22,7 +22,7 @@ * * The idea of this class is to provide a "drop-in" possibility to (de-)compress a std::vector, without worrying * about to much boiler plate code. The usage is simple, consider the following example: - * + * * \code{.cpp} * #include "compression.h" * std::unique_ptr comp = Compression::create("LZ4"); // Possible tags are "LZ4" and "None" atm @@ -46,7 +46,7 @@ class Compression { using ByteIterator = std::vector::iterator; /** * Compresses a series of bytes. - * + * * Call to compress data. * @param[in] uncompressedStart Iterator pointing to the start of the array to be compressed * @param[in] uncompressedEnd Iterator pointing to the element past the last element of the array to be compressed @@ -57,7 +57,7 @@ class Compression { virtual void compress(ByteIterator uncompressedStart, ByteIterator uncompressedEnd, std::vector& compressed) = 0; /** * Decompresses a series of bytes. - * + * * Call to decompress data. * @param[in] compressedStart Iterator pointing to the start of the array to be decompressed * @param[in] compressedEnd Iterator pointing to the element past the last element of the array to be decompressed @@ -69,7 +69,7 @@ class Compression { virtual void decompress(ByteIterator compressedStart, ByteIterator compressedEnd, std::vector& decompressed) = 0; /** * Returns the uncompressed size of the data. - * + * * Returns the uncompressed size of the data. This will only give sane results if either compression or decompression has * been attempted. Zero means that there is no data, or something went wrong during the processing calls. * @return Uncompressed size of data. Depending on if the instance was used for compression or decompression, this is the @@ -80,7 +80,7 @@ class Compression { }; /** * Returns the compressed size of the data. - * + * * Returns the compressed size of the data. This will only give sane results if either compression or decompression has * been attempted. Zero means that there is no data, or something went wrong during the processing calls. * @return Uncompressed size of data. Depending on if the instance was used for compression or decompression, this is the @@ -91,7 +91,7 @@ class Compression { }; /** * Create an instance of the Compression class. - * + * * Use this to instantiate an object which is able to do compression on arrays. The argument passed is a std::string * containing the tag of the compression algorithm. At the moment, this is just "LZ4" and "None". * If the tag is not recognized a nullptr will be returned. diff --git a/src/plugins/profiles/DOFProfile.cpp b/src/plugins/profiles/DOFProfile.cpp index 4238358ede..5b9ab6c6d5 100644 --- a/src/plugins/profiles/DOFProfile.cpp +++ b/src/plugins/profiles/DOFProfile.cpp @@ -1,13 +1,13 @@ -// -// Created by Kruegener on 10/22/2018. -// - -#include "DOFProfile.h" - -void DOFProfile::output(string prefix, long unsigned accumulatedDatasets) { - global_log->debug() << "[DOFProfile] has no output.\n"; -} - -void DOFProfile::writeDataEntry(unsigned long uID, ofstream &outfile) const { - global_log->debug() << "[DOFProfile] has no writeDataEntry.\n"; -} +// +// Created by Kruegener on 10/22/2018. +// + +#include "DOFProfile.h" + +void DOFProfile::output(std::string prefix, long unsigned accumulatedDatasets) { + Log::global_log->debug() << "[DOFProfile] has no output.\n"; +} + +void DOFProfile::writeDataEntry(unsigned long uID, std::ofstream &outfile) const { + Log::global_log->debug() << "[DOFProfile] has no writeDataEntry.\n"; +} diff --git a/src/plugins/profiles/DOFProfile.h b/src/plugins/profiles/DOFProfile.h index b80b7e6fae..ebf3212d6a 100644 --- a/src/plugins/profiles/DOFProfile.h +++ b/src/plugins/profiles/DOFProfile.h @@ -24,7 +24,7 @@ class DOFProfile final : public ProfileBase { void collectRetrieve(DomainDecompBase *domainDecomp, unsigned long uID) final { _globalProfile[uID] = domainDecomp->collCommGetInt(); } - void output(string prefix, long unsigned accumulatedDatasets) final; + void output(std::string prefix, long unsigned accumulatedDatasets) final; void reset(unsigned long uID) final { _localProfile[uID] = 0; _globalProfile[uID] = 0; @@ -41,7 +41,7 @@ class DOFProfile final : public ProfileBase { // Global 1D Profile std::map _globalProfile; - void writeDataEntry(unsigned long uID, ofstream &outfile) const final; + void writeDataEntry(unsigned long uID, std::ofstream &outfile) const final; }; diff --git a/src/plugins/profiles/DensityProfile.cpp b/src/plugins/profiles/DensityProfile.cpp index 428ed832e4..feca1294d6 100644 --- a/src/plugins/profiles/DensityProfile.cpp +++ b/src/plugins/profiles/DensityProfile.cpp @@ -5,13 +5,13 @@ #include "DensityProfile.h" -void DensityProfile::output(string prefix, long unsigned accumulatedDatasets) { - global_log->info() << "[DensityProfile] output" << std::endl; +void DensityProfile::output(std::string prefix, long unsigned accumulatedDatasets) { + Log::global_log->info() << "[DensityProfile] output" << std::endl; // Setup outfile _accumulatedDatasets = accumulatedDatasets; _profilePrefix = prefix + ".NDpr"; - ofstream outfile(_profilePrefix.c_str()); + std::ofstream outfile(_profilePrefix.c_str()); outfile.precision(6); // Write Header @@ -32,6 +32,6 @@ void DensityProfile::output(string prefix, long unsigned accumulatedDatasets) { outfile.close(); } -void DensityProfile::writeDataEntry (unsigned long uID, ofstream& outfile) const { +void DensityProfile::writeDataEntry (unsigned long uID, std::ofstream& outfile) const { outfile << (double) this->_globalProfile.at(uID) / (_samplInfo.segmentVolume * _accumulatedDatasets) << "\t"; } diff --git a/src/plugins/profiles/DensityProfile.h b/src/plugins/profiles/DensityProfile.h index eb6751ae73..f558612f29 100644 --- a/src/plugins/profiles/DensityProfile.h +++ b/src/plugins/profiles/DensityProfile.h @@ -23,7 +23,7 @@ class DensityProfile final : public ProfileBase { void collectRetrieve(DomainDecompBase *domainDecomp, unsigned long uID) final { _globalProfile[uID] = domainDecomp->collCommGetInt(); } - void output(string prefix, long unsigned accumulatedDatasets) final; + void output(std::string prefix, long unsigned accumulatedDatasets) final; void reset(unsigned long uID) final { _localProfile[uID] = 0; _globalProfile[uID] = 0; @@ -40,7 +40,7 @@ class DensityProfile final : public ProfileBase { // Global 1D Profile std::map _globalProfile; - void writeDataEntry(unsigned long uID, ofstream &outfile) const final; + void writeDataEntry(unsigned long uID, std::ofstream &outfile) const final; }; diff --git a/src/plugins/profiles/KineticProfile.cpp b/src/plugins/profiles/KineticProfile.cpp index fc325d5890..94782b4095 100644 --- a/src/plugins/profiles/KineticProfile.cpp +++ b/src/plugins/profiles/KineticProfile.cpp @@ -1,13 +1,13 @@ -// -// Created by Kruegener on 10/22/2018. -// - -#include "KineticProfile.h" - -void KineticProfile::output(string prefix, long unsigned accumulatedDatasets) { - global_log->info() << "[KineticProfile] has no output.\n"; -} - -void KineticProfile::writeDataEntry(unsigned long uID, ofstream &outfile) const { - global_log->debug() << "[KineticProfile] has no writeDataEntry.\n"; -} +// +// Created by Kruegener on 10/22/2018. +// + +#include "KineticProfile.h" + +void KineticProfile::output(std::string prefix, long unsigned accumulatedDatasets) { + Log::global_log->info() << "[KineticProfile] has no output.\n"; +} + +void KineticProfile::writeDataEntry(unsigned long uID, std::ofstream &outfile) const { + Log::global_log->debug() << "[KineticProfile] has no writeDataEntry.\n"; +} diff --git a/src/plugins/profiles/KineticProfile.h b/src/plugins/profiles/KineticProfile.h index 956d011ec8..7bd0b84f1a 100644 --- a/src/plugins/profiles/KineticProfile.h +++ b/src/plugins/profiles/KineticProfile.h @@ -26,7 +26,7 @@ class KineticProfile final : public ProfileBase { void collectRetrieve(DomainDecompBase *domainDecomp, unsigned long uID) final { _globalProfile[uID] = domainDecomp->collCommGetDouble(); } - void output(string prefix, long unsigned accumulatedDatasets) final; + void output(std::string prefix, long unsigned accumulatedDatasets) final; void reset(unsigned long uID) final { _localProfile[uID] = 0.0; _globalProfile[uID] = 0.0; @@ -43,7 +43,7 @@ class KineticProfile final : public ProfileBase { // Global 1D Profile std::map _globalProfile; - void writeDataEntry(unsigned long uID, ofstream &outfile) const final; + void writeDataEntry(unsigned long uID, std::ofstream &outfile) const final; }; diff --git a/src/plugins/profiles/ProfileBase.cpp b/src/plugins/profiles/ProfileBase.cpp index 20d7ff2287..3f685c23d5 100644 --- a/src/plugins/profiles/ProfileBase.cpp +++ b/src/plugins/profiles/ProfileBase.cpp @@ -5,7 +5,7 @@ #include "ProfileBase.h" #include "plugins/SpatialProfile.h" -void ProfileBase::writeMatrix (ofstream& outfile) { +void ProfileBase::writeMatrix (std::ofstream& outfile) { if (_samplInfo.cylinder) { writeCylMatrix(outfile); } else { @@ -13,7 +13,7 @@ void ProfileBase::writeMatrix (ofstream& outfile) { } } -void ProfileBase::writeKartMatrix (ofstream& outfile) { +void ProfileBase::writeKartMatrix (std::ofstream& outfile) { // Write Data // Assuming x = 1 -> projection along x axis // Z - axis label @@ -42,11 +42,11 @@ void ProfileBase::writeKartMatrix (ofstream& outfile) { } -void ProfileBase::writeSimpleMatrix (ofstream& outfile) { - global_log->error() << "SIMPLE MATRIX OUTPUT NOT IMPLEMENTED!\n"; +void ProfileBase::writeSimpleMatrix (std::ofstream& outfile) { + Log::global_log->error() << "SIMPLE MATRIX OUTPUT NOT IMPLEMENTED!\n"; } -void ProfileBase::writeCylMatrix (ofstream& outfile) { +void ProfileBase::writeCylMatrix (std::ofstream& outfile) { // Write Data // Assuming phi = 1 -> projection along phi axis // R2 - axis label @@ -71,4 +71,4 @@ void ProfileBase::writeCylMatrix (ofstream& outfile) { } outfile << "\n"; } -} \ No newline at end of file +} diff --git a/src/plugins/profiles/ProfileBase.h b/src/plugins/profiles/ProfileBase.h index 2247461b8e..35c2259be4 100644 --- a/src/plugins/profiles/ProfileBase.h +++ b/src/plugins/profiles/ProfileBase.h @@ -71,7 +71,7 @@ class ProfileBase { * @param prefix File prefix including the global _outputPrefix for all profiles and the current timestep. Should be * appended by some specific file ending for this specific profile. */ - virtual void output(string prefix, long unsigned accumulatedDatasets) = 0; + virtual void output(std::string prefix, long unsigned accumulatedDatasets) = 0; /** @brief Used to reset all array contents for a specific uID in order to start the next recording timeframe. * @@ -88,7 +88,7 @@ class ProfileBase { protected: // output file prefix - string _profilePrefix; + std::string _profilePrefix; SamplingInformation _samplInfo; long _accumulatedDatasets = -1; // Number of Datasets between output writes / profile resets // -1 if not set properly @@ -98,28 +98,28 @@ class ProfileBase { * @param uID unique ID of bin * @param outfile outfile to write to */ - virtual void writeDataEntry(unsigned long uID, ofstream& outfile) const = 0; + virtual void writeDataEntry(unsigned long uID, std::ofstream& outfile) const = 0; /**@brief Matrix writing routine to avoid code duplication * * @param outfile opened filestream from Profile */ - void writeMatrix(ofstream& outfile); + void writeMatrix(std::ofstream& outfile); - void writeKartMatrix(ofstream& outfile); + void writeKartMatrix(std::ofstream& outfile); /**@brief STUB for simple Matrix output without headers * * @param outfile opened filestream from Profile */ // TODO: implement if needed - void writeSimpleMatrix(ofstream& outfile); + void writeSimpleMatrix(std::ofstream& outfile); /**@brief cylinder Matrix output * * @param outfile opened filestream from Profile */ - void writeCylMatrix(ofstream& outfile); + void writeCylMatrix(std::ofstream& outfile); }; #endif //MARDYN_TRUNK_PROFILEBASE_H diff --git a/src/plugins/profiles/TemperatureProfile.cpp b/src/plugins/profiles/TemperatureProfile.cpp index ccb0c568de..1a57380af8 100644 --- a/src/plugins/profiles/TemperatureProfile.cpp +++ b/src/plugins/profiles/TemperatureProfile.cpp @@ -7,14 +7,14 @@ #include "KineticProfile.h" -void TemperatureProfile::output(string prefix, long unsigned accumulatedDatasets) { +void TemperatureProfile::output(std::string prefix, long unsigned accumulatedDatasets) { - global_log->info() << "[TemperatureProfile] output" << std::endl; + Log::global_log->info() << "[TemperatureProfile] output" << std::endl; // Generate Outfile _accumulatedDatasets = accumulatedDatasets; _profilePrefix = prefix + ".Temppr"; - ofstream outfile(_profilePrefix.c_str()); + std::ofstream outfile(_profilePrefix.c_str()); outfile.precision(6); // Write Header @@ -31,7 +31,7 @@ void TemperatureProfile::output(string prefix, long unsigned accumulatedDatasets outfile.close(); } -void TemperatureProfile::writeDataEntry(unsigned long uID, ofstream &outfile) const { +void TemperatureProfile::writeDataEntry(unsigned long uID, std::ofstream &outfile) const { int dofs = _dofProfile->getGlobalDOF(uID); if(dofs == 0){ outfile << 0.0 << "\t"; diff --git a/src/plugins/profiles/TemperatureProfile.h b/src/plugins/profiles/TemperatureProfile.h index 8d10fb8474..2a5a08a86c 100644 --- a/src/plugins/profiles/TemperatureProfile.h +++ b/src/plugins/profiles/TemperatureProfile.h @@ -29,7 +29,7 @@ class TemperatureProfile final : public ProfileBase { void collectRetrieve(DomainDecompBase *domainDecomp, unsigned long uID) final { _globalProfile[uID] = domainDecomp->collCommGetLongDouble(); } - void output(string prefix, long unsigned accumulatedDatasets) final; + void output(std::string prefix, long unsigned accumulatedDatasets) final; void reset(unsigned long uID) final { _localProfile[uID] = 0.0; _globalProfile[uID] = 0.0; @@ -45,7 +45,7 @@ class TemperatureProfile final : public ProfileBase { // Global 1D Profile std::map _globalProfile; - void writeDataEntry(unsigned long uID, ofstream &outfile) const final; + void writeDataEntry(unsigned long uID, std::ofstream &outfile) const final; }; diff --git a/src/plugins/profiles/Velocity3dProfile.cpp b/src/plugins/profiles/Velocity3dProfile.cpp index 1e178dcc1f..ab64122d37 100644 --- a/src/plugins/profiles/Velocity3dProfile.cpp +++ b/src/plugins/profiles/Velocity3dProfile.cpp @@ -6,14 +6,14 @@ #include "Velocity3dProfile.h" #include "DensityProfile.h" -void Velocity3dProfile::output(string prefix, long unsigned accumulatedDatasets) { - global_log->info() << "[Velocity3dProfile] output" << std::endl; +void Velocity3dProfile::output(std::string prefix, long unsigned accumulatedDatasets) { + Log::global_log->info() << "[Velocity3dProfile] output" << std::endl; // Setup outfile _accumulatedDatasets = accumulatedDatasets; _profilePrefix = prefix; _profilePrefix += ".V3Dpr"; - ofstream outfile(_profilePrefix.c_str()); + std::ofstream outfile(_profilePrefix.c_str()); outfile.precision(6); // Write header @@ -33,7 +33,7 @@ void Velocity3dProfile::output(string prefix, long unsigned accumulatedDatasets) } -void Velocity3dProfile::writeDataEntry (unsigned long uID, ofstream& outfile) const { +void Velocity3dProfile::writeDataEntry (unsigned long uID, std::ofstream& outfile) const { long double vd; // X - Y - Z output for (unsigned d = 0; d < 3; d++) { diff --git a/src/plugins/profiles/Velocity3dProfile.h b/src/plugins/profiles/Velocity3dProfile.h index 4135fa708d..4eade53e9f 100644 --- a/src/plugins/profiles/Velocity3dProfile.h +++ b/src/plugins/profiles/Velocity3dProfile.h @@ -36,7 +36,7 @@ class Velocity3dProfile final : public ProfileBase { _global3dProfile[uID][d] = domainDecomp->collCommGetDouble(); } } - void output(string prefix, long unsigned accumulatedDatasets) final; + void output(std::string prefix, long unsigned accumulatedDatasets) final; void reset(unsigned long uID) final { for(unsigned d = 0; d < 3; d++){ _local3dProfile[uID][d] = 0.0; @@ -54,7 +54,7 @@ class Velocity3dProfile final : public ProfileBase { // Global 3D Profile std::map> _global3dProfile; - void writeDataEntry(unsigned long uID, ofstream &outfile) const final; + void writeDataEntry(unsigned long uID, std::ofstream &outfile) const final; }; diff --git a/src/plugins/profiles/VelocityAbsProfile.cpp b/src/plugins/profiles/VelocityAbsProfile.cpp index 31542143ae..0806ecff17 100644 --- a/src/plugins/profiles/VelocityAbsProfile.cpp +++ b/src/plugins/profiles/VelocityAbsProfile.cpp @@ -5,13 +5,13 @@ #include "VelocityAbsProfile.h" #include "plugins/profiles/DensityProfile.h" -void VelocityAbsProfile::output(string prefix, long unsigned accumulatedDatasets) { - global_log->info() << "[VelocityAbsProfile] output" << std::endl; +void VelocityAbsProfile::output(std::string prefix, long unsigned accumulatedDatasets) { + Log::global_log->info() << "[VelocityAbsProfile] output" << std::endl; // Setup outfile _accumulatedDatasets = accumulatedDatasets; _profilePrefix = prefix + ".VAbspr"; - ofstream outfile(_profilePrefix.c_str()); + std::ofstream outfile(_profilePrefix.c_str()); outfile.precision(6); // Write header @@ -30,7 +30,7 @@ void VelocityAbsProfile::output(string prefix, long unsigned accumulatedDatasets outfile.close(); } -void VelocityAbsProfile::writeDataEntry (unsigned long uID, ofstream& outfile) const { +void VelocityAbsProfile::writeDataEntry (unsigned long uID, std::ofstream& outfile) const { // Check for division by 0 long double vd; int numberDensity = _densityProfile->getGlobalNumber(uID); diff --git a/src/plugins/profiles/VelocityAbsProfile.h b/src/plugins/profiles/VelocityAbsProfile.h index 034f09c129..b5218607ca 100644 --- a/src/plugins/profiles/VelocityAbsProfile.h +++ b/src/plugins/profiles/VelocityAbsProfile.h @@ -35,7 +35,7 @@ class VelocityAbsProfile final : public ProfileBase { void collectRetrieve(DomainDecompBase *domainDecomp, unsigned long uID) final { _globalProfile[uID] = domainDecomp->collCommGetDouble(); } - void output(string prefix, long unsigned accumulatedDatasets) final; + void output(std::string prefix, long unsigned accumulatedDatasets) final; void reset(unsigned long uID) final { _localProfile[uID] = 0.0; _globalProfile[uID] = 0.0; @@ -51,7 +51,7 @@ class VelocityAbsProfile final : public ProfileBase { // Global 1D Profile std::map _globalProfile; - void writeDataEntry(unsigned long uID, ofstream &outfile) const final; + void writeDataEntry(unsigned long uID, std::ofstream &outfile) const final; }; #endif //MARDYN_TRUNK_VELOCITYABSPROFILE_H diff --git a/src/plugins/profiles/Virial2DProfile.cpp b/src/plugins/profiles/Virial2DProfile.cpp index f3f216f9a0..695ddf538d 100644 --- a/src/plugins/profiles/Virial2DProfile.cpp +++ b/src/plugins/profiles/Virial2DProfile.cpp @@ -8,17 +8,17 @@ #include "KineticProfile.h" #include "../FixRegion.h" -void Virial2DProfile::output(string prefix, long unsigned accumulatedDatasets) { +void Virial2DProfile::output(std::string prefix, long unsigned accumulatedDatasets) { - global_log->info() << "[VirialProfile2D] output" << std::endl; + Log::global_log->info() << "[VirialProfile2D] output" << std::endl; // Setup outfile _accumulatedDatasets = accumulatedDatasets; _profilePrefix = prefix + ".Vipr"; - ofstream outfile(_profilePrefix.c_str()); + std::ofstream outfile(_profilePrefix.c_str()); outfile.precision(6); - - + + // Write Header outfile << "//Segment volume: " << _samplInfo.segmentVolume << "\n//Accumulated data sets: " << _accumulatedDatasets << "\n//Local profile of the partial pressures p = (px+py+pz)/3). Output file generated by the \"VirialProfile\" method, plugins/profiles. \n"; @@ -28,16 +28,16 @@ void Virial2DProfile::output(string prefix, long unsigned accumulatedDatasets) { outfile << "0 \t"; writeMatrix(outfile); - + outfile.close(); } - -void Virial2DProfile::writeDataEntry(unsigned long uID, ofstream &outfile) const { - - + +void Virial2DProfile::writeDataEntry(unsigned long uID, std::ofstream &outfile) const { + + // calculate global temperature double globalTemperature = global_simulation->getDomain()->getCurrentTemperature(0); - + //calculate global temperature if fixedRegion is applied unsigned long numMolFixRegion = _samplInfo.numMolFixRegion; double globalTemperatureFixRegion = globalTemperature * _samplInfo.globalNumMolecules / (_samplInfo.globalNumMolecules - numMolFixRegion); @@ -45,7 +45,7 @@ void Virial2DProfile::writeDataEntry(unsigned long uID, ofstream &outfile) const long double virial2Dx = 0.0; long double virial2Dy = 0.0; long double virial2Dz = 0.0; - + long double N = _densityProfile->getGlobalNumber(uID); long double Px = this->_global3dProfile.at(uID)[0]; long double Py = this->_global3dProfile.at(uID)[1]; @@ -53,8 +53,8 @@ void Virial2DProfile::writeDataEntry(unsigned long uID, ofstream &outfile) const virial2Dx = (globalTemperatureFixRegion* N + Px)/(_samplInfo.segmentVolume * _accumulatedDatasets); virial2Dy = (globalTemperatureFixRegion* N + Py)/(_samplInfo.segmentVolume * _accumulatedDatasets); - virial2Dz = (globalTemperatureFixRegion* N + Pz)/(_samplInfo.segmentVolume * _accumulatedDatasets); - + virial2Dz = (globalTemperatureFixRegion* N + Pz)/(_samplInfo.segmentVolume * _accumulatedDatasets); + outfile << (virial2Dx + virial2Dy + virial2Dz)/3 << "\t"; } diff --git a/src/plugins/profiles/Virial2DProfile.h b/src/plugins/profiles/Virial2DProfile.h index 98dce5225b..89d6ed005c 100644 --- a/src/plugins/profiles/Virial2DProfile.h +++ b/src/plugins/profiles/Virial2DProfile.h @@ -21,8 +21,8 @@ class Virial2DProfile final : public ProfileBase { } ~Virial2DProfile() final = default; - - + + void record(Molecule& mol, unsigned long uID) final { for (unsigned short d = 0; d < 3; d++) { _local3dProfile[uID][d] += mol.Vi(d); @@ -42,7 +42,7 @@ class Virial2DProfile final : public ProfileBase { } - void output(string prefix, long unsigned accumulatedDatasets) final; + void output(std::string prefix, long unsigned accumulatedDatasets) final; void reset(unsigned long uID) final { for (unsigned d = 0; d < 3; d++) { @@ -64,7 +64,7 @@ class Virial2DProfile final : public ProfileBase { std::map> _global3dProfile; // Only needed because its abstract, all output handled by output() - void writeDataEntry(unsigned long uID, ofstream& outfile) const final; + void writeDataEntry(unsigned long uID, std::ofstream& outfile) const final; }; diff --git a/src/plugins/profiles/VirialProfile.cpp b/src/plugins/profiles/VirialProfile.cpp index c7f8883bdd..adba3c3506 100644 --- a/src/plugins/profiles/VirialProfile.cpp +++ b/src/plugins/profiles/VirialProfile.cpp @@ -5,14 +5,14 @@ #include "VirialProfile.h" #include "DensityProfile.h" -void VirialProfile::output(string prefix, long unsigned accumulatedDatasets) { +void VirialProfile::output(std::string prefix, long unsigned accumulatedDatasets) { - global_log->info() << "[VirialProfile] output" << std::endl; + Log::global_log->info() << "[VirialProfile] output" << std::endl; // Setup outfile _accumulatedDatasets = accumulatedDatasets; _profilePrefix = prefix + "_1D-Y.Vipr"; - ofstream outfile(_profilePrefix.c_str()); + std::ofstream outfile(_profilePrefix.c_str()); outfile.precision(6); // Write Header diff --git a/src/plugins/profiles/VirialProfile.h b/src/plugins/profiles/VirialProfile.h index cb3154740d..808c6fb875 100644 --- a/src/plugins/profiles/VirialProfile.h +++ b/src/plugins/profiles/VirialProfile.h @@ -47,7 +47,7 @@ class VirialProfile : public ProfileBase { * @param prefix * @param accumulatedDatasets */ - void output(string prefix, long unsigned accumulatedDatasets) final; + void output(std::string prefix, long unsigned accumulatedDatasets) final; void reset(unsigned long uID) final { for (unsigned d = 0; d < 3; d++) { @@ -67,7 +67,7 @@ class VirialProfile : public ProfileBase { std::map> _global3dProfile; // Only needed because its abstract, all output handled by output() - void writeDataEntry(unsigned long uID, ofstream& outfile) const final {}; + void writeDataEntry(unsigned long uID, std::ofstream& outfile) const final {}; }; diff --git a/src/plugins/tests/COMalignerTest.cpp b/src/plugins/tests/COMalignerTest.cpp index b0b3daabb0..00136a8a82 100755 --- a/src/plugins/tests/COMalignerTest.cpp +++ b/src/plugins/tests/COMalignerTest.cpp @@ -1,59 +1,59 @@ -// -// Created by kruegener on 5/31/2018. -// - -#include "COMalignerTest.h" - -TEST_SUITE_REGISTRATION(COMalignerTest); - -COMalignerTest::COMalignerTest() {} - -COMalignerTest::~COMalignerTest() {} - -void COMalignerTest::testCOMalign() { - - if (_domainDecomposition->getNumProcs() >= 10){ - test_log -> info() << "COMalignerTest::testCOMalign: SKIPPED (required fewer than 10 processes but was run with " << _domainDecomposition->getNumProcs() << " => bounding box of test setup is too small to support decomposition)" << std::endl; - return; - } - - const char* filename = "1clj-regular-2x2x2-offset.inp"; - double cutoff = .5; - std::unique_ptr container{ - initializeFromFile(ParticleContainerFactory::LinkedCell, filename, cutoff)}; - - std::unique_ptr plugin {new COMaligner()}; - - plugin->init(container.get(), _domainDecomposition, _domain); - plugin->beforeForces(container.get(), _domainDecomposition, 1); - - double m = plugin->_mass; - if (_domainDecomposition->getNumProcs() != 1) { - test_log->info() << "COMalignerTest::testCOMalign: Mass Check SKIPPED (required exactly 1 process but was run with " << _domainDecomposition->getNumProcs() << " processes)" << std::endl; - } - else{ - double expectedMass; - expectedMass = 8.0; - ASSERT_EQUAL_MSG("Mass does not match number of particles", expectedMass, m); - } - - // TEST MOTION - ASSERT_EQUAL_MSG("x motion is wrong", -.25, plugin->_motion[0]); - ASSERT_EQUAL_MSG("y motion is wrong", -.25, plugin->_motion[1]); - ASSERT_EQUAL_MSG("z motion is wrong", -.25, plugin->_motion[2]); - - // initialize oldContainer only now, to prevent it from interfering with anything relevant! - std::unique_ptr oldContainer{ - initializeFromFile(ParticleContainerFactory::LinkedCell, filename, cutoff)}; - // TEST IF MOTION WAS APPLIED - auto newPos = container->iterator(ParticleIterator::ONLY_INNER_AND_BOUNDARY); - auto oldPos = oldContainer->iterator(ParticleIterator::ONLY_INNER_AND_BOUNDARY); - while(newPos.isValid()){ - for(int d = 0; d < 3; d++){ - ASSERT_EQUAL_MSG("Motion has not been properly applied" ,oldPos->r(d) - .25, newPos->r(d)); - } - ++newPos; - ++oldPos; - } - -} +// +// Created by kruegener on 5/31/2018. +// + +#include "COMalignerTest.h" + +TEST_SUITE_REGISTRATION(COMalignerTest); + +COMalignerTest::COMalignerTest() {} + +COMalignerTest::~COMalignerTest() {} + +void COMalignerTest::testCOMalign() { + + if (_domainDecomposition->getNumProcs() >= 10){ + test_log -> info() << "COMalignerTest::testCOMalign: SKIPPED (required fewer than 10 processes but was run with " << _domainDecomposition->getNumProcs() << " => bounding box of test setup is too small to support decomposition)" << std::endl; + return; + } + + const char* filename = "1clj-regular-2x2x2-offset.inp"; + double cutoff = .5; + std::unique_ptr container{ + initializeFromFile(ParticleContainerFactory::LinkedCell, filename, cutoff)}; + + std::unique_ptr plugin {new COMaligner()}; + + plugin->init(container.get(), _domainDecomposition, _domain); + plugin->beforeForces(container.get(), _domainDecomposition, 1); + + double m = plugin->_mass; + if (_domainDecomposition->getNumProcs() != 1) { + test_log->info() << "COMalignerTest::testCOMalign: Mass Check SKIPPED (required exactly 1 process but was run with " << _domainDecomposition->getNumProcs() << " processes)" << std::endl; + } + else{ + double expectedMass; + expectedMass = 8.0; + ASSERT_EQUAL_MSG("Mass does not match number of particles", expectedMass, m); + } + + // TEST MOTION + ASSERT_EQUAL_MSG("x motion is wrong", -.25, plugin->_motion[0]); + ASSERT_EQUAL_MSG("y motion is wrong", -.25, plugin->_motion[1]); + ASSERT_EQUAL_MSG("z motion is wrong", -.25, plugin->_motion[2]); + + // initialize oldContainer only now, to prevent it from interfering with anything relevant! + std::unique_ptr oldContainer{ + initializeFromFile(ParticleContainerFactory::LinkedCell, filename, cutoff)}; + // TEST IF MOTION WAS APPLIED + auto newPos = container->iterator(ParticleIterator::ONLY_INNER_AND_BOUNDARY); + auto oldPos = oldContainer->iterator(ParticleIterator::ONLY_INNER_AND_BOUNDARY); + while(newPos.isValid()){ + for(int d = 0; d < 3; d++){ + ASSERT_EQUAL_MSG("Motion has not been properly applied" ,oldPos->r(d) - .25, newPos->r(d)); + } + ++newPos; + ++oldPos; + } + +} diff --git a/src/plugins/tests/DensityControlTest.cpp b/src/plugins/tests/DensityControlTest.cpp index d267e940ad..39ed00e556 100755 --- a/src/plugins/tests/DensityControlTest.cpp +++ b/src/plugins/tests/DensityControlTest.cpp @@ -1,5 +1,7 @@ #include "DensityControlTest.h" +#include + #include "utils/Testing.h" #include "utils/CommVar.h" diff --git a/src/plugins/tests/compressionTest.cpp b/src/plugins/tests/compressionTest.cpp index d24f5e4049..44e3eead64 100755 --- a/src/plugins/tests/compressionTest.cpp +++ b/src/plugins/tests/compressionTest.cpp @@ -1,122 +1,122 @@ -// -// Created by fernanor on 2018-12-13 -// - -#include "compressionTest.h" - - -TEST_SUITE_REGISTRATION(compressionTest); - -compressionTest::compressionTest() {} - -compressionTest::~compressionTest() {} - -void compressionTest::testNone() { - std::unique_ptr compInstance = Compression::create("None"); - ASSERT_TRUE(compInstance.get()); - - constexpr size_t datasize = 1024*1024; - std::vector someData(datasize); - std::mt19937 gen(0); - std::uniform_int_distribution<> charsonly(0, 255); - for (auto& elem : someData) { - elem = charsonly(gen); - } - std::vector compressedData; - std::vector decompressedData; - - //compression - compInstance->compress(someData.begin(), someData.end(), compressedData); - size_t correctUncompressedSize = datasize; - size_t correctCompressedSize = datasize; - ASSERT_EQUAL(someData.size(), compInstance->getUncompressedSize()); - ASSERT_EQUAL(correctUncompressedSize, compInstance->getUncompressedSize()); - ASSERT_EQUAL(compressedData.size(), compInstance->getCompressedSize()); - ASSERT_EQUAL(correctCompressedSize, compInstance->getCompressedSize()); - - //decompression - compInstance->decompress(compressedData.begin(), compressedData.end(), decompressedData); - ASSERT_EQUAL(correctUncompressedSize, decompressedData.size()); - - //assert symmetry - for (auto i=0; i compInstance = Compression::create("LZ4"); - ASSERT_TRUE(compInstance.get()); - - constexpr size_t datasize = 1024*1024; - std::vector someData(datasize); - //fill input with random data - std::mt19937 gen(0); - std::uniform_int_distribution<> charsonly(0, 255); - for (auto& elem : someData) { - elem = charsonly(gen); - } - std::vector compressedData; - std::vector decompressedData; - - //compression - compInstance->compress(someData.begin(), someData.end(), compressedData); - size_t correctUncompressedSize = datasize; - ASSERT_EQUAL(someData.size(), compInstance->getUncompressedSize()); - ASSERT_EQUAL(correctUncompressedSize, compInstance->getUncompressedSize()); - ASSERT_EQUAL(compressedData.size(), compInstance->getCompressedSize()); //this is actually larger than uncompressed, Kudos to mt19937 entropy :P - - //decompression - compInstance->decompress(compressedData.begin(), compressedData.end(), decompressedData); - ASSERT_EQUAL(correctUncompressedSize, decompressedData.size()); - - // assert symmetry - for (auto i=0; i compInstance = Compression::create("LZ4"); - ASSERT_TRUE(compInstance.get()); - - constexpr size_t datasize = 1024*1024; - std::vector someData(datasize); - // fill with 4 full sine periods - constexpr double dphi = 8.*M_PI/datasize; - int t = 0; - for (auto& elem : someData) { - elem = static_cast(sin(dphi*t++/datasize)*127.); - } - std::vector compressedData; - std::vector decompressedData; - - //compression - compInstance->compress(someData.begin(), someData.end(), compressedData); - size_t correctUncompressedSize = datasize; - ASSERT_EQUAL(someData.size(), compInstance->getUncompressedSize()); - ASSERT_EQUAL(correctUncompressedSize, compInstance->getUncompressedSize()); - ASSERT_EQUAL(compressedData.size(), compInstance->getCompressedSize()); - - //decompression - compInstance->decompress(compressedData.begin(), compressedData.end(), decompressedData); - ASSERT_EQUAL(correctUncompressedSize, decompressedData.size()); - - // assert symmetry - for (auto i=0; i compInstance = Compression::create("FailMe"); - } - catch (const std::invalid_argument& ia) { - std::string const correctMsg("CompressionWrapper error > Invalid encoding: FailMe"); - std::string const exceptionMsg(ia.what()); - ASSERT_EQUAL(correctMsg, exceptionMsg); - } -} \ No newline at end of file +// +// Created by fernanor on 2018-12-13 +// + +#include "compressionTest.h" + + +TEST_SUITE_REGISTRATION(compressionTest); + +compressionTest::compressionTest() {} + +compressionTest::~compressionTest() {} + +void compressionTest::testNone() { + std::unique_ptr compInstance = Compression::create("None"); + ASSERT_TRUE(compInstance.get()); + + constexpr size_t datasize = 1024*1024; + std::vector someData(datasize); + std::mt19937 gen(0); + std::uniform_int_distribution<> charsonly(0, 255); + for (auto& elem : someData) { + elem = charsonly(gen); + } + std::vector compressedData; + std::vector decompressedData; + + //compression + compInstance->compress(someData.begin(), someData.end(), compressedData); + size_t correctUncompressedSize = datasize; + size_t correctCompressedSize = datasize; + ASSERT_EQUAL(someData.size(), compInstance->getUncompressedSize()); + ASSERT_EQUAL(correctUncompressedSize, compInstance->getUncompressedSize()); + ASSERT_EQUAL(compressedData.size(), compInstance->getCompressedSize()); + ASSERT_EQUAL(correctCompressedSize, compInstance->getCompressedSize()); + + //decompression + compInstance->decompress(compressedData.begin(), compressedData.end(), decompressedData); + ASSERT_EQUAL(correctUncompressedSize, decompressedData.size()); + + //assert symmetry + for (auto i=0; i compInstance = Compression::create("LZ4"); + ASSERT_TRUE(compInstance.get()); + + constexpr size_t datasize = 1024*1024; + std::vector someData(datasize); + //fill input with random data + std::mt19937 gen(0); + std::uniform_int_distribution<> charsonly(0, 255); + for (auto& elem : someData) { + elem = charsonly(gen); + } + std::vector compressedData; + std::vector decompressedData; + + //compression + compInstance->compress(someData.begin(), someData.end(), compressedData); + size_t correctUncompressedSize = datasize; + ASSERT_EQUAL(someData.size(), compInstance->getUncompressedSize()); + ASSERT_EQUAL(correctUncompressedSize, compInstance->getUncompressedSize()); + ASSERT_EQUAL(compressedData.size(), compInstance->getCompressedSize()); //this is actually larger than uncompressed, Kudos to mt19937 entropy :P + + //decompression + compInstance->decompress(compressedData.begin(), compressedData.end(), decompressedData); + ASSERT_EQUAL(correctUncompressedSize, decompressedData.size()); + + // assert symmetry + for (auto i=0; i compInstance = Compression::create("LZ4"); + ASSERT_TRUE(compInstance.get()); + + constexpr size_t datasize = 1024*1024; + std::vector someData(datasize); + // fill with 4 full sine periods + constexpr double dphi = 8.*M_PI/datasize; + int t = 0; + for (auto& elem : someData) { + elem = static_cast(sin(dphi*t++/datasize)*127.); + } + std::vector compressedData; + std::vector decompressedData; + + //compression + compInstance->compress(someData.begin(), someData.end(), compressedData); + size_t correctUncompressedSize = datasize; + ASSERT_EQUAL(someData.size(), compInstance->getUncompressedSize()); + ASSERT_EQUAL(correctUncompressedSize, compInstance->getUncompressedSize()); + ASSERT_EQUAL(compressedData.size(), compInstance->getCompressedSize()); + + //decompression + compInstance->decompress(compressedData.begin(), compressedData.end(), decompressedData); + ASSERT_EQUAL(correctUncompressedSize, decompressedData.size()); + + // assert symmetry + for (auto i=0; i compInstance = Compression::create("FailMe"); + } + catch (const std::invalid_argument& ia) { + std::string const correctMsg("CompressionWrapper error > Invalid encoding: FailMe"); + std::string const exceptionMsg(ia.what()); + ASSERT_EQUAL(correctMsg, exceptionMsg); + } +} diff --git a/src/steereoCommands/snapshotCommand.h b/src/steereoCommands/snapshotCommand.h index 8517839096..d77df8bd56 100644 --- a/src/steereoCommands/snapshotCommand.h +++ b/src/steereoCommands/snapshotCommand.h @@ -6,7 +6,7 @@ #include -class SnapshotCommand : public SteereoCommand +class SnapshotCommand : public SteereoCommand { public: SnapshotCommand (); @@ -15,17 +15,17 @@ class SnapshotCommand : public SteereoCommand void setParameters (std::list params); static void setSimData (Simulation* simu) {sim = simu;}; static SteereoCommand* generateNewInstance (); - + bool condition (); void setStepInterval (int interval) {stepInterval = interval;}; - - + + private: // parameters needed for execution int sockfd; static Simulation* sim; static int startStep; - int stepInterval; + int stepInterval; bool sendVelocity; bool sendForces; bool sendV2; diff --git a/src/tests/MarDynInitOptionsTest.cpp b/src/tests/MarDynInitOptionsTest.cpp index c0c361f679..0a3663fe91 100644 --- a/src/tests/MarDynInitOptionsTest.cpp +++ b/src/tests/MarDynInitOptionsTest.cpp @@ -10,7 +10,6 @@ #include -using namespace std; TEST_SUITE_REGISTRATION(MarDynInitOptionsTest); diff --git a/src/thermostats/TemperatureControl.cpp b/src/thermostats/TemperatureControl.cpp index b783dc5329..ce91a2e65f 100644 --- a/src/thermostats/TemperatureControl.cpp +++ b/src/thermostats/TemperatureControl.cpp @@ -24,7 +24,6 @@ #include #include -using namespace std; // init static ID --> instance counting unsigned short ControlRegionT::_nStaticID = 0; @@ -105,7 +104,7 @@ void ControlRegionT::readXML(XMLfileUnits& xmlconfig) { for (uint8_t d = 0; d < 3; ++d) uc[d] = (strVal[d] == "box") ? domain->getGlobalLength(d) : atof(strVal[d].c_str()); #ifndef NDEBUG - global_log->info() << "TemperatureControl: upper corner: " << uc[0] << ", " << uc[1] << ", " << uc[2] << endl; + Log::global_log->info() << "TemperatureControl: upper corner: " << uc[0] << ", " << uc[1] << ", " << uc[2] << std::endl; #endif for (uint8_t d = 0; d < 3; ++d) { @@ -141,7 +140,7 @@ void ControlRegionT::readXML(XMLfileUnits& xmlconfig) { bRet = bRet && xmlconfig.getNodeValue("target/ramp/update/freq", _ramp.update.freq); if (bRet) { _ramp.enabled = true; - global_log->info() << "[TemperatureControl] REGION " << _nStaticID + Log::global_log->info() << "[TemperatureControl] REGION " << _nStaticID << ": Temperature ramp enabled with start=" << _ramp.start << ", end=" << _ramp.end << ", update.start=" << _ramp.update.start << ", update.stop=" << _ramp.update.stop << ", update.freq=" << _ramp.update.freq << std::endl; @@ -166,15 +165,15 @@ void ControlRegionT::readXML(XMLfileUnits& xmlconfig) { _timestep = global_simulation->getIntegrator()->getTimestepLength(); _nuDt = _nuAndersen * _timestep; } else { - global_log->error() << "[TemperatureControl] REGION: Invalid 'method' param: " << methods << std::endl; + Log::global_log->error() << "[TemperatureControl] REGION: Invalid 'method' param: " << methods << std::endl; Simulation::exit(-1); } - global_log->info() << "[TemperatureControl] REGION 'method' param: " << methods << std::endl; + Log::global_log->info() << "[TemperatureControl] REGION 'method' param: " << methods << std::endl; } // else { _localMethod = VelocityScaling; - global_log->info() << "[TemperatureControl] REGION: no method specified, selecting VelocityScaling" + Log::global_log->info() << "[TemperatureControl] REGION: no method specified, selecting VelocityScaling" << std::endl; // init data structures @@ -190,7 +189,7 @@ void ControlRegionT::VelocityScalingInit(XMLfileUnits& xmlconfig, std::string st // settings xmlconfig.getNodeValue("settings/numslabs", _nNumSlabs); if (_nNumSlabs < 1) { - global_log->fatal() << "TemperatureControl: need at least one slab! (settings/numslabs)"; + Log::global_log->fatal() << "TemperatureControl: need at least one slab! (settings/numslabs)"; Simulation::exit(932); } xmlconfig.getNodeValue("settings/exponent", _dTemperatureExponent); @@ -206,7 +205,7 @@ void ControlRegionT::VelocityScalingInit(XMLfileUnits& xmlconfig, std::string st xmlconfig.getNodeValue("writefreq", _nWriteFreqBeta); xmlconfig.getNodeValue("fileprefix", _strFilenamePrefixBetaLog); if (_nWriteFreqBeta == 0) { - global_log->warning() + Log::global_log->warning() << "Temperature Control: write Frequency was specified to be zero. This is NOT allowed. Reset it to 1000." << std::endl; _nWriteFreqBeta = 1000; @@ -416,7 +415,7 @@ void ControlRegionT::ControlTemperature(Molecule* mol) { } } } else { - global_log->error() << "[TemperatureControl] Invalid localMethod param: " << _localMethod << std::endl; + Log::global_log->error() << "[TemperatureControl] Invalid localMethod param: " << _localMethod << std::endl; Simulation::exit(-1); } } @@ -442,9 +441,9 @@ void ControlRegionT::InitBetaLogfile() { const std::string fname = _strFilenamePrefixBetaLog + "_reg" + std::to_string(this->GetID()) + ".dat"; std::ofstream ofs; ofs.open(fname, std::ios::out); - ofs << setw(12) << "simstep" - << setw(24) << "dBetaTrans" - << setw(24) << "dBetaRot" + ofs << std::setw(12) << "simstep" + << std::setw(24) << "dBetaTrans" + << std::setw(24) << "dBetaRot" << std::endl; ofs.close(); } @@ -474,7 +473,7 @@ void ControlRegionT::WriteBetaLogfile(unsigned long simstep) { const std::string fname = _strFilenamePrefixBetaLog + "_reg" + std::to_string(this->GetID()) + ".dat"; std::ofstream ofs; ofs.open(fname, std::ios::app); - ofs << setw(12) << simstep + ofs << std::setw(12) << simstep << FORMAT_SCI_MAX_DIGITS << dBetaTrans << FORMAT_SCI_MAX_DIGITS << dBetaRot << std::endl; @@ -503,8 +502,8 @@ void ControlRegionT::registerAsObserver() { if (distControl != nullptr) distControl->registerObserver(this); else { - global_log->error() << "TemperatureControl->region[" << this->GetID() - << "]: Initialization of plugin DistControl is needed before! Program exit..." << endl; + Log::global_log->error() << "TemperatureControl->region[" << this->GetID() + << "]: Initialization of plugin DistControl is needed before! Program exit..." << std::endl; Simulation::exit(-1); } } @@ -528,10 +527,10 @@ void ControlRegionT::InitAddedEkin() { const std::string fname = "addedEkin_reg" + std::to_string(this->GetID()) + "_cid" + std::to_string(_nTargetComponentID) + ".dat"; std::ofstream ofs; ofs.open(fname, std::ios::out); - ofs << setw(12) << "simstep"; + ofs << std::setw(12) << "simstep"; for (int i = 0; i < _nNumSlabs; ++i) { std::string s = "bin" + std::to_string(i+1); - ofs << setw(24) << s; + ofs << std::setw(24) << s; } ofs << std::endl; ofs.close(); @@ -580,8 +579,8 @@ void ControlRegionT::writeAddedEkin(DomainDecompBase* domainDecomp, const uint64 const std::string fname = "addedEkin_reg" + std::to_string(this->GetID()) + "_cid" + std::to_string(_nTargetComponentID) + ".dat"; std::ofstream ofs; ofs.open(fname, std::ios::app); - - ofs << setw(12) << simstep; + + ofs << std::setw(12) << simstep; for (double& it : vg) { ofs << FORMAT_SCI_MAX_DIGITS << it; } @@ -603,9 +602,9 @@ void TemperatureControl::readXML(XMLfileUnits& xmlconfig) { xmlconfig.getNodeValue("control/start", _nStart); xmlconfig.getNodeValue("control/frequency", _nControlFreq); xmlconfig.getNodeValue("control/stop", _nStop); - global_log->info() << "Start control from simstep: " << _nStart << endl; - global_log->info() << "Control with frequency: " << _nControlFreq << endl; - global_log->info() << "Stop control at simstep: " << _nStop << endl; + Log::global_log->info() << "Start control from simstep: " << _nStart << std::endl; + Log::global_log->info() << "Control with frequency: " << _nControlFreq << std::endl; + Log::global_log->info() << "Stop control at simstep: " << _nStop << std::endl; // turn on/off explosion heuristics // domain->setExplosionHeuristics(bUseExplosionHeuristics); @@ -614,11 +613,11 @@ void TemperatureControl::readXML(XMLfileUnits& xmlconfig) { uint32_t numRegions = 0; XMLfile::Query query = xmlconfig.query("regions/region"); numRegions = query.card(); - global_log->info() << "Number of control regions: " << numRegions << endl; + Log::global_log->info() << "Number of control regions: " << numRegions << std::endl; if (numRegions < 1) { - global_log->warning() << "No region parameters specified." << endl; + Log::global_log->warning() << "No region parameters specified." << std::endl; } - string oldpath = xmlconfig.getcurrentnodepath(); + std::string oldpath = xmlconfig.getcurrentnodepath(); XMLfile::Query::const_iterator outputRegionIter; for (outputRegionIter = query.begin(); outputRegionIter; outputRegionIter++) { xmlconfig.changecurrentnode(outputRegionIter); @@ -638,13 +637,13 @@ void TemperatureControl::readXML(XMLfileUnits& xmlconfig) { } if (Vel && And) { _method = Mixed; - global_log->info() << "[TemperatureControl] Mixed methods across regions\n"; + Log::global_log->info() << "[TemperatureControl] Mixed methods across regions\n"; } else if (!Vel && And) { _method = Andersen; - global_log->info() << "[TemperatureControl] Andersen in all regions\n"; + Log::global_log->info() << "[TemperatureControl] Andersen in all regions\n"; } else { _method = VelocityScaling; - global_log->info() << "[TemperatureControl] VelocityControl in all regions\n"; + Log::global_log->info() << "[TemperatureControl] VelocityControl in all regions\n"; } } @@ -715,7 +714,7 @@ void TemperatureControl::DoLoopsOverMolecules(DomainDecompBase* domainDecomposit ParticleContainer* particleContainer, const unsigned long simstep) { if (_method == VelocityScaling || _method == Mixed) { this->VelocityScalingPreparation(domainDecomposition, particleContainer, simstep); - global_log->debug() << "[TemperatureControl] VelocityScalingPreparation\n"; + Log::global_log->debug() << "[TemperatureControl] VelocityScalingPreparation\n"; } // iterate over all molecules. ControlTemperature depends on _localMethod for Region molecule is in diff --git a/src/thermostats/VelocityScalingThermostat.cpp b/src/thermostats/VelocityScalingThermostat.cpp index 6d1339d51c..e93e2a8370 100644 --- a/src/thermostats/VelocityScalingThermostat.cpp +++ b/src/thermostats/VelocityScalingThermostat.cpp @@ -6,8 +6,6 @@ #include "utils/Logger.h" #include "particleContainer/ParticleContainer.h" -using namespace std; -using Log::global_log; VelocityScalingThermostat::VelocityScalingThermostat() { this->_globalBetaTrans = 1.0; @@ -54,7 +52,7 @@ void VelocityScalingThermostat::apply(ParticleContainer *moleculeContainer) { betaTrans = _componentBetaTrans[thermostatId]; betaRot = _componentBetaRot[thermostatId]; - map::iterator vIter; + std::map::iterator vIter; if( (vIter = _componentVelocity.find(thermostatId)) != _componentVelocity.end()) { molecule->scale_v(betaTrans); } @@ -74,8 +72,8 @@ void VelocityScalingThermostat::apply(ParticleContainer *moleculeContainer) { { double betaTrans = _globalBetaTrans; double betaRot = _globalBetaRot; - global_log->debug() << "Beta rot: " << betaRot << endl; - global_log->debug() << "Beta trans: " << betaTrans << endl; + Log::global_log->debug() << "Beta rot: " << betaRot << std::endl; + Log::global_log->debug() << "Beta trans: " << betaTrans << std::endl; for (auto i = moleculeContainer->iterator(ParticleIterator::ONLY_INNER_AND_BOUNDARY); i.isValid(); ++i) { if(this->_useGlobalVelocity) { diff --git a/src/utils/DynAlloc.h b/src/utils/DynAlloc.h index 91bec49df2..995dd64d04 100644 --- a/src/utils/DynAlloc.h +++ b/src/utils/DynAlloc.h @@ -10,7 +10,6 @@ #include #include -using namespace std; // leak save dynamic memory allocation inline void AllocateUnsLongArray(unsigned long* &ptr, const unsigned int& nSize) diff --git a/src/utils/Expression.cpp b/src/utils/Expression.cpp index 0fe1e37026..c65317e949 100644 --- a/src/utils/Expression.cpp +++ b/src/utils/Expression.cpp @@ -7,7 +7,6 @@ #include "Expression.h" -using namespace std; bool Expression::Value::operator==(Value const& v) const @@ -128,11 +127,11 @@ const Expression::Value Expression::Value::operator/(Value const& v) const } -Expression::Variable* Expression::VariableSet::addVariable(const string& name) +Expression::Variable* Expression::VariableSet::addVariable(const std::string& name) { - string vgrpname,varname(name); + std::string vgrpname,varname(name); size_t colonpos=name.find(":"); - if(colonpos!=string::npos) + if(colonpos!=std::string::npos) { vgrpname=name.substr(0,colonpos); varname=name.substr(colonpos+1); @@ -140,14 +139,14 @@ Expression::Variable* Expression::VariableSet::addVariable(const string& name) if(!existVariableGroup(vgrpname)) { // create variable group //_vargroups[vgrpname]=VariableGroup(vgrpname); - _vargroups.insert(pair(vgrpname,VariableGroup(vgrpname))); + _vargroups.insert(std::pair(vgrpname,VariableGroup(vgrpname))); } //_variables[name]=Variable(varname,&_vargroups[vgrpname],val); - _variables.insert(pair(name,Variable(varname,&_vargroups[vgrpname]))); + _variables.insert(std::pair(name,Variable(varname,&_vargroups[vgrpname]))); return &_variables[name]; } -bool Expression::VariableSet::removeVariable(const string& name) +bool Expression::VariableSet::removeVariable(const std::string& name) { Variable* var=getVariable(name); if(var) @@ -168,7 +167,7 @@ bool Expression::VariableSet::removeVariable(const string& name) -void Expression::Node::traverse(list& nodelist, enum Etraversetype traversetype) const +void Expression::Node::traverse(std::list& nodelist, enum Etraversetype traversetype) const { switch(traversetype) { @@ -190,7 +189,7 @@ void Expression::Node::traverse(list& nodelist, enum Etraversetype } } -void Expression::Node::writeSubExpr(ostream& ostrm, enum Etraversetype traversetype, char sep) const +void Expression::Node::writeSubExpr(std::ostream& ostrm, enum Etraversetype traversetype, char sep) const { switch(traversetype) { @@ -464,7 +463,7 @@ Expression::Value Expression::NodeFunction::evaluate() const return Value(); } -void Expression::NodeFunction::write(ostream& ostrm) const { +void Expression::NodeFunction::write(std::ostream& ostrm) const { switch(_functype) { // case functypeNONE: ostrm << "undef"; break; @@ -507,7 +506,7 @@ Expression::Tvaltype Expression::NodeFunctionVarSet::valueType() const { // functions with 1 argument case functypeRCL: { - string varname("_localstore:"+static_cast(*_children[1])); + std::string varname("_localstore:"+static_cast(*_children[1])); Expression::Tvaltype valtype = valtypeNONE; Expression::Variable* var=NULL; if(_variableset) var=_variableset->getVariable(varname); @@ -537,7 +536,7 @@ Expression::Value Expression::NodeFunctionVarSet::evaluate() const { // functions with 1 argument case functypeRCL: { - string varname("_localstore:"+static_cast(*_children[1])); + std::string varname("_localstore:"+static_cast(*_children[1])); Expression::Value val; Expression::Variable* var=NULL; if(_variableset) var=_variableset->getVariable(varname); @@ -553,7 +552,7 @@ Expression::Value Expression::NodeFunctionVarSet::evaluate() const case functypeSTO: { Expression::Value val=_children[0]->evaluate(); - string varname("_localstore:"+static_cast(*_children[1])); + std::string varname("_localstore:"+static_cast(*_children[1])); if(_variableset) _variableset->setVariable(varname,val); return val; } @@ -564,7 +563,7 @@ Expression::Value Expression::NodeFunctionVarSet::evaluate() const return Value(); } -void Expression::NodeFunctionVarSet::write(ostream& ostrm) const { +void Expression::NodeFunctionVarSet::write(std::ostream& ostrm) const { switch(_functype) { // case functypeRCL: ostrm << "RCL"; break; @@ -576,15 +575,15 @@ void Expression::NodeFunctionVarSet::write(ostream& ostrm) const { -void Expression::initializeRPN(const string& exprstr, bool genlabel) +void Expression::initializeRPN(const std::string& exprstr, bool genlabel) { clear(); - stack nodestack; + std::stack nodestack; // split expr to generate Nodes size_t startpos=0,endpos; while(startpossetParent(node0); node2->setParent(node0); } - } else if(token.find_first_not_of("0123456789.-E")==string::npos){ + } else if(token.find_first_not_of("0123456789.-E")==std::string::npos){ // constant ................................................ - istringstream iss(token); - if(token.find_first_not_of("0123456789-")==string::npos) + std::istringstream iss(token); + if(token.find_first_not_of("0123456789-")==std::string::npos) { // Tint Tint valInt=0; iss>>valInt; @@ -622,8 +621,8 @@ void Expression::initializeRPN(const string& exprstr, bool genlabel) iss>>valFloat; nodestack.push(new NodeConstant(valFloat)); } - iss.str(string()); - } else if(colonpos!=string::npos) { + iss.str(std::string()); + } else if(colonpos!=std::string::npos) { // variable ................................................ nodestack.push(new NodeVariable(_variableset->addVariable(token))); } else { diff --git a/src/utils/Expression.h b/src/utils/Expression.h index d175ade308..75d8fe4988 100644 --- a/src/utils/Expression.h +++ b/src/utils/Expression.h @@ -23,12 +23,12 @@ class Expression public: typedef long Tint; typedef double Tfloat; - + enum Evaltype {valtypeNONE, valtypeINT, valtypeFLOAT}; typedef enum Evaltype Tvaltype; enum Etraversetype { traversetypePREFIX, traversetypeINFIX, traversetypePOSTFIX }; typedef enum Etraversetype Ttraversetype; - + // Value ----------------------------------------------------------------------------------- class Value { @@ -39,7 +39,7 @@ class Expression Tfloat valFloat; }; typedef union TUvalue Tvalue; - + /// Constructor Value() : _type(valtypeNONE) { _value.valInt=0; } /// Constructor @@ -63,10 +63,10 @@ class Expression //Value(Tfloat valFloat) { _type=valtypeFLOAT; _value.valFloat=valFloat; } Value(float valFloat) { _type=valtypeFLOAT; _value.valFloat=Tfloat(valFloat); } Value(double valFloat) { _type=valtypeFLOAT; _value.valFloat=Tfloat(valFloat); } - + /// get value type /** - parameter Evaltype + parameter Evaltype retval Tvaltype value type **/ Tvaltype getType() const { return _type; } @@ -98,7 +98,7 @@ class Expression default: return 0.; } } - operator Tfloat() const { return getValueFloat(); } + operator Tfloat() const { return getValueFloat(); } /// get value as integer number /** retval Tint value @@ -112,7 +112,7 @@ class Expression default: return 0.; } } - operator Tint() const { return getValueInt(); } + operator Tint() const { return getValueInt(); } /// write value to stream /** parameter std::ostrm& stream @@ -139,13 +139,13 @@ class Expression const Value operator-(Value const& v) const; const Value operator*(Value const& v) const; const Value operator/(Value const& v) const; - + private: Tvaltype _type; Tvalue _value; }; // ----------------------------------------------------------------------------------- Value - + class Variable; // VariableGroup --------------------------------------------------------------------------- /** @@ -164,13 +164,13 @@ class Expression bool removeVariable(const Variable* var) { if(_variables.count(var)) { _variables.erase(var); return true; } else return false; } unsigned int countVariables() const { return _variables.size(); } - operator unsigned int() const { return countVariables(); } + operator unsigned int() const { return countVariables(); } private: std::string _name; std::set _variables; }; // --------------------------------------------------------------------------- VariableGroup - + // Variable -------------------------------------------------------------------------------- class Variable { @@ -200,9 +200,9 @@ class Expression Tvaltype getType() const { return _value.getType(); } Value getValue() const { return _value; } Tfloat getValueFloat() const { return _value.getValueFloat(); } - operator Tfloat() const { return getValueFloat(); } + operator Tfloat() const { return getValueFloat(); } Tint getValueInt() const { return _value.getValueInt(); } - operator Tint() const { return getValueInt(); } + operator Tint() const { return getValueInt(); } bool isInt() const { return _value.isInt(); } bool isFloat() const { return _value.isFloat(); } const VariableGroup* getVariableGroup() const { return _vargrp; } @@ -227,20 +227,20 @@ class Expression write(oss); return oss.str(); } - + private: std::string _name; Value _value; VariableGroup* _vargrp; }; // -------------------------------------------------------------------------------- Variable - + // VariableSet ----------------------------------------------------------------------------- class VariableSet { public: VariableSet() {}; - + const std::set getVariableGroupNames() const { std::set vargroups; @@ -259,7 +259,7 @@ class Expression return (_vargroups.find(name)->second).countVariables(); else return 0; - + } unsigned int VariablesCount() const { return _variables.size(); } bool existVariable(const std::string& name) const { return _variables.count(name)>0; } @@ -298,15 +298,15 @@ class Expression { return setVariable(std::string(vgrpname+":"+varname),val); } //template bool setVariable(const char* vgrpname, const char* varname, T val=0) { return setVariable(std::string(vgrpname),std::string(varname),val); } bool removeVariable(const std::string& name); - + private: std::map _variables; std::map _vargroups; }; // ----------------------------------------------------------------------------- VariableSet - + // Node and derivatives -------------------------------------------------------------------- - + // Node ------------------------------------------------------------------------------------ class Node { @@ -344,14 +344,14 @@ class Expression void write() const { write(std::cout); } void traverse(std::list& nodelist, enum Etraversetype traversetype=traversetypePOSTFIX) const; void writeSubExpr(std::ostream& ostrm=std::cout, enum Etraversetype traversetype=traversetypePOSTFIX, char sep=' ') const; - + protected: Node* _children[2]; Node* _parent; short _priority; }; // ------------------------------------------------------------------------------------ Node - + // NodeConstant ---------------------------------------------------------------------------- class NodeConstant : public Node { @@ -367,7 +367,7 @@ class Expression Value _value; }; // ---------------------------------------------------------------------------- NodeConstant - + // NodeVariable ---------------------------------------------------------------------------- class NodeVariable : public Node { @@ -382,7 +382,7 @@ class Expression Variable* _var; }; // ---------------------------------------------------------------------------- NodeVariable - + // NodeOperation2 -------------------------------------------------------------------------- class NodeOperation2 : public Node { @@ -407,7 +407,7 @@ class Expression char _operator; }; // -------------------------------------------------------------------------- NodeOperation2 - + // NodeFunction ---------------------------------------------------------------------------- class NodeFunction : public Node { @@ -443,9 +443,9 @@ class Expression , functypeMarkerVarSet2Arg // marker for functions using the VariableSet with 2 arguments --- , functypeSTO // store value to }; - + static Efunctype functype(const std::string& name); - + NodeFunction(Efunctype func ,Node* child1, Node* child0=NULL, Node* parent=NULL) : Node(child0,child1,parent,0), _functype(func) {} @@ -455,12 +455,12 @@ class Expression Tvaltype valueType() const; Value evaluate() const; void write(std::ostream& ostrm) const; - + protected: enum Efunctype _functype; }; // ---------------------------------------------------------------------------- NodeFunction - + // NodeFunctionVarSet ---------------------------------------------------------------------- /* Functions with the capability to store and load values from the given VariableSet @@ -469,7 +469,7 @@ class Expression { public: // use enum Efunctype defined in NodeFunction - + NodeFunctionVarSet(Efunctype func, VariableSet *variableset ,Node* child1, Node* child0=NULL, Node* parent=NULL) : NodeFunction(func,child1,child0,parent), _variableset(variableset) {} @@ -477,14 +477,14 @@ class Expression Tvaltype valueType() const; Value evaluate() const; void write(std::ostream& ostrm) const; - + protected: VariableSet* _variableset; }; // ---------------------------------------------------------------------- NodeFunctionVarSet - + // -------------------------------------------------------------------- Node and derivatives - + Expression(const std::string& label=std::string(), VariableSet* varset=NULL) : _rootnode(NULL), _label(label), _variableset(varset), _variablesetcreated(false) { @@ -500,13 +500,13 @@ class Expression clear(); if(_variablesetcreated) delete _variableset; } - + void clear() { if(_rootnode) { delete(_rootnode); _rootnode=NULL; } } void setLabel(const std::string& label) { _label=label; } const std::string& getLabel() const { return _label; } - + void initializeRPN(const std::string& exprstr, bool genlabel=true); - + Expression& operator=(const Expression& rhs ) { _label=rhs._label; @@ -518,7 +518,7 @@ class Expression initializeRPN(oss.str()); return *this; } - + bool isEmpty() const { return _rootnode==NULL; } bool isInt() const { if(_rootnode) return _rootnode->isInt(); else return false; } bool isFloat() const { if(_rootnode) return _rootnode->isFloat(); else return false; } @@ -536,14 +536,14 @@ class Expression else return 0; } - - VariableSet* getVariableSet() { return _variableset; } + + VariableSet* getVariableSet() { return _variableset; } Variable* getVariable(const std::string& name) { return _variableset->getVariable(name); } unsigned int VariablesCount() const { return _variableset->VariablesCount(); } bool existVariable(const std::string& name) const { return _variableset->existVariable(name); } unsigned int VariableGroupsCount() const { return _variableset->VariableGroupsCount(); } bool existVariableGroup(const std::string& name) const { return _variableset->existVariableGroup(name); } - + void writeExpr(std::ostream& ostrm=std::cout, enum Etraversetype traversetype=traversetypePOSTFIX, char sep=' ') const { if(_rootnode) _rootnode->writeSubExpr(ostrm,traversetype,sep); @@ -559,7 +559,7 @@ class Expression _label=operator std::string(); //_label=static_cast(*this); } - + protected: Node* _rootnode; std::string _label; diff --git a/src/utils/FileUtils.cpp b/src/utils/FileUtils.cpp index ee5fddf944..8eb4412f47 100644 --- a/src/utils/FileUtils.cpp +++ b/src/utils/FileUtils.cpp @@ -12,15 +12,13 @@ #include #include -using namespace Log; - bool fileExists(const char* fileName) { struct stat status; int retVal = stat(fileName, &status); if (retVal != 0) { char* error = strerror(errno); - global_log->debug() << "File does not exist: " << fileName << std::endl; - global_log->debug() << error << std::endl; + Log::global_log->debug() << "File does not exist: " << fileName << std::endl; + Log::global_log->debug() << error << std::endl; } return retVal == 0; } @@ -42,8 +40,8 @@ void removeFile(const char* fileName) { int retVal = remove(fileName); if (retVal != 0) { char* error = strerror(errno); - global_log->warning() << "Could not remove file " << fileName << std::endl; - global_log->debug() << error << std::endl; + Log::global_log->warning() << "Could not remove file " << fileName << std::endl; + Log::global_log->debug() << error << std::endl; } } @@ -54,7 +52,7 @@ unsigned int getFileSize(const char* fileName) { if (stat_status == 0) { retVal = (unsigned int) status.st_size; } else { - global_log->warning() << "Could not stat file " << fileName << std::endl; + Log::global_log->warning() << "Could not stat file " << fileName << std::endl; } return retVal; } diff --git a/src/utils/FileUtils.h b/src/utils/FileUtils.h index 8422cceaf1..be9fbb689c 100644 --- a/src/utils/FileUtils.h +++ b/src/utils/FileUtils.h @@ -65,7 +65,7 @@ std::ostream& operator<<( std::ostream& o, const fill_width& a ); * * call e.g. like this: * - * std::vector fields; + * std::vector fields; * std::string str = "split:this:string"; * fields = split( fields, str, ":", split_type::no_empties ); * diff --git a/src/utils/GetChunkSize.h b/src/utils/GetChunkSize.h index 2e7e0b7977..c6a5b49002 100644 --- a/src/utils/GetChunkSize.h +++ b/src/utils/GetChunkSize.h @@ -7,7 +7,7 @@ namespace chunk_size { * The chunk size is the number of loop iterations scheduled together as one task. * @param loop_size The number of iterations. * @param max_num_chunks There should be enough chunks so that load can be balanced, but not too many since scheduling creates overhead. - * @param max_chunk_size When iterating the specified number of work items, the overhead should be negligible. + * @param max_chunk_size When iterating the specified number of work items, the overhead should be negligible. * Bigger numbers should not produce any better results. * @return The chunk size based on the given numbers. * @note max_chunk_size This is the more dominant factor, i.e., if max_num_chunks would indicate bigger chunks, diff --git a/src/utils/Logger.h b/src/utils/Logger.h index e1aba43a2d..2f78433684 100644 --- a/src/utils/Logger.h +++ b/src/utils/Logger.h @@ -49,8 +49,7 @@ class Logger; * Gobal logger variable for use in the entire program. * Must be initialized with constructor e.g. new Log::Logger(). * Namespace visibility: - * using Log::global_log; - */ + * */ #ifndef LOGGER_SRC extern Log::Logger *global_log; #endif @@ -77,7 +76,7 @@ typedef enum { * create and write to his own file. * For writing log messages use fatal(), error(), warning(), info() or debug() as * with normal streams, e.g. - * > log.error() << "Wrong parameter." << endl; + * > log.error() << "Wrong parameter." << std::endl; * For easy handling of output within MPI applications there are the following methods: * set_mpi_output_root(int root) * set_mpi_output_rall() @@ -162,23 +161,22 @@ class Logger { /// Add log info in front of messages Logger& msg_level(logLevel level) { - using namespace std; - _msg_log_level = level; + _msg_log_level = level; if (_msg_log_level <= _log_level && _do_output) { // Include timestamp const auto now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); tm unused{}; const auto* lt = localtime_r(&now, &unused); //*_log_stream << ctime(&t) << " "; - stringstream timestampstream; + std::stringstream timestampstream; // maybe sprintf is easier here... - timestampstream << setfill('0') << setw(4) << (1900 + lt->tm_year) << setw(2) << (1 + lt->tm_mon) << setw(2) << lt->tm_mday << "T" << setw(2) << lt->tm_hour << setw(2) << lt->tm_min << setw(2) << lt->tm_sec; + timestampstream << std::setfill('0') << std::setw(4) << (1900 + lt->tm_year) << std::setw(2) << (1 + lt->tm_mon) << std::setw(2) << lt->tm_mday << "T" << std::setw(2) << lt->tm_hour << std::setw(2) << lt->tm_min << std::setw(2) << lt->tm_sec; *_log_stream << logLevelNames[level] << ":\t" << timestampstream.str() << " "; //timestampstream.str(""); timestampstream.clear(); #ifdef USE_GETTIMEOFDAY timeval tod; gettimeofday(&tod, 0); - *_log_stream << setw(8) << tod.tv_sec - _starttime.tv_sec + (tod.tv_usec - _starttime.tv_usec) / 1.E6 << " "; + *_log_stream << std::setw(8) << tod.tv_sec - _starttime.tv_sec + (tod.tv_usec - _starttime.tv_usec) / 1.E6 << " "; #else *_log_stream << t-_starttime << "\t"; #endif diff --git a/src/utils/MPI_Info_object.cpp b/src/utils/MPI_Info_object.cpp index d5391e7e95..6adad0e910 100644 --- a/src/utils/MPI_Info_object.cpp +++ b/src/utils/MPI_Info_object.cpp @@ -19,17 +19,17 @@ void MPI_Info_object::readXML(XMLfile& xmlconfig) { if(_mpi_info == MPI_INFO_NULL) { MPI_CHECK( MPI_Info_create(&_mpi_info) ); } - + XMLfile::Query query = xmlconfig.query("hint"); - global_log->debug() << "[MPI_Info_object]\tNumber of hint key value pairs: " << query.card() << endl; - - string oldpath = xmlconfig.getcurrentnodepath(); + Log::global_log->debug() << "[MPI_Info_object]\tNumber of hint key value pairs: " << query.card() << std::endl; + + std::string oldpath = xmlconfig.getcurrentnodepath(); for(auto pairIter = query.begin(); pairIter; ++pairIter) { xmlconfig.changecurrentnode(pairIter); std::string key, value; xmlconfig.getNodeValue("key", key); xmlconfig.getNodeValue("value", value); - global_log->debug() << "[MPI_Info_object]\treadXML: found MPI Info hint '" << key << "': " << value << std::endl; + Log::global_log->debug() << "[MPI_Info_object]\treadXML: found MPI Info hint '" << key << "': " << value << std::endl; add_hint(key, value); } xmlconfig.changecurrentnode(oldpath); @@ -37,14 +37,14 @@ void MPI_Info_object::readXML(XMLfile& xmlconfig) { void MPI_Info_object::add_hint(std::string& key, std::string& value) { if(key.size() > MPI_MAX_INFO_KEY) { - global_log->error() << "MPI Info key name longer than allowed." << std::endl; + Log::global_log->error() << "MPI Info key name longer than allowed." << std::endl; return; } if(value.size() > MPI_MAX_INFO_VAL) { - global_log->error() << "MPI Info value longer than allowed." << std::endl; + Log::global_log->error() << "MPI Info value longer than allowed." << std::endl; return; } - global_log->info() << "[MPI_Info_object]\tsetting MPI Info hint " << key << "=" << value << std::endl; + Log::global_log->info() << "[MPI_Info_object]\tsetting MPI Info hint " << key << "=" << value << std::endl; MPI_CHECK( MPI_Info_set(_mpi_info, const_cast(key.c_str()), const_cast(value.c_str())) ); } diff --git a/src/utils/OptionParser.cpp b/src/utils/OptionParser.cpp index 5788b885d7..37ce4edf0d 100644 --- a/src/utils/OptionParser.cpp +++ b/src/utils/OptionParser.cpp @@ -20,20 +20,19 @@ #endif -using namespace std; namespace optparse { ////////// auxiliary (string) functions { ////////// struct str_wrap { - str_wrap(const string& l, const string& r) : lwrap(l), rwrap(r) {} - str_wrap(const string& w) : lwrap(w), rwrap(w) {} - string operator() (const string& s) { return lwrap + s + rwrap; } - const string lwrap, rwrap; + str_wrap(const std::string& l, const std::string& r) : lwrap(l), rwrap(r) {} + str_wrap(const std::string& w) : lwrap(w), rwrap(w) {} + std::string operator() (const std::string& s) { return lwrap + s + rwrap; } + const std::string lwrap, rwrap; }; template -static string str_join_trans(const string& sep, InputIterator begin, InputIterator end, UnaryOperator op) { - string buf; +static std::string str_join_trans(const std::string& sep, InputIterator begin, InputIterator end, UnaryOperator op) { + std::string buf; for (InputIterator it = begin; it != end; ++it) { if (it != begin) buf += sep; @@ -42,30 +41,30 @@ static string str_join_trans(const string& sep, InputIterator begin, InputIterat return buf; } template -static string str_join(const string& sep, InputIterator begin, InputIterator end) { +static std::string str_join(const std::string& sep, InputIterator begin, InputIterator end) { return str_join_trans(sep, begin, end, str_wrap("")); } -static string& str_replace(string& s, const string& patt, const string& repl) { +static std::string& str_replace(std::string& s, const std::string& patt, const std::string& repl) { size_t pos = 0, n = patt.length(); while (true) { pos = s.find(patt, pos); - if (pos == string::npos) + if (pos == std::string::npos) break; s.replace(pos, n, repl); pos += repl.size(); } return s; } -static string str_replace(const string& s, const string& patt, const string& repl) { - string tmp = s; +static std::string str_replace(const std::string& s, const std::string& patt, const std::string& repl) { + std::string tmp = s; str_replace(tmp, patt, repl); return tmp; } -static string str_format(const string& s, size_t pre, size_t len, bool indent_first = true) { - stringstream ss; - string p; +static std::string str_format(const std::string& s, size_t pre, size_t len, bool indent_first = true) { + std::stringstream ss; + std::string p; if (indent_first) - p = string(pre, ' '); + p = std::string(pre, ' '); size_t pos = 0, linestart = 0; size_t line = 0; @@ -73,29 +72,29 @@ static string str_format(const string& s, size_t pre, size_t len, bool indent_fi bool wrap = false; size_t new_pos = s.find_first_of(" \n\t", pos); - if (new_pos == string::npos) + if (new_pos == std::string::npos) break; if (s[new_pos] == '\n') { pos = new_pos + 1; wrap = true; } if (line == 1) - p = string(pre, ' '); + p = std::string(pre, ' '); if (wrap || new_pos + pre > linestart + len) { - ss << p << s.substr(linestart, pos - linestart - 1) << endl; + ss << p << s.substr(linestart, pos - linestart - 1) << std::endl; linestart = pos; line++; } pos = new_pos + 1; } - ss << p << s.substr(linestart) << endl; + ss << p << s.substr(linestart) << std::endl; return ss.str(); } -static string str_inc(const string& s) { - stringstream ss; - string v = (s != "") ? s : "0"; +static std::string str_inc(const std::string& s) { + std::stringstream ss; + std::string v = (s != "") ? s : "0"; long i; - istringstream(v) >> i; + std::istringstream(v) >> i; ss << i+1; return ss.str(); } @@ -103,20 +102,20 @@ static unsigned int cols() { unsigned int n = 80; const char *s = getenv("COLUMNS"); if (s) - istringstream(s) >> n; + std::istringstream(s) >> n; return n; } -static string basename(const string& s) { - string b = s; +static std::string basename(const std::string& s) { + std::string b = s; size_t i = b.find_last_not_of('/'); - if (i == string::npos) { + if (i == std::string::npos) { if (b[0] == '/') b.erase(1); return b; } b.erase(i+1, b.length()-i-1); i = b.find_last_of("/"); - if (i != string::npos) + if (i != std::string::npos) b.erase(0, i+1); return b; } @@ -130,31 +129,31 @@ OptionParser::OptionParser() : _add_version_option(true), _interspersed_args(true) {} -Option& OptionParser::add_option(const string& opt) { - const string tmp[1] = { opt }; - return add_option(vector(tmp, tmp + 1)); +Option& OptionParser::add_option(const std::string& opt) { + const std::string tmp[1] = { opt }; + return add_option(std::vector(tmp, tmp + 1)); } -Option& OptionParser::add_option(const string& opt1, const string& opt2) { - const string tmp[2] = { opt1, opt2 }; - return add_option(vector(tmp, tmp + 2)); +Option& OptionParser::add_option(const std::string& opt1, const std::string& opt2) { + const std::string tmp[2] = { opt1, opt2 }; + return add_option(std::vector(tmp, tmp + 2)); } -Option& OptionParser::add_option(const string& opt1, const string& opt2, const string& opt3) { - const string tmp[3] = { opt1, opt2, opt3 }; - return add_option(vector(tmp, tmp + 3)); +Option& OptionParser::add_option(const std::string& opt1, const std::string& opt2, const std::string& opt3) { + const std::string tmp[3] = { opt1, opt2, opt3 }; + return add_option(std::vector(tmp, tmp + 3)); } -Option& OptionParser::add_option(const vector& v) { +Option& OptionParser::add_option(const std::vector& v) { _opts.resize(_opts.size()+1); Option& option = _opts.back(); - string dest_fallback; - for (vector::const_iterator it = v.begin(); it != v.end(); ++it) { + std::string dest_fallback; + for (std::vector::const_iterator it = v.begin(); it != v.end(); ++it) { if (it->substr(0,2) == "--") { - const string s = it->substr(2); + const std::string s = it->substr(2); if (option.dest() == "") option.dest(str_replace(s, "-", "_")); option._long_opts.insert(s); _optmap_l[s] = &option; } else { - const string s = it->substr(1,1); + const std::string s = it->substr(1,1); if (dest_fallback == "") dest_fallback = s; option._short_opts.insert(s); @@ -167,28 +166,28 @@ Option& OptionParser::add_option(const vector& v) { } OptionParser& OptionParser::add_option_group(const OptionGroup& group) { - for (list