-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New shape: Quarterpipe #3960
Closed
christophlohrmann
wants to merge
2
commits into
espressomd:python
from
christophlohrmann:smooth_corner
+445
−5
Closed
New shape: Quarterpipe #3960
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Copyright (C) 2010-2019 The ESPResSo project | ||
* | ||
* This file is part of ESPResSo. | ||
* | ||
* ESPResSo is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* ESPResSo is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef ESPRESSO_QUARTERPIPE_HPP | ||
#define ESPRESSO_QUARTERPIPE_HPP | ||
#include "Shape.hpp" | ||
#include <shapes/Quarterpipe.hpp> | ||
|
||
namespace ScriptInterface { | ||
namespace Shapes { | ||
|
||
class Quarterpipe : public Shape { | ||
public: | ||
Quarterpipe() : m_quarterpipe(new ::Shapes::Quarterpipe()) { | ||
add_parameters({{"center", | ||
[this](Variant const &v) { | ||
m_quarterpipe->set_center(get_value<Utils::Vector3d>(v)); | ||
}, | ||
[this]() { return m_quarterpipe->center(); }}, | ||
|
||
{"axis", | ||
[this](Variant const &v) { | ||
m_quarterpipe->set_axis(get_value<Utils::Vector3d>(v)); | ||
}, | ||
[this]() { return m_quarterpipe->axis(); }}, | ||
|
||
{"orientation", | ||
[this](Variant const &v) { | ||
m_quarterpipe->set_orientation( | ||
get_value<Utils::Vector3d>(v)); | ||
}, | ||
[this]() { return m_quarterpipe->orientation(); }}, | ||
|
||
{"radius", | ||
[this](Variant const &v) { | ||
m_quarterpipe->set_radius(get_value<double>(v)); | ||
}, | ||
[this]() { return m_quarterpipe->radius(); }}, | ||
|
||
{"height", | ||
[this](Variant const &v) { | ||
m_quarterpipe->set_height(get_value<double>(v)); | ||
}, | ||
[this]() { return m_quarterpipe->height(); }}}); | ||
} | ||
|
||
std::shared_ptr<::Shapes::Shape> shape() const override { | ||
return m_quarterpipe; | ||
} | ||
|
||
private: | ||
std::shared_ptr<::Shapes::Quarterpipe> m_quarterpipe; | ||
}; | ||
|
||
} /* namespace Shapes */ | ||
} /* namespace ScriptInterface */ | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Copyright (C) 2017-2019 The ESPResSo project | ||
* | ||
* This file is part of ESPResSo. | ||
* | ||
* ESPResSo is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* ESPResSo is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef SHAPES_QUARTERPIPE_HPP | ||
#define SHAPES_QUARTERPIPE_HPP | ||
|
||
#include "Shape.hpp" | ||
#include <utils/Vector.hpp> | ||
#include <utils/constants.hpp> | ||
|
||
namespace Shapes { | ||
|
||
/** | ||
* @brief Quarterpipe shape based on intersecting a cuboid | ||
* with a cylinder | ||
* | ||
* \image html quarterpipe_detailed.png width=1000px | ||
*/ | ||
|
||
class Quarterpipe : public Shape { | ||
public: | ||
Quarterpipe() | ||
: m_center{Utils::Vector3d{}}, m_axis{Utils::Vector3d{}}, | ||
m_orientation{Utils::Vector3d{}}, m_radius(0.), m_height(0.), | ||
m_delta_phi(0.5 * Utils::pi()) {} | ||
|
||
void set_center(Utils::Vector3d const ¢er) { m_center = center; } | ||
void set_axis(Utils::Vector3d const &axis) { | ||
auto axis_tmp(axis); | ||
m_axis = axis_tmp.normalize(); | ||
} | ||
void set_orientation(Utils::Vector3d const &orientation) { | ||
auto orientation_tmp(orientation); | ||
m_orientation = orientation_tmp.normalize(); | ||
} | ||
void set_radius(double const radius) { m_radius = radius; } | ||
void set_height(double const height) { m_height = height; } | ||
|
||
Utils::Vector3d const ¢er() const { return m_center; } | ||
Utils::Vector3d const &axis() const { return m_axis; } | ||
Utils::Vector3d const &orientation() const { return m_orientation; } | ||
double radius() const { return m_radius; } | ||
double height() const { return m_height; } | ||
|
||
void calculate_dist(const Utils::Vector3d &pos, double &dist, | ||
Utils::Vector3d &vec) const override; | ||
|
||
private: | ||
Utils::Vector3d m_center; | ||
Utils::Vector3d m_axis; | ||
Utils::Vector3d m_orientation; | ||
double m_radius; | ||
double m_height; | ||
double m_delta_phi; | ||
}; | ||
} // namespace Shapes | ||
|
||
#endif |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the shape becomes unsafe when side walls touch the periodic boundaries. Then Particles can enter the interaction region from the other side and pick up a lot of potential energy that propels them through the box. I will change the
height
though to hide the top/bottom