Commit 8afdb1f2 authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

cleans up access to private data

parent b6201989
Pipeline #94857 passed with stages
in 25 minutes and 37 seconds
......@@ -41,16 +41,28 @@ void print_pair_vec(std::vector<partsize_t> vec)
template <class real_number, class partsize_t>
class p2p_ghost_collisions
{
private:
protected:
const double pi = atan(1.0)*4;
const double pi2 = atan(1.0)*8;
// depending on the particle shape, we will be deciding whether particles intersect in different ways
enum particle_shape {CYLINDER, SPHERE, DISK};
private:
bool isActive;
bool synchronisation;
// description for cylinders:
double cylinder_width;
double cylinder_length;
// description for disks:
double disk_width;
protected:
enum particle_shape {CYLINDER, SPHERE, DISK};
particle_shape current_particle_shape;
// depending on the particle shape, we will be deciding whether particles intersect in different ways
particle_shape current_particle_shape;
protected:
void add_colliding_pair(partsize_t idx_part1, partsize_t idx_part2)
{
// store colliding particle ids in order, to be able to identify pairs more easily
......@@ -65,21 +77,15 @@ class p2p_ghost_collisions
this->collision_pairs_local.push_back(idx_part_small);
this->collision_pairs_local.push_back(idx_part_big);
}
// description for cylinders:
double cylinder_width;
double cylinder_length;
bool isActive;
bool synchronisation;
std::vector <partsize_t> collision_pairs_local;
std::vector <partsize_t> collision_pairs_global;
public:
p2p_ghost_collisions(): current_particle_shape(SPHERE), cylinder_width(1.0), cylinder_length(1.0), disk_width(1.0), isActive(true), synchronisation(false) {}
// Copy constructor use a counter set to zero
p2p_ghost_collisions(const p2p_ghost_collisions& src)
void copy_from_p2p_ghost_collisions(const p2p_ghost_collisions<real_number, partsize_t>& src)
{
this->current_particle_shape = src.current_particle_shape;
this->cylinder_width = src.cylinder_width;
......@@ -90,6 +96,12 @@ public:
this->collision_pairs_local.reserve(src.collision_pairs_local.capacity());
}
// Copy constructor use a counter set to zero
p2p_ghost_collisions(const p2p_ghost_collisions<real_number, partsize_t>& src)
{
this->copy_from_p2p_ghost_collisions(src);
}
double rod_distance(double px, double py, double pz, double qx, double qy, double qz, double t, double s, double x, double y, double z){
double x_dist, y_dist, z_dist;
double min_distance;
......@@ -382,12 +394,12 @@ public:
this->cylinder_length = LENGTH;
}
double get_cylinder_width()
double get_cylinder_width() const
{
return this->cylinder_width;
}
double get_cylinder_length()
double get_cylinder_length() const
{
return this->cylinder_length;
}
......@@ -397,12 +409,17 @@ public:
this->current_particle_shape = DISK;
}
particle_shape get_current_particle_shape() const
{
return this->current_particle_shape;
}
void set_disk_width(const double WIDTH)
{
this->disk_width = WIDTH;
}
double get_disk_width()
double get_disk_width() const
{
return this->disk_width;
}
......@@ -411,9 +428,15 @@ public:
return isActive;
}
void setEnable(const bool inIsActive) {
void setEnable(const bool inIsActive)
{
isActive = inIsActive;
}
bool isSynchronized() const
{
return this->synchronisation;
}
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment