diff --git a/runtime/create_body.cpp b/runtime/create_body.cpp index de60041a10db62373b8e72c8a958df770e5676aa..6c431f646db037670fa29b0d4e73ab3e35a420ae 100644 --- a/runtime/create_body.cpp +++ b/runtime/create_body.cpp @@ -16,9 +16,9 @@ id_t create_halfspace(PairsRuntime *pr, auto positions = pr->getAsVectorProperty(pr->getPropertyByName("position")); auto normals = pr->getAsVectorProperty(pr->getPropertyByName("normal")); - if(pr->getDomainPartitioner()->isWithinSubdomain(x, y, z) || flag & (FLAGS_INFINITE | FLAGS_FIXED | FLAGS_GLOBAL) ){ + if(pr->getDomainPartitioner()->isWithinSubdomain(x, y, z) || flag & (flags::INFINITE | flags::GLOBAL) ){ int n = pr->getTrackedVariableAsInteger("nlocal"); - uid = (flag & FLAGS_GLOBAL) ? UniqueID::createGlobal(pr) : UniqueID::create(pr); + uid = (flag & flags::GLOBAL) ? UniqueID::createGlobal(pr) : UniqueID::create(pr); uids(n) = uid; positions(n, 0) = x; positions(n, 1) = y; @@ -53,7 +53,7 @@ id_t create_sphere(PairsRuntime *pr, if(pr->getDomainPartitioner()->isWithinSubdomain(x, y, z)) { int n = pr->getTrackedVariableAsInteger("nlocal"); - uid = (flag & FLAGS_GLOBAL) ? UniqueID::createGlobal(pr) : UniqueID::create(pr); + uid = (flag & flags::GLOBAL) ? UniqueID::createGlobal(pr) : UniqueID::create(pr); uids(n) = uid; radii(n) = radius; masses(n) = ((4.0 / 3.0) * M_PI) * radius * radius * radius * density; diff --git a/runtime/pairs_common.hpp b/runtime/pairs_common.hpp index 73c9f7b9c2c5253b0b542047264e93c671bf89d2..ba2c56ce03ca29480ede590cd9bb297539e5c6d9 100644 --- a/runtime/pairs_common.hpp +++ b/runtime/pairs_common.hpp @@ -15,11 +15,20 @@ namespace pairs { #define PAIRS_ATTR_HOST_DEVICE #endif -constexpr int FLAGS_INFINITE = 1 << 0 ; -constexpr int FLAGS_GHOST = 1 << 1 ; -constexpr int FLAGS_FIXED = 1 << 2 ; -constexpr int FLAGS_GLOBAL = 1 << 3 ; +namespace flags{ + constexpr int INFINITE = 1 << 0 ; + constexpr int GHOST = 1 << 1 ; + constexpr int FIXED = 1 << 2 ; + constexpr int GLOBAL = 1 << 3 ; +} +namespace shapes{ + enum Type { + Sphere = 0, + Halfspace = 1, + PointMass = 2 + }; +} //#ifdef USE_DOUBLE_PRECISION typedef double real_t; //#else diff --git a/runtime/read_from_file.cpp b/runtime/read_from_file.cpp index 39e9bef6c279ef7ce168cc2f1a7374c564b721cb..25dcc97c2545474c1ea974824db665fc7e4af414 100644 --- a/runtime/read_from_file.cpp +++ b/runtime/read_from_file.cpp @@ -114,8 +114,8 @@ size_t read_particle_data( i++; } - if(within_domain || flags & (FLAGS_INFINITE | FLAGS_FIXED | FLAGS_GLOBAL)) { - uid_ptr(n) = (flags & FLAGS_GLOBAL) ? UniqueID::createGlobal(ps) : UniqueID::create(ps); + if(within_domain || flags & (flags::INFINITE | flags::FIXED | flags::GLOBAL)) { + uid_ptr(n) = (flags & flags::GLOBAL) ? UniqueID::createGlobal(ps) : UniqueID::create(ps); shape_ptr(n++) = shape_id; } } diff --git a/runtime/vtk.cpp b/runtime/vtk.cpp index f7d1e235e61643796123ae48accc0c5425ac9c8c..43502b004a27b3310de0f39cdfc83937b1e797ae 100644 --- a/runtime/vtk.cpp +++ b/runtime/vtk.cpp @@ -34,7 +34,7 @@ void vtk_write_data( ps->copyPropertyToHost(flags, ReadOnly); for(int i = start; i < end; i++) { - if(flags(i) & FLAGS_INFINITE) { + if(flags(i) & flags::INFINITE) { n--; } } @@ -47,7 +47,7 @@ void vtk_write_data( out_file << "POINTS " << n << " double\n"; for(int i = start; i < end; i++) { - if(!(flags(i) & FLAGS_INFINITE)) { + if(!(flags(i) & flags::INFINITE)) { out_file << std::fixed << std::setprecision(prec) << positions(i, 0) << " "; out_file << std::fixed << std::setprecision(prec) << positions(i, 1) << " "; out_file << std::fixed << std::setprecision(prec) << positions(i, 2) << "\n"; @@ -63,7 +63,7 @@ void vtk_write_data( out_file << "\n\n"; out_file << "CELL_TYPES " << n << "\n"; for(int i = start; i < end; i++) { - if(!(flags(i) & FLAGS_INFINITE)) { + if(!(flags(i) & flags::INFINITE)) { out_file << "1\n"; } } @@ -73,7 +73,7 @@ void vtk_write_data( out_file << "SCALARS mass double\n"; out_file << "LOOKUP_TABLE default\n"; for(int i = start; i < end; i++) { - if(!(flags(i) & FLAGS_INFINITE)) { + if(!(flags(i) & flags::INFINITE)) { out_file << std::fixed << std::setprecision(prec) << masses(i) << "\n"; } }