forked from GazzolaLab/PyElastica
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
46 changed files
with
6,053 additions
and
14 deletions.
There are no files selected for viewing
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,8 @@ | ||
#pragma once | ||
|
||
//****************************************************************************** | ||
// Includes | ||
//****************************************************************************** | ||
#include "Systems/Block/Block.hpp" | ||
// do not include in block as it overrides an elastica namespace function | ||
// #include "Systems/Block/Serialize.hpp" |
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,11 @@ | ||
#pragma once | ||
|
||
//****************************************************************************** | ||
// Includes | ||
//****************************************************************************** | ||
#include "Systems/CosseratRods/CosseratRods.hpp" | ||
// include utilities | ||
#include "Systems/CosseratRods/Access.hpp" | ||
// #include "Systems/CosseratRods/Serialize.hpp" | ||
#include "Systems/CosseratRods/Utility.hpp" | ||
// #include "Systems/Customization/CosseratRods.hpp" |
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,59 @@ | ||
#pragma once | ||
|
||
//****************************************************************************** | ||
// Includes | ||
//****************************************************************************** | ||
/// Types first | ||
#include "Systems/CosseratRods/Components/Types.hpp" | ||
/// | ||
#include "Systems/CosseratRods/Components/Elasticity.hpp" | ||
#include "Systems/CosseratRods/Components/Geometry.hpp" | ||
#include "Systems/CosseratRods/Components/Kinematics.hpp" | ||
#include "Systems/CosseratRods/Components/Names.hpp" | ||
#include "Systems/CosseratRods/Components/Tags.hpp" | ||
#include "Systems/CosseratRods/Components/helpers.hpp" | ||
|
||
namespace elastica { | ||
|
||
namespace cosserat_rod { | ||
|
||
//************************************************************************** | ||
/*!\defgroup cosserat_rod_component Cosserat Rod Components | ||
* \ingroup cosserat_rod | ||
* \brief Data-structures to customize orthogonal aspects of Cosserat rods | ||
* | ||
* \details | ||
* `Components` are structures customizing orthogonal aspects of a Cosserat | ||
* rod within \elastica. Indeed, a typical rod has features broadly | ||
* encompassing geometry, elasticity etc. which can be decoupled from one | ||
* another and whose communication happens by a common interface/protocol. | ||
* These features are implemented as `Components`. Within | ||
* the parlance of `c++`, `Components` are implemented as curious mixins | ||
* intended as policy classes that control the behavior of the downstream | ||
* Cosserat-rod blocks and its slices. | ||
*/ | ||
//************************************************************************** | ||
|
||
//************************************************************************** | ||
/*!\defgroup cosserat_rod_custom_entries Cosserat Rod customization | ||
* \ingroup cosserat_rod_component | ||
* \brief Entry points to customize core-rod functionality | ||
* | ||
* \details | ||
* To customize the behavior of the library-provided CosseratRods, users are | ||
* encouraged to overload these set of functions with the following | ||
* signature | ||
* TODO | ||
*/ | ||
//************************************************************************** | ||
|
||
//************************************************************************** | ||
/*!\brief Components comprising Cosserat rods | ||
// \ingroup cosserat_rod_component | ||
*/ | ||
namespace component {} | ||
//************************************************************************** | ||
|
||
} // namespace cosserat_rod | ||
|
||
} // namespace elastica |
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 @@ | ||
StrongTypes.hpp |
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,9 @@ | ||
#pragma once | ||
|
||
//****************************************************************************** | ||
// Includes | ||
//****************************************************************************** | ||
/// Types first | ||
#include "Systems/CosseratRods/Components/Elasticity/Types.hpp" | ||
/// | ||
#include "Systems/CosseratRods/Components/Elasticity/Components.hpp" |
13 changes: 13 additions & 0 deletions
13
backend/src/Systems/CosseratRods/Components/Elasticity/Components.hpp
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,13 @@ | ||
#pragma once | ||
|
||
//****************************************************************************** | ||
// Includes | ||
//****************************************************************************** | ||
/// Types always first | ||
#include "Systems/CosseratRods/Components/Elasticity/Types.hpp" | ||
/// | ||
/// details next | ||
#include "Systems/CosseratRods/Components/Elasticity/detail/Components.hpp" | ||
/// | ||
#include "Systems/CosseratRods/Components/Elasticity/WithDiagonalLinearHyperElasticModel.hpp" | ||
#include "Systems/CosseratRods/Components/Elasticity/WithExplicitlyDampedDiagonalLinearHyperElasticModel.hpp" |
233 changes: 233 additions & 0 deletions
233
backend/src/Systems/CosseratRods/Components/Elasticity/ExplicitDampingAdapter.hpp
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,233 @@ | ||
#pragma once | ||
|
||
//****************************************************************************** | ||
// Includes | ||
//****************************************************************************** | ||
#include <cmath> | ||
#include <utility> | ||
|
||
///// Types always first | ||
#include "Systems/CosseratRods/Components/Elasticity/Types.hpp" | ||
///// | ||
#include "Systems/CosseratRods/Components/Elasticity/detail/ExplicitDampingAdapter.hpp" | ||
#include "Utilities/Math/Vec3.hpp" | ||
#include "Utilities/ProtocolHelpers.hpp" | ||
#include "Utilities/Requires.hpp" | ||
|
||
namespace elastica { | ||
|
||
namespace cosserat_rod { | ||
|
||
namespace component { | ||
|
||
//======================================================================== | ||
// | ||
// CLASS DEFINITION | ||
// | ||
//======================================================================== | ||
|
||
//************************************************************************ | ||
/*!\brief Adapter for adding explicit damping to an elasticity component | ||
* \ingroup cosserat_rod_component | ||
* | ||
* \details | ||
* ExplicitDampingAdapter adapts an Elasticity component for use | ||
* within Cosserat rods implemented in the Blocks framework. It adds | ||
* an additional damping force and torque to those arising from the | ||
* Elasticity model. It assumes that the Elasticity model operates on a | ||
* 1-D parametrized entity spanning a single spatial dimension (i.e. | ||
* along center-line coordinates, such as a Cosserat rod data-structure). | ||
* By design it only binds to classes with signature of a Component. | ||
* | ||
* \usage | ||
* Since ExplicitDampingAdapter is useful for wrapping an | ||
* ElasticityModel with additional damping, one should use it using the | ||
* Adapt class as follows: | ||
* | ||
* \code | ||
* template <typename Traits, typename Block> | ||
* class MyCustomElasticityModel : public | ||
* Component<MyCustomElasticityModel<Traits, Block>> { | ||
* // ...implementation | ||
* }; | ||
* | ||
* template <typename Traits, typename Block> | ||
* class MyCustomElasticityModelWithDamping : public | ||
* Adapt<MyCustomElasticityModel<CRT, ComputationalBlock>>:: | ||
* template with<ExplicitDampingAdapter> {}; | ||
* \endcode | ||
* | ||
* Note that however, this does not provide the appropriate interface | ||
* required by the rest of the components within a Cosserat rod hierarchy. | ||
* To do so, we need to add the ElasticityInterface adapter, like so | ||
* | ||
* \code | ||
* template <typename Traits, typename Block> | ||
* class MyCustomElasticityModelWithDampingPerRodThatWorks : public | ||
* Adapt<MyCustomElasticityModel<CRT, ComputationalBlock>>:: | ||
* template with<ElasticityInterface, ExplicitDampingAdapter> | ||
* {}; | ||
* \endcode | ||
* The ElasticityInterface needs to be the left-most argument to with, | ||
* else a compilation error is raised. | ||
* | ||
* \tparam CRT A valid Cosserat Rod Traits class | ||
* \tparam ComputationalBlock The final block which is derived from the | ||
* current component | ||
* \tparam ElasticityModelParam The user defined elasticity model which | ||
* is to be wrapped in the interface type | ||
* | ||
* \see ExplicitDampingAdapterVariables | ||
*/ | ||
using detail::ExplicitDampingAdapter; | ||
//************************************************************************ | ||
|
||
//======================================================================== | ||
// | ||
// CLASS DEFINITION | ||
// | ||
//======================================================================== | ||
|
||
//************************************************************************ | ||
/*!\brief Adapter for adding explicit damping to an elasticity component | ||
* \ingroup cosserat_rod_component | ||
* | ||
* \details | ||
* ExplicitDampingAdapterPerRod adapts an Elasticity component for use | ||
* within Cosserat rods implemented in the Blocks framework. It adds | ||
* an additional damping force and torque to those arising from the | ||
* Elasticity model. It assumes that the Elasticity model operates on a | ||
* 1-D parametrized entity spanning a single spatial dimension (i.e. | ||
* along center-line coordinates, such as a Cosserat rod data-structure). | ||
* By design it only binds to classes with signature of a Component. | ||
* Note that instead of having damping for every grid node/element | ||
* (which is achieved by ExplicitDampingAdapter) it reserves the same | ||
* damping for an entire rod. | ||
* | ||
* \usage | ||
* Since ExplicitDampingAdapterPerRod is useful for wrapping an | ||
* ElasticityModel with additional damping, one should use it using the | ||
* Adapt class as follows: | ||
* | ||
* \code | ||
* template <typename Traits, typename Block> | ||
* class MyCustomElasticityModel : public | ||
* Component<MyCustomElasticityModel<Traits, Block>> { | ||
* // ...implementation | ||
* }; | ||
* | ||
* template <typename Traits, typename Block> | ||
* class MyCustomElasticityModelWithDampingPerRod : public | ||
* Adapt<MyCustomElasticityModel<CRT, ComputationalBlock>>:: | ||
* template with<ExplicitDampingAdapterPerRod> {}; | ||
* \endcode | ||
* | ||
* Note that however, this does not provide the appropriate interface | ||
* required by the rest of the components within a Cosserat rod hierarchy. | ||
* To do so, we need to add the ElasticityInterface adapter, like so | ||
* | ||
* \code | ||
* template <typename Traits, typename Block> | ||
* class MyCustomElasticityModelWithDampingPerRodThatWorks : public | ||
* Adapt<MyCustomElasticityModel<CRT, ComputationalBlock>>:: | ||
* template with<ElasticityInterface, ExplicitDampingAdapterPerRod> | ||
* {}; | ||
* \endcode | ||
* The ElasticityInterface needs to be the left-most argument to with, | ||
* else a compilation error is raised. | ||
* | ||
* | ||
* \tparam CRT A valid Cosserat Rod Traits class | ||
* \tparam ComputationalBlock The final block which is derived from the | ||
* current component | ||
* \tparam ElasticityModelParam The user defined elasticity model which | ||
* is to be wrapped in the interface type | ||
* | ||
* \see ExplicitDampingAdapterVariablesPerRod | ||
*/ | ||
using detail::ExplicitDampingAdapterPerRod; | ||
//************************************************************************ | ||
|
||
//// should not include any protocols | ||
// template < | ||
// typename CRT, // Cosserat Rod Traits | ||
// typename ComputationalBlock, // Block | ||
// template <typename /*CRT*/, typename /* ComputationalBlock*/, | ||
// typename...> class ElasticityModelParam, typename... | ||
// ElasticityModelMetaArgs> | ||
// class ExplicitDampingAdapter< | ||
// CRT, ComputationalBlock, | ||
// ElasticityModelParam<CRT, ComputationalBlock, | ||
// ElasticityModelMetaArgs...>> : public detail::ElasticityInterface< | ||
// CRT, ComputationalBlock, | ||
// detail::ExplicitDampingAdapter< | ||
// CRT, ComputationalBlock, | ||
// ElasticityModelParam<CRT, ComputationalBlock, | ||
// ElasticityModelMetaArgs...>>> { | ||
// private: | ||
// using Traits = CRT; | ||
// using ThisModel = ElasticityModelParam<Traits, ComputationalBlock, | ||
// ElasticityModelMetaArgs...>; | ||
// using This = ExplicitDampingAdapter<Traits, ComputationalBlock, | ||
// ThisModel>; using Implementation = | ||
// detail::ExplicitDampingAdapter<Traits, ComputationalBlock, | ||
// ThisModel>; | ||
// using Parent = | ||
// detail::ElasticityInterface<Traits, ComputationalBlock, | ||
// Implementation>; | ||
// | ||
// protected: | ||
// static_assert(std::is_same<ThisModel, ElasticityModel>::value, | ||
// "Invariant failure!"); | ||
// | ||
// using Parent::initialize; | ||
// using typename Parent::ComputedVariables; | ||
// using typename Parent::InitializedVariables; | ||
// using typename Parent::Variables; | ||
// }; | ||
// | ||
//// should not include any protocols | ||
// template < | ||
// typename CRT, // Cosserat Rod Traits | ||
// typename ComputationalBlock, // Block | ||
// template <typename /*CRT*/, typename /* ComputationalBlock*/, | ||
// typename...> class ElasticityModelParam, typename... | ||
// ElasticityModelMetaArgs> | ||
// class ExplicitDampingAdapterPerRod< | ||
// CRT, ComputationalBlock, | ||
// ElasticityModelParam<CRT, ComputationalBlock, | ||
// ElasticityModelMetaArgs...>> : public detail::ElasticityInterface< | ||
// CRT, ComputationalBlock, | ||
// detail::ExplicitDampingAdapterPerRod< | ||
// CRT, ComputationalBlock, | ||
// ElasticityModelParam<CRT, ComputationalBlock, | ||
// ElasticityModelMetaArgs...>>> { | ||
// private: | ||
// using Traits = CRT; | ||
// using ThisModel = ElasticityModelParam<Traits, ComputationalBlock, | ||
// ElasticityModelMetaArgs...>; | ||
// using This = | ||
// ExplicitDampingAdapterPerRod<Traits, ComputationalBlock, | ||
// ThisModel>; | ||
// using Implementation = | ||
// detail::ExplicitDampingAdapterPerRod<Traits, ComputationalBlock, | ||
// ThisModel>; | ||
// using Parent = | ||
// detail::ElasticityInterface<Traits, ComputationalBlock, | ||
// Implementation>; | ||
// | ||
// protected: | ||
// static_assert(std::is_same<ThisModel, ElasticityModel>::value, | ||
// "Invariant failure!"); | ||
// | ||
// using Parent::initialize; | ||
// using typename Parent::ComputedVariables; | ||
// using typename Parent::InitializedVariables; | ||
// using typename Parent::Variables; | ||
// }; | ||
|
||
} // namespace component | ||
|
||
} // namespace cosserat_rod | ||
|
||
} // namespace elastica |
Oops, something went wrong.