diff --git a/tests/pe/BodyFlags.cpp b/tests/pe/BodyFlags.cpp index 901e85c71bf41bb6b0c4238fc8fff6aa6e550db1..db7e82ce8f6b3c4890ffb3949bbe5fba7b3dcc4f 100644 --- a/tests/pe/BodyFlags.cpp +++ b/tests/pe/BodyFlags.cpp @@ -71,12 +71,12 @@ int main( int argc, char ** argv ) MaterialID iron = Material::find("iron"); - SphereID refGlobalSphere = new Sphere(1, 0, Vec3(9, 9, 9), Vec3(0,0,0), Quat(), 3, iron, true, false, true); - refGlobalSphere->setLinearVel(Vec3(2,2,2)); + Sphere refGlobalSphere(1, 0, Vec3(9, 9, 9), Vec3(0,0,0), Quat(), 3, iron, true, false, true); + refGlobalSphere.setLinearVel(Vec3(2,2,2)); SphereID globalSphere = createSphere( *globalStorage, forest->getBlockStorage(), storageID, 0, Vec3(9,9,9), 3, iron, true, false, true); globalSphere->setLinearVel(Vec3(2,2,2)); - SphereID refFixedSphere = new Sphere(2, 0, Vec3(9,9,14), Vec3(0,0,0), Quat(), 3, iron, false, false, true); + Sphere refFixedSphere(2, 0, Vec3(9,9,14), Vec3(0,0,0), Quat(), 3, iron, false, false, true); SphereID fixedSphere = createSphere( *globalStorage, forest->getBlockStorage(), storageID, 0, Vec3(9,9,14), 3, iron, false, false, true); walberla::id_t fixedSphereID = 0; if (fixedSphere != NULL) fixedSphereID = fixedSphere->getSystemID(); @@ -87,16 +87,16 @@ int main( int argc, char ** argv ) cr.setGlobalLinearAcceleration(Vec3(0, 0, real_c(-9.81))); - checkVitalParameters(refGlobalSphere, globalSphere); + checkVitalParameters(&refGlobalSphere, globalSphere); for (auto it = forest->begin(); it != forest->end(); ++it) { blockforest::Block& block = *(dynamic_cast<blockforest::Block*>(&(*it))); - if (block.getAABB().intersects(refFixedSphere->getAABB())) + if (block.getAABB().intersects(refFixedSphere.getAABB())) { SphereID fixed = static_cast<SphereID> (getBody(*globalStorage, forest->getBlockStorage(), storageID, fixedSphereID)); WALBERLA_ASSERT_NOT_NULLPTR(fixed); - checkVitalParameters(refFixedSphere,fixed); - if (!block.getAABB().contains(refFixedSphere->getPosition())) + checkVitalParameters(&refFixedSphere,fixed); + if (!block.getAABB().contains(refFixedSphere.getPosition())) { WALBERLA_ASSERT(fixed->isRemote()); } @@ -108,17 +108,17 @@ int main( int argc, char ** argv ) syncShadowOwners<BodyTuple>( forest->getBlockForest(), storageID, NULL, real_c(0.0), false); WALBERLA_LOG_PROGRESS_ON_ROOT("*** SIMULATION - END ***"); - refGlobalSphere->setPosition(Vec3(11,11,11)); - checkVitalParameters(refGlobalSphere, globalSphere); + refGlobalSphere.setPosition(Vec3(11,11,11)); + checkVitalParameters(&refGlobalSphere, globalSphere); for (auto it = forest->begin(); it != forest->end(); ++it) { blockforest::Block& block = *(dynamic_cast<blockforest::Block*>(&(*it))); - if (block.getAABB().intersects(refFixedSphere->getAABB())) + if (block.getAABB().intersects(refFixedSphere.getAABB())) { SphereID fixed = static_cast<SphereID> (getBody(*globalStorage, forest->getBlockStorage(), storageID, fixedSphereID)); WALBERLA_ASSERT_NOT_NULLPTR(fixed); - checkVitalParameters(refFixedSphere, fixed); - if (!block.getAABB().contains(refFixedSphere->getPosition())) + checkVitalParameters(&refFixedSphere, fixed); + if (!block.getAABB().contains(refFixedSphere.getPosition())) { WALBERLA_ASSERT(fixed->isRemote()); } diff --git a/tests/pe/CollisionTobiasGJK.cpp b/tests/pe/CollisionTobiasGJK.cpp index f1710053b576301337cb4a821660145eb8d1ba51..46889c1eab92e2fb883173cb525fb324a510e00b 100644 --- a/tests/pe/CollisionTobiasGJK.cpp +++ b/tests/pe/CollisionTobiasGJK.cpp @@ -363,13 +363,13 @@ void UnionTest(){ auto sp2 = createSphere(unsub.get(), 181, Vec3(3,real_t(3.8),0), real_t(3.0)); //Create another union, and add sub union - Union<boost::tuple<Sphere, Union<boost::tuple<Sphere>>>> *un = new Union<boost::tuple<Sphere, Union<boost::tuple<Sphere>>>>(193, 193, Vec3(0, 0, 0), Vec3(0,0,0), Quat(), false, true, false); - createSphere(un, 182, Vec3(0,real_t(6),0), real_t(3.0)); - un->add(std::move(unsub)); + Union<boost::tuple<Sphere, Union<boost::tuple<Sphere>>>> un(193, 193, Vec3(0, 0, 0), Vec3(0,0,0), Quat(), false, true, false); + createSphere(&un, 182, Vec3(0,real_t(6),0), real_t(3.0)); + un.add(std::move(unsub)); PossibleContacts pcs; - pcs.push_back(std::pair<Union<boost::tuple<Sphere,Union<boost::tuple<Sphere>>>>*, Box*>(un, &box)); + pcs.push_back(std::pair<Union<boost::tuple<Sphere,Union<boost::tuple<Sphere>>>>*, Box*>(&un, &box)); Contacts& container = testFCD.generateContacts(pcs); WALBERLA_CHECK(container.size() == 2); @@ -397,7 +397,7 @@ void UnionTest(){ pcs.clear(); //Vice Versa - pcs.push_back(std::pair<Box*, Union<boost::tuple<Sphere, Union<boost::tuple<Sphere>>>>* >(&box, un)); + pcs.push_back(std::pair<Box*, Union<boost::tuple<Sphere, Union<boost::tuple<Sphere>>>>* >(&box, &un)); container = testFCD.generateContacts(pcs); WALBERLA_CHECK(container.size() == 2); diff --git a/tests/pe/RigidBody.cpp b/tests/pe/RigidBody.cpp index 20dfb8c0609e61a4080115bcade6882583f14a99..ad3e0facb2e5fb3900fccbc4c042b5a341640c1c 100644 --- a/tests/pe/RigidBody.cpp +++ b/tests/pe/RigidBody.cpp @@ -82,10 +82,10 @@ void move( BodyStorage& storage, real_t dt ) void checkRotationFunctions() { MaterialID iron = Material::find("iron"); - auto sp1 = shared_ptr<Sphere>( new Sphere(0, 0, Vec3(0,0,0), Vec3(0,0,0), Quat(), 1, iron, false, true, false) ); - auto sp2 = shared_ptr<Sphere>( new Sphere(0, 0, Vec3(0,0,0), Vec3(0,0,0), Quat(), 1, iron, false, true, false) ); - auto sp3 = shared_ptr<Sphere>( new Sphere(0, 0, Vec3(0,0,0), Vec3(0,0,0), Quat(), 1, iron, false, true, false) ); - auto sp4 = shared_ptr<Sphere>( new Sphere(0, 0, Vec3(0,0,0), Vec3(0,0,0), Quat(), 1, iron, false, true, false) ); + auto sp1 = std::make_shared<Sphere>( 0, 0, Vec3(0,0,0), Vec3(0,0,0), Quat(), 1, iron, false, true, false ); + auto sp2 = std::make_shared<Sphere>( 0, 0, Vec3(0,0,0), Vec3(0,0,0), Quat(), 1, iron, false, true, false ); + auto sp3 = std::make_shared<Sphere>( 0, 0, Vec3(0,0,0), Vec3(0,0,0), Quat(), 1, iron, false, true, false ); + auto sp4 = std::make_shared<Sphere>( 0, 0, Vec3(0,0,0), Vec3(0,0,0), Quat(), 1, iron, false, true, false ); sp1->rotate( 1, 0, 0, math::M_PI * real_t(0.5)); sp1->rotate( 0, 1, 0, math::M_PI * real_t(0.5)); @@ -121,7 +121,7 @@ void checkRotationFunctions() void checkPointFunctions() { MaterialID iron = Material::find("iron"); - auto sp1 = shared_ptr<Sphere>( new Sphere(0, 0, Vec3(10,10,10), Vec3(0,0,0), Quat(), 1, iron, false, true, false) ); + auto sp1 = std::make_shared<Sphere>( 0, 0, Vec3(10,10,10), Vec3(0,0,0), Quat(), 1, iron, false, true, false ); WALBERLA_CHECK( sp1->containsPoint( 10, 10, 10 ) ); WALBERLA_CHECK( sp1->containsPoint( real_c(10.9), 10, 10 ) ); diff --git a/tests/pe/SyncEquivalence.cpp b/tests/pe/SyncEquivalence.cpp index 8742ac375e1ba058062674952035512e5587bd94..6afd4f8670bc0ceeac07567021c9581516887241 100644 --- a/tests/pe/SyncEquivalence.cpp +++ b/tests/pe/SyncEquivalence.cpp @@ -115,7 +115,7 @@ void createSimulation(math::AABB& simulationDomain, info.ccdID = info.forest->addBlockData(ccd::createHashGridsDataHandling( info.globalBodyStorage, info.storageID ), "CCD"); info.fcdID = info.forest->addBlockData(fcd::createGenericFCDDataHandling<BodyTuple, fcd::AnalyticCollideFunctor>(), "FCD"); - info.cr = shared_ptr<cr::ICR>(new cr::HCSITS(info.globalBodyStorage, info.forest->getBlockStoragePointer(), info.storageID, info.ccdID, info.fcdID) ); + info.cr = std::make_shared<cr::HCSITS>(info.globalBodyStorage, info.forest->getBlockStoragePointer(), info.storageID, info.ccdID, info.fcdID ); int numParticles = int_c(0); diff --git a/tests/pe/Synchronization.cpp b/tests/pe/Synchronization.cpp index 41d003fb65b60a84fc53b787c7642ba17082749a..17d33c41be16009ad7a04fd91239f9f76ccdaaa1 100644 --- a/tests/pe/Synchronization.cpp +++ b/tests/pe/Synchronization.cpp @@ -39,7 +39,7 @@ using namespace walberla::blockforest; typedef boost::tuple<Sphere> BodyTuple ; -void checkSphere(StructuredBlockForest& forest, BlockDataID storageID, walberla::id_t sid, SphereID ref, const Vec3& newPos) +void checkSphere(StructuredBlockForest& forest, BlockDataID storageID, walberla::id_t sid, Sphere& ref, const Vec3& newPos) { for (auto it = forest.begin(); it != forest.end(); ++it) { @@ -47,37 +47,37 @@ void checkSphere(StructuredBlockForest& forest, BlockDataID storageID, walberla: Storage& storage = *(block.getData<Storage>(storageID)); BodyStorage& shadowStorage = storage[1]; - if (block.getAABB().contains( ref->getPosition() )) + if (block.getAABB().contains( ref.getPosition() )) { - WALBERLA_CHECK_EQUAL( storage[StorageType::LOCAL].size(), 1, "pos: " << ref->getPosition() << "\nradius: " << ref->getRadius() << "\ndomain: " << block.getAABB() ); - WALBERLA_CHECK_EQUAL( shadowStorage.size(), 0, "pos: " << ref->getPosition() << "\nradius: " << ref->getRadius() << "\ndomain: " << block.getAABB() ); + WALBERLA_CHECK_EQUAL( storage[StorageType::LOCAL].size(), 1, "pos: " << ref.getPosition() << "\nradius: " << ref.getRadius() << "\ndomain: " << block.getAABB() ); + WALBERLA_CHECK_EQUAL( shadowStorage.size(), 0, "pos: " << ref.getPosition() << "\nradius: " << ref.getRadius() << "\ndomain: " << block.getAABB() ); SphereID bd = static_cast<SphereID> (storage[StorageType::LOCAL].find( sid ).getBodyID()); WALBERLA_CHECK_NOT_NULLPTR(bd); - checkVitalParameters(bd, ref); + checkVitalParameters(bd, &ref); WALBERLA_LOG_DEVEL("#shadows: " << bd->MPITrait.sizeShadowOwners() << " #block states set: " << bd->MPITrait.getBlockStateSize() << "\nowner domain: " << block.getAABB() << "\nowner: " << bd->MPITrait.getOwner()); bd->setPosition( newPos ); - } else if (forest.periodicIntersect(block.getAABB(), ref->getAABB()) ) + } else if (forest.periodicIntersect(block.getAABB(), ref.getAABB()) ) { - WALBERLA_CHECK_EQUAL( storage[StorageType::LOCAL].size(), 0, "pos: " << ref->getPosition() << "\nradius: " << ref->getRadius() << "\ndomain: " << block.getAABB() ); - WALBERLA_CHECK_EQUAL( shadowStorage.size(), 1, "pos: " << ref->getPosition() << "\nradius: " << ref->getRadius() << "\ndomain: " << block.getAABB() ); + WALBERLA_CHECK_EQUAL( storage[StorageType::LOCAL].size(), 0, "pos: " << ref.getPosition() << "\nradius: " << ref.getRadius() << "\ndomain: " << block.getAABB() ); + WALBERLA_CHECK_EQUAL( shadowStorage.size(), 1, "pos: " << ref.getPosition() << "\nradius: " << ref.getRadius() << "\ndomain: " << block.getAABB() ); SphereID bd = static_cast<SphereID> (shadowStorage.find( sid ).getBodyID()); WALBERLA_CHECK_NOT_NULLPTR(bd); - auto backupPos =ref->getPosition(); - auto correctedPos = ref->getPosition(); + auto backupPos =ref.getPosition(); + auto correctedPos = ref.getPosition(); pe::communication::correctBodyPosition(forest.getDomain(), block.getAABB().center(), correctedPos); - ref->setPosition(correctedPos); - checkVitalParameters(bd, ref); - ref->setPosition(backupPos); + ref.setPosition(correctedPos); + checkVitalParameters(bd, &ref); + ref.setPosition(backupPos); } else { - WALBERLA_CHECK_EQUAL( storage[StorageType::LOCAL].size(), 0, "pos: " << ref->getPosition() << "\nradius: " << ref->getRadius() << "\ndomain: " << block.getAABB() ); - WALBERLA_CHECK_EQUAL( shadowStorage.size(), 0, "pos: " << ref->getPosition() << "\nradius: " << ref->getRadius() << "\ndomain: " << block.getAABB() ); + WALBERLA_CHECK_EQUAL( storage[StorageType::LOCAL].size(), 0, "pos: " << ref.getPosition() << "\nradius: " << ref.getRadius() << "\ndomain: " << block.getAABB() ); + WALBERLA_CHECK_EQUAL( shadowStorage.size(), 0, "pos: " << ref.getPosition() << "\nradius: " << ref.getRadius() << "\ndomain: " << block.getAABB() ); } } - WALBERLA_LOG_PROGRESS("checked pos: " << ref->getPosition() << " | new pos: " << newPos); + WALBERLA_LOG_PROGRESS("checked pos: " << ref.getPosition() << " | new pos: " << newPos); auto temp = newPos; forest.mapToPeriodicDomain(temp); - ref->setPosition(temp); + ref.setPosition(temp); } int main( int argc, char ** argv ) @@ -117,9 +117,9 @@ int main( int argc, char ** argv ) MaterialID iron = Material::find("iron"); walberla::id_t sid = 123; - SphereID refSphere = new Sphere(1, 0, Vec3(15, 15, 15), Vec3(0,0,0), Quat(), 3, iron, false, true, false); - refSphere->setLinearVel(4, 5, 6); - refSphere->setAngularVel( 1, 2, 3); + Sphere refSphere(1, 0, Vec3(15, 15, 15), Vec3(0,0,0), Quat(), 3, iron, false, true, false); + refSphere.setLinearVel(4, 5, 6); + refSphere.setAngularVel( 1, 2, 3); Vec3 gpos = Vec3(15, 15, 15); SphereID sphere = createSphere( globalStorage, forest->getBlockStorage(), storageID, 0, gpos, 3); diff --git a/tests/pe/SynchronizationLargeBody.cpp b/tests/pe/SynchronizationLargeBody.cpp index aaef02acb5d748c82300e47ec8ededbf7f6cf8e0..6bf99cc4700baa403698e23964c9a73139c14953 100644 --- a/tests/pe/SynchronizationLargeBody.cpp +++ b/tests/pe/SynchronizationLargeBody.cpp @@ -161,9 +161,9 @@ int main( int argc, char ** argv ) walberla::id_t sid = 123; Vec3 gpos = Vec3(3.5, 3.5, 3.5); const real_t r = real_c(1.6); - SphereID refSphere = new Sphere(1, 0, gpos, Vec3(0,0,0), Quat(), r, iron, false, true, false); - refSphere->setLinearVel(4, 5, 6); - refSphere->setAngularVel( 1, 2, 3); + Sphere refSphere(1, 0, gpos, Vec3(0,0,0), Quat(), r, iron, false, true, false); + refSphere.setLinearVel(4, 5, 6); + refSphere.setAngularVel( 1, 2, 3); SphereID sphere = createSphere( *globalStorage, forest->getBlockStorage(), storageID, 0, gpos, r); @@ -203,10 +203,10 @@ int main( int argc, char ** argv ) for (int i = 0; i < 21; ++i) { syncShadowOwners<BodyTuple>(forest->getBlockForest(), storageID); - Vec3 pos = refSphere->getPosition() + delta; + Vec3 pos = refSphere.getPosition() + delta; if (!forest->getDomain().contains( pos, real_c(0.5) )) forest->mapToPeriodicDomain(pos); - checkSphere(*forest, storageID, sid, refSphere, pos); + checkSphere(*forest, storageID, sid, &refSphere, pos); } } WALBERLA_LOG_PROGRESS("TEST WITHOUT DX ... finished"); @@ -225,10 +225,10 @@ int main( int argc, char ** argv ) for (int i = 0; i < 21; ++i) { syncShadowOwners<BodyTuple>(forest->getBlockForest(), storageID, NULL, dx); - Vec3 pos = refSphere->getPosition() + delta; + Vec3 pos = refSphere.getPosition() + delta; if (!forest->getDomain().contains( pos, real_c(0.5) )) forest->mapToPeriodicDomain(pos); - checkSphere(*forest, storageID, sid, refSphere, pos, dx); + checkSphere(*forest, storageID, sid, &refSphere, pos, dx); } } syncShadowOwners<BodyTuple>(forest->getBlockForest(), storageID, NULL, dx);