Skip to content

Commit

Permalink
rename plan by plane
Browse files Browse the repository at this point in the history
  • Loading branch information
gouarin committed Jun 7, 2024
1 parent aad42e4 commit 7d7b502
Show file tree
Hide file tree
Showing 31 changed files with 305 additions and 301 deletions.
12 changes: 6 additions & 6 deletions demos/box_spheres_3d.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <random>
#include <scopi/objects/types/plan.hpp>
#include <scopi/objects/types/plane.hpp>
#include <scopi/objects/types/sphere.hpp>
#include <scopi/solver.hpp>
#include <scopi/vap/vap_fpd.hpp>
Expand Down Expand Up @@ -31,31 +31,31 @@ int main()
const xt::xtensor_fixed<double, xt::xshape<dim>> axes_y({0., 1., 0.});
const xt::xtensor_fixed<double, xt::xshape<dim>> axes_z({0., 0., 1.});

scopi::plan<dim> p_left(
scopi::plane<dim> p_left(
{
{0., 0., 0.}
},
{scopi::quaternion(0., axes_z)});
particles.push_back(p_left, scopi::property<dim>().deactivate());
scopi::plan<dim> p_right(
scopi::plane<dim> p_right(
{
{width_box + 2 * r0, 0., 0.}
},
{scopi::quaternion(0., axes_z)});
particles.push_back(p_right, scopi::property<dim>().deactivate());
scopi::plan<dim> p_horizontal(
scopi::plane<dim> p_horizontal(
{
{0., 0., 0.}
},
{scopi::quaternion(PI / 2., axes_z)});
particles.push_back(p_horizontal, scopi::property<dim>().deactivate());
scopi::plan<dim> p_front(
scopi::plane<dim> p_front(
{
{0., 0., 0.}
},
{scopi::quaternion(PI / 2., axes_y)});
particles.push_back(p_front, scopi::property<dim>().deactivate());
scopi::plan<dim> p_back(
scopi::plane<dim> p_back(
{
{0., 0., width_box + 2 * r0}
},
Expand Down
4 changes: 2 additions & 2 deletions demos/pile_of_sand_spheres.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <scopi/objects/types/plan.hpp>
#include <scopi/objects/types/plane.hpp>
#include <scopi/objects/types/sphere.hpp>
#include <scopi/solver.hpp>
#include <scopi/vap/vap_fpd.hpp>
Expand All @@ -24,7 +24,7 @@ int main(int argc, char** argv)
{0., -g, 0.}
});

scopi::plan<dim> p_horizontal(
scopi::plane<dim> p_horizontal(
{
{0., 0., 0.}
},
Expand Down
6 changes: 3 additions & 3 deletions demos/sphere_plan.cpp → demos/sphere_plane.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <scopi/objects/types/plan.hpp>
#include <scopi/objects/types/plane.hpp>
#include <scopi/objects/types/sphere.hpp>
#include <scopi/scopi.hpp>
#include <scopi/solver.hpp>
Expand All @@ -7,7 +7,7 @@

int main(int argc, char** argv)
{
scopi::initialize("sphere plan simulation");
scopi::initialize("sphere plane simulation");

constexpr std::size_t dim = 2;
double PI = xt::numeric_constants<double>::PI;
Expand All @@ -23,7 +23,7 @@ int main(int argc, char** argv)
double alpha = PI / 6.;

scopi::scopi_container<dim> particles;
scopi::plan<dim> p(
scopi::plane<dim> p(
{
{0., 0.}
},
Expand Down
4 changes: 2 additions & 2 deletions doc/source/api/objects/types/plan.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plan class
plane class
==========

.. doxygenclass:: scopi::plan
.. doxygenclass:: scopi::plane
:project: scopi
:members:
2 changes: 1 addition & 1 deletion doc/source/api/problems/DryWithFriction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ analytical_solution_sphere_plan functions
.. doxygenfunction:: scopi::analytical_solution_sphere_plan
:project: scopi

.. doxygenfunction:: scopi::analytical_solution_sphere_plan_velocity
.. doxygenfunction:: scopi::analytical_solution_sphere_plane_velocity
:project: scopi

ProblemParams<DryWithFriction> class
Expand Down
2 changes: 1 addition & 1 deletion doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Objects
api/objects/neighbor
api/objects/types/sphere
api/objects/types/superellipsoid
api/objects/types/plan
api/objects/types/plane
api/objects/types/worm

Problems
Expand Down
2 changes: 1 addition & 1 deletion include/scopi/contact/contact_kdtree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ namespace scopi
* @brief Kd-tree radius.
*
* For two particles \c i and \c j, compute the exact distance only if the squared distance between a point in \c i and a point in
* \c j is less than \c kdtree_radius. For a sphere or a superellipsoid, this point is the center. For a plan, it is the point used
* \c j is less than \c kdtree_radius. For a sphere or a superellipsoid, this point is the center. For a plane, it is the point used
* to construct it. \note \c kd_tree_radius > 0
*/
double kd_tree_radius{17.};
Expand Down
4 changes: 2 additions & 2 deletions include/scopi/container.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace scopi
* of the container.
*
* In the following, "particle" means a base object (sphere, superellipsoid
* or plan) and an "object" can be a more complex object, such as a worm.
* or plane) and an "object" can be a more complex object, such as a worm.
* Particles are objects.
*
* @tparam dim Dimension (2 or 3).
Expand Down Expand Up @@ -75,7 +75,7 @@ namespace scopi
/**
* @brief Reconstructs an object.
*
* An object can be a sphere, a superellipsoid, a plan, a worm,...
* An object can be a sphere, a superellipsoid, a plane, a worm,...
*
* @param i Index of the object.
*
Expand Down
46 changes: 23 additions & 23 deletions include/scopi/objects/methods/closest_points.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#include "../dispatch.hpp"
#include "../neighbor.hpp"
#include "../types/plan.hpp"
#include "../types/plane.hpp"
#include "../types/segment.hpp"
#include "../types/sphere.hpp"
#include "../types/superellipsoid.hpp"
Expand Down Expand Up @@ -732,7 +732,7 @@ namespace scopi
return neigh;
}

// PLAN - PLAN
// PLANE - PLANE
/**
* @brief Neighbor between two planes.
*
Expand All @@ -747,12 +747,12 @@ namespace scopi
* @return Neighbor struct for contact between plane \c i and plane \c j.
*/
template <class problem_t, std::size_t dim, bool owner>
auto closest_points(const plan<dim, owner>& /* p1 */, const plan<dim, owner>& /* p2 */)
auto closest_points(const plane<dim, owner>& /* p1 */, const plane<dim, owner>& /* p2 */)
{
return neighbor<dim, problem_t>();
}

// SPHERE - PLAN
// SPHERE - PLANE
/**
* @brief Neighbor between a sphere and a plane.
*
Expand All @@ -766,27 +766,27 @@ namespace scopi
* @return Neighbor struct for contact between sphere \c i and plane \c j.
*/
template <class problem_t, std::size_t dim, bool owner>
auto closest_points(const sphere<dim, owner>& s, const plan<dim, owner>& p)
auto closest_points(const sphere<dim, owner>& s, const plane<dim, owner>& p)
{
// std::cout << "closest_points : SPHERE - PLAN" << std::endl;
// std::cout << "closest_points : SPHERE - PLANE" << std::endl;
auto s_pos = s.pos(0);
auto p_pos = p.pos(0);

auto normal = p.normal();

// plan2sphs.n
auto plan_to_sphere = xt::eval(xt::linalg::dot(s_pos - p_pos, normal));
auto xtsign = xt::sign(plan_to_sphere);
auto plane_to_sphere = xt::eval(xt::linalg::dot(s_pos - p_pos, normal));
auto xtsign = xt::sign(plane_to_sphere);

neighbor<dim, problem_t> neigh;
neigh.pi = s_pos - xtsign * s.radius() * normal;
neigh.pj = s_pos - plan_to_sphere * normal;
neigh.pj = s_pos - plane_to_sphere * normal;
neigh.nij = xtsign * normal;
neigh.dij = xt::linalg::dot(neigh.pi - neigh.pj, neigh.nij)[0];
return neigh;
}

// PLAN - SPHERE
// PLANE - SPHERE
/**
* @brief Neighbor between a plane and a sphere.
*
Expand All @@ -800,7 +800,7 @@ namespace scopi
* @return Neighbor struct for contact between plane \c i and sphere \c j.
*/
template <class problem_t, std::size_t dim, bool owner>
auto closest_points(const plan<dim, owner>& p, const sphere<dim, owner>& s)
auto closest_points(const plane<dim, owner>& p, const sphere<dim, owner>& s)
{
auto neigh = closest_points<problem_t>(s, p);
neigh.nij *= -1.;
Expand Down Expand Up @@ -902,16 +902,16 @@ namespace scopi
}

template <class problem_t, std::size_t dim, bool owner>
auto closest_points(const plan<dim, owner>&, const segment<dim, owner>&)
auto closest_points(const plane<dim, owner>&, const segment<dim, owner>&)
{
std::cerr << "closest_points for plan/segment must be implemented" << std::endl;
std::cerr << "closest_points for plane/segment must be implemented" << std::endl;
return neighbor<dim, problem_t>();
}

template <class problem_t, std::size_t dim, bool owner>
auto closest_points(const segment<dim, owner>&, const plan<dim, owner>&)
auto closest_points(const segment<dim, owner>&, const plane<dim, owner>&)
{
std::cerr << "closest_points for segment/plan must be implemented" << std::endl;
std::cerr << "closest_points for segment/plane must be implemented" << std::endl;
return neighbor<dim, problem_t>();
}

Expand Down Expand Up @@ -1463,7 +1463,7 @@ namespace scopi
return neigh;
}

// SUPERELLIPSOID 3D - PLAN 3D
// SUPERELLIPSOID 3D - PLANE 3D
/**
* @brief Neighbor between a superellipsoid and a plane in 3D.
*
Expand All @@ -1476,9 +1476,9 @@ namespace scopi
* @return Neighbor struct for contact between superellipsod \c i and plane \c j.
*/
template <class problem_t, bool owner>
auto closest_points(const superellipsoid<3, owner> s1, const plan<3, owner> p2)
auto closest_points(const superellipsoid<3, owner> s1, const plane<3, owner> p2)
{
std::cout << "closest_points : SUPERELLIPSOID 3D - PLAN 3D" << std::endl;
std::cout << "closest_points : SUPERELLIPSOID 3D - PLANE 3D" << std::endl;
double pi = 4 * std::atan(1);
neighbor<3, problem_t> neigh;
// Pour déterminer de quel cote on est
Expand Down Expand Up @@ -1745,7 +1745,7 @@ namespace scopi
return neigh;
}

// PLAN 3D - SUPERELLIPSOID 3D
// PLANE 3D - SUPERELLIPSOID 3D
/**
* @brief Neighbor between a plane and a superellipsoid in 3D.
*
Expand All @@ -1759,7 +1759,7 @@ namespace scopi
* @return Neighbor struct for contact between plane \c i and superellipsoid \c j.
*/
template <class problem_t, bool owner>
auto closest_points(const plan<3, owner> p2, const superellipsoid<3, owner> s1)
auto closest_points(const plane<3, owner> p2, const superellipsoid<3, owner> s1)
{
auto neigh = closest_points<problem_t>(s1, p2);
neigh.nij *= -1.;
Expand All @@ -1780,7 +1780,7 @@ namespace scopi
*/
// SUPERELLIPSOID 2D - DROITE 2D
template <class problem_t, bool owner>
auto closest_points(const superellipsoid<2, owner> s1, const plan<2, owner> d2)
auto closest_points(const superellipsoid<2, owner> s1, const plane<2, owner> d2)
{
// std::cout << "closest_points : SUPERELLIPSOID 2D - DROITE 2D" << std::endl;
double pi = 4 * std::atan(1);
Expand Down Expand Up @@ -1949,7 +1949,7 @@ namespace scopi
*/
// DROITE 2D - SUPERELLIPSOID 2D
template <class problem_t, bool owner>
auto closest_points(const plan<2, owner> d2, const superellipsoid<2, owner> s1)
auto closest_points(const plane<2, owner> d2, const superellipsoid<2, owner> s1)
{
auto neigh = closest_points<problem_t>(s1, d2);
neigh.nij *= -1.;
Expand Down Expand Up @@ -2038,7 +2038,7 @@ namespace scopi
using closest_points_dispatcher = double_static_dispatcher<
closest_points_functor<problem_t, dim>,
const object<dim, owner>,
mpl::vector<const sphere<dim, owner>, const superellipsoid<dim, owner>, const plan<dim, owner>, const segment<dim, owner>>,
mpl::vector<const sphere<dim, owner>, const superellipsoid<dim, owner>, const plane<dim, owner>, const segment<dim, owner>>,
typename closest_points_functor<problem_t, dim>::return_type,
antisymmetric_dispatch>;
}
28 changes: 14 additions & 14 deletions include/scopi/objects/methods/distance.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "../dispatch.hpp"
#include "../types/globule.hpp"
#include "../types/plan.hpp"
#include "../types/plane.hpp"
#include "../types/sphere.hpp"
#include "../types/superellipsoid.hpp"

Expand All @@ -26,11 +26,11 @@ namespace scopi
return xt::linalg::norm(s1.pos() - s2.pos()) - s1.radius() - s2.radius();
}

// PLAN - PLAN
// PLANE - PLANE
template <std::size_t dim>
double distance(const plan<dim, false>, const plan<dim, false>)
double distance(const plane<dim, false>, const plane<dim, false>)
{
std::cout << "distance : PLAN - PLAN" << std::endl;
std::cout << "distance : PLANE - PLANE" << std::endl;
return 20;
}

Expand Down Expand Up @@ -58,11 +58,11 @@ namespace scopi
return 50;
}

// SPHERE - PLAN
// SPHERE - PLANE
template <std::size_t dim>
double distance(const sphere<dim, false>, const plan<dim, false>)
double distance(const sphere<dim, false>, const plane<dim, false>)
{
std::cout << "distance : SPHERE - PLAN" << std::endl;
std::cout << "distance : SPHERE - PLANE" << std::endl;
return 60;
}

Expand All @@ -74,19 +74,19 @@ namespace scopi
return 70;
}

// SUPERELLIPSOID - PLAN
// SUPERELLIPSOID - PLANE
template <std::size_t dim>
double distance(const superellipsoid<dim, false>, const plan<dim, false>)
double distance(const superellipsoid<dim, false>, const plane<dim, false>)
{
std::cout << "distance : SUPERELLIPSOID - PLAN" << std::endl;
std::cout << "distance : SUPERELLIPSOID - PLANE" << std::endl;
return 80;
}

// GLOBULE - PLAN
// GLOBULE - PLANE
template <std::size_t dim>
double distance(const globule<dim, false>, const plan<dim, false>)
double distance(const globule<dim, false>, const plane<dim, false>)
{
std::cout << "distance : GLOBULE - PLAN" << std::endl;
std::cout << "distance : GLOBULE - PLANE" << std::endl;
return 90;
}

Expand All @@ -111,7 +111,7 @@ namespace scopi
using distance_dispatcher = double_static_dispatcher<
distance_functor,
const object<dim, false>,
mpl::vector<const sphere<dim, false>, const superellipsoid<dim, false>, const globule<dim, false>, const plan<dim, false>>,
mpl::vector<const sphere<dim, false>, const superellipsoid<dim, false>, const globule<dim, false>, const plane<dim, false>>,
typename distance_functor::return_type,
symmetric_dispatch>;
}
Loading

0 comments on commit 7d7b502

Please sign in to comment.