diff --git a/runtime/domain/block_forest.hpp b/runtime/domain/block_forest.hpp index 04446d23d7f3b719b9f60d3816975d453a8e4446..7a447c10e8eb2d90aa1ff70b7cb631f132d31c7a 100644 --- a/runtime/domain/block_forest.hpp +++ b/runtime/domain/block_forest.hpp @@ -19,7 +19,7 @@ private: std::vector<int> naabbs; std::vector<double> aabbs; real_t *subdom; - int world_size, rank, nranks, naabbs; + int world_size, rank, nranks, total_aabbs; bool balance_workload; public: @@ -34,13 +34,12 @@ public: delete[] subdom; } - void setBoundingBox(); void initialize(int *argc, char ***argv); void finalize(); int getWorldSize() const { return world_size; } int getRank() const { return rank; } int getNumberOfNeighborRanks() { return this->nranks; } - int getNumberOfNeighborAABBs() { return this->naabbs; } + int getNumberOfNeighborAABBs() { return this->total_aabbs; } void initializeWorkloadBalancer(); void updateNeighborhood(); diff --git a/runtime/domain/regular_6d_stencil.hpp b/runtime/domain/regular_6d_stencil.hpp index 4aa95cd9cb20b7027f032442345124f3cd385d05..84c01a7b2b665a113d6810fb1af7ff4c23e77321 100644 --- a/runtime/domain/regular_6d_stencil.hpp +++ b/runtime/domain/regular_6d_stencil.hpp @@ -59,6 +59,7 @@ public: int getNumberOfNeighborAABBs() { return 6; } int isWithinSubdomain(real_t x, real_t y, real_t z); + void copyRuntimeArray(const std::string& name, void *dest, const int size); void fillArrays(int *neighbor_ranks, int *pbc, real_t *subdom); void communicateSizes(int dim, const int *send_sizes, int *recv_sizes); void communicateData( diff --git a/runtime/interfaces/dem.hpp b/runtime/interfaces/dem.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b593c2707d053e0c6ac547b8ec23783f5d15e5f6 --- /dev/null +++ b/runtime/interfaces/dem.hpp @@ -0,0 +1,41 @@ +#include "../pairs.hpp" + +namespace pairs_host_interface { + +int get_uid(int *uid, int i) { return uid[i]; } +int get_shape(int *shape, int i) { return shape[i]; } +int get_flags(int *flags, int i) { return flags[i]; } +double get_position(double *position, int i, int j, int capacity) { return position[i * 3 + j]; } +double get_mass(double *mass, int i) { return mass[i]; } +double get_linear_velocity(double *linear_velocity, int i, int j, int capacity) { return linear_velocity[i * 3 + j]; } +double get_angular_velocity(double *angular_velocity, int i, int j, int capacity) { return angular_velocity[i * 3 + j]; } +double get_force(double *force, int i, int j, int capacity) { return force[i * 3 + j]; } +double get_torque(double *torque, int i, int j, int capacity) { return torque[i * 3 + j]; } +double get_radius(double *radius, int i) { return radius[i]; } +double get_normal(double *normal, int i, int j, int capacity) { return normal[i * 3 + j]; } +double get_inv_inertia(double *inv_inertia, int i, int j, int capacity) { return inv_inertia[i * 9 + j]; } +double get_rotation_matrix(double *rotation_matrix, int i, int j, int capacity) { return rotation_matrix[i * 9 + j]; } +double get_rotation_quat(double *rotation_quat, int i, int j, int capacity) { return rotation_quat[i * 4 + j]; } +int get_type(int *type, int i) { return type[i]; } + +} + +namespace pairs_cuda_interface { + +__inline__ __device__ int get_uid(int *uid, int i) { return uid[i]; } +__inline__ __device__ int get_shape(int *shape, int i) { return shape[i]; } +__inline__ __device__ int get_flags(int *flags, int i) { return flags[i]; } +__inline__ __device__ double get_position(double *position, int i, int j, int capacity) { return position[i * 3 + j]; } +__inline__ __device__ double get_mass(double *mass, int i) { return mass[i]; } +__inline__ __device__ double get_linear_velocity(double *linear_velocity, int i, int j, int capacity) { return linear_velocity[i * 3 + j]; } +__inline__ __device__ double get_angular_velocity(double *angular_velocity, int i, int j, int capacity) { return angular_velocity[i * 3 + j]; } +__inline__ __device__ double get_force(double *force, int i, int j, int capacity) { return force[i * 3 + j]; } +__inline__ __device__ double get_torque(double *torque, int i, int j, int capacity) { return torque[i * 3 + j]; } +__inline__ __device__ double get_radius(double *radius, int i) { return radius[i]; } +__inline__ __device__ double get_normal(double *normal, int i, int j, int capacity) { return normal[i * 3 + j]; } +__inline__ __device__ double get_inv_inertia(double *inv_inertia, int i, int j, int capacity) { return inv_inertia[i * 9 + j]; } +__inline__ __device__ double get_rotation_matrix(double *rotation_matrix, int i, int j, int capacity) { return rotation_matrix[i * 9 + j]; } +__inline__ __device__ double get_rotation_quat(double *rotation_quat, int i, int j, int capacity) { return rotation_quat[i * 4 + j]; } +__inline__ __device__ int get_type(int *type, int i) { return type[i]; } + +} diff --git a/runtime/pairs.cpp b/runtime/pairs.cpp index 09030f3e77c081e59fef17559b8590311a6d2e2d..f4179cbf15b36f6e05c35b4ee2d7cc9b5d0f01f9 100644 --- a/runtime/pairs.cpp +++ b/runtime/pairs.cpp @@ -515,7 +515,7 @@ void PairsSimulation::communicateContactHistoryData( #endif } -void PairsSimulation::copyRuntimeArray(const std::string& name, const void *dest, const int size) { +void PairsSimulation::copyRuntimeArray(const std::string& name, void *dest, const int size) { this->getDomainPartitioner()->copyRuntimeArray(name, dest, size); } diff --git a/runtime/pairs.hpp b/runtime/pairs.hpp index ca56b6ec6095cef180269a09aa5cbf73f488915d..93f458392e5f2c28a50e04ad3c9d9996e984cfdf 100644 --- a/runtime/pairs.hpp +++ b/runtime/pairs.hpp @@ -296,7 +296,7 @@ public: const real_t *send_buf, const int *contact_soffsets, const int *nsend_contact, real_t *recv_buf, int *contact_roffsets, int *nrecv_contact); - void copyRuntimeArray(const std::string& name, const void *dest, const int size); + void copyRuntimeArray(const std::string& name, void *dest, const int size); int getNumberOfNeighborRanks() { return this->getDomainPartitioner()->getNumberOfNeighborRanks(); } int getNumberOfNeighborAABBs() { return this->getDomainPartitioner()->getNumberOfNeighborAABBs(); }