Skip to content

Commit

Permalink
files: add system states
Browse files Browse the repository at this point in the history
  • Loading branch information
skim0119 committed Jul 12, 2024
1 parent 5b28ec7 commit b42fab3
Show file tree
Hide file tree
Showing 57 changed files with 5,345 additions and 12 deletions.
26 changes: 26 additions & 0 deletions backend/src/Systems/CosseratRods/Aliases/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Distributed under the MIT License. See LICENSE.txt for details.

set(LIBRARY CosseratRodAliases)

add_elastica_library(${LIBRARY} INTERFACE)

elastica_target_headers(
${LIBRARY}
INCLUDE_DIRECTORY ${CMAKE_SOURCE_DIR}/elastica
CosseratRod.hpp
CosseratRodWithoutDamping.hpp
)

elastica_target_sources(
${LIBRARY}
INTERFACE
CosseratRod.hpp
CosseratRodWithoutDamping.hpp
)

target_link_libraries(
${LIBRARY}
INTERFACE
CosseratRodComponents
CosseratRodTraits
)
93 changes: 93 additions & 0 deletions backend/src/Systems/CosseratRods/Aliases/CosseratRod.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#pragma once

//******************************************************************************
// Includes
//******************************************************************************
// common
#include "Systems/common/Types.hpp"
// blocks
#include "Systems/Block/Types.hpp"
// cosserat rod components
#include "Systems/CosseratRods/_Types.hpp"
#include "Systems/CosseratRods/Components/Names/CosseratRod.hpp"

namespace elastica {

namespace cosserat_rod {

namespace detail {

template <typename T, typename B>
using CosseratRodComponents = ::elastica::SymplecticPolicy<
T, B, ::elastica::cosserat_rod::component::WithCircularCosseratRod,
::elastica::cosserat_rod::component::
WithExplicitlyDampedDiagonalLinearHyperElasticModel,
::elastica::cosserat_rod::component::WithRodKinematics,
::elastica::cosserat_rod::component::CosseratRodNameAdapted>;

using CosseratRod = ::elastica::cosserat_rod::CosseratRodPlugin<
::elastica::cosserat_rod::DefaultCosseratRodTraits, ::blocks::Block,
detail::CosseratRodComponents>;
using CosseratRodSlice = ::elastica::cosserat_rod::CosseratRodPlugin<
::elastica::cosserat_rod::DefaultCosseratRodTraits,
::blocks::BlockSlice, detail::CosseratRodComponents>;
using CosseratRodConstSlice = ::elastica::cosserat_rod::CosseratRodPlugin<
::elastica::cosserat_rod::DefaultCosseratRodTraits,
::blocks::ConstBlockSlice, detail::CosseratRodComponents>;
using CosseratRodView = ::elastica::cosserat_rod::CosseratRodPlugin<
::elastica::cosserat_rod::DefaultCosseratRodTraits,
::blocks::BlockView, detail::CosseratRodComponents>;
using CosseratRodConstView = ::elastica::cosserat_rod::CosseratRodPlugin<
::elastica::cosserat_rod::DefaultCosseratRodTraits,
::blocks::ConstBlockView, detail::CosseratRodComponents>;

using CosseratRodBlock = ::blocks::Block<CosseratRod>;
using CosseratRodBlockSlice = ::blocks::BlockSlice<CosseratRodSlice>;
using CosseratRodBlockConstSlice =
::blocks::ConstBlockSlice<CosseratRodConstSlice>;
using CosseratRodBlockView = ::blocks::BlockView<CosseratRodView>;
using CosseratRodBlockConstView =
::blocks::ConstBlockView<CosseratRodConstView>;

} // namespace detail

// clang-format off

//**************************************************************************
/*!\brief The main type of Cosserat rod in \elastica.
* \ingroup cosserat_rod
*
* \details
* CosseratRod is the preferred type for modeling CosseratRods with internal
* dissipation in \elastica. It leverages the performance the @ref blocks
* machinery and the flexibility of CosseratRodPlugin enhanced with the
* composability of @ref cosserat_rod_component to generate a fast, compact
* and efficient CosseratRod data-structure. Users can utilize this to add
* cosserat rods to a simulator, as detailed in the tutorials.
*
* ### Tags
* The member data can be accessed using @ref tags. For example, accessing
* the position of a rod is done as shown below
* \snippet tutorial_single_rod/tutorial_single_rod.cpp tag_example
*
* The Cosserat rod supports other tags, one for each variable it contains,
* documented below.
* \copydetails elastica::cosserat_rod::CosseratRodPluginTagsDocsStub
* \copydetails elastica::cosserat_rod::component::WithCircularCosseratRodTagsDocsStub
* \copydetails elastica::cosserat_rod::component::WithExplicitlyDampedDiagonalLinearHyperElasticModelTagsDocsStub
* \copydetails elastica::cosserat_rod::component::WithRodKinematicsTagsDocsStub
*
* ### Member functions
* Additionally, you can also access variables by its member functions. The
* convention for the member function is `get_{name}` where `{name}` is the
* tag name in small letters. For example, to access the variable
* elastica::tags::Position above, you can invoke the `get_position()` member
* function
*/
// clang-format on
using CosseratRod = detail::CosseratRod;
//**************************************************************************

} // namespace cosserat_rod

} // namespace elastica
104 changes: 104 additions & 0 deletions backend/src/Systems/CosseratRods/Aliases/CosseratRodWithoutDamping.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
#pragma once

//******************************************************************************
// Includes
//******************************************************************************
// common
#include "Systems/common/Types.hpp"
// blocks
#include "Systems/Block/Types.hpp"
// cosserat rod components
#include "Systems/CosseratRods/_Types.hpp"
#include "Systems/CosseratRods/Components/Names/CosseratRodWithoutDamping.hpp"

namespace elastica {

namespace cosserat_rod {

namespace detail {

template <typename T, typename B>
using CosseratRodWithoutDampingComponents = ::elastica::SymplecticPolicy<
T, B, ::elastica::cosserat_rod::component::WithCircularCosseratRod,
::elastica::cosserat_rod::component::
WithDiagonalLinearHyperElasticModel,
::elastica::cosserat_rod::component::WithRodKinematics,
::elastica::cosserat_rod::component::
CosseratRodWithoutDampingNameAdapted>;

using CosseratRodWithoutDamping =
::elastica::cosserat_rod::CosseratRodPlugin<
::elastica::cosserat_rod::DefaultCosseratRodTraits,
::blocks::Block, detail::CosseratRodWithoutDampingComponents>;
using CosseratRodWithoutDampingSlice =
::elastica::cosserat_rod::CosseratRodPlugin<
::elastica::cosserat_rod::DefaultCosseratRodTraits,
::blocks::BlockSlice,
detail::CosseratRodWithoutDampingComponents>;
using CosseratRodWithoutDampingConstSlice =
::elastica::cosserat_rod::CosseratRodPlugin<
::elastica::cosserat_rod::DefaultCosseratRodTraits,
::blocks::ConstBlockSlice,
detail::CosseratRodWithoutDampingComponents>;
using CosseratRodWithoutDampingView =
::elastica::cosserat_rod::CosseratRodPlugin<
::elastica::cosserat_rod::DefaultCosseratRodTraits,
::blocks::BlockView, detail::CosseratRodWithoutDampingComponents>;
using CosseratRodWithoutDampingConstView =
::elastica::cosserat_rod::CosseratRodPlugin<
::elastica::cosserat_rod::DefaultCosseratRodTraits,
::blocks::ConstBlockView,
detail::CosseratRodWithoutDampingComponents>;

using CosseratRodWithoutDampingBlock =
::blocks::Block<CosseratRodWithoutDamping>;
using CosseratRodWithoutDampingBlockSlice =
::blocks::BlockSlice<CosseratRodWithoutDampingSlice>;
using CosseratRodWithoutDampingBlockConstSlice =
::blocks::ConstBlockSlice<CosseratRodWithoutDampingConstSlice>;
using CosseratRodWithoutDampingBlockView =
::blocks::BlockView<CosseratRodWithoutDampingView>;
using CosseratRodWithoutDampingBlockConstView =
::blocks::ConstBlockView<CosseratRodWithoutDampingConstView>;

} // namespace detail

// clang-format off
//**************************************************************************
/*!\brief Cosserat rod without internal damping in \elastica.
* \ingroup cosserat_rod
*
* \details
* CosseratRodWithoutDamping models CosseratRods without internal
* dissipation in \elastica. It leverages the performance the @ref blocks
* machinery and the flexibility of CosseratRodPlugin enhanced with the
* composability of @ref cosserat_rod_component to generate a fast, compact
* and efficient CosseratRod data-structure. Users can utilize this to add
* cosserat rods to a simulator, as detailed in the tutorials.
*
* ### Tags
* The member data can be accessed using @ref tags. For example, accessing
* the position of a rod is done as shown below
* \snippet tutorial_single_rod/tutorial_single_rod.cpp tag_example
*
* The Cosserat rod supports other tags, one for each variable it contains,
* documented below.
* \copydetails elastica::cosserat_rod::CosseratRodPluginTagsDocsStub
* \copydetails elastica::cosserat_rod::component::WithCircularCosseratRodTagsDocsStub
* \copydetails elastica::cosserat_rod::component::WithDiagonalLinearHyperElasticModelTagsDocsStub
* \copydetails elastica::cosserat_rod::component::WithRodKinematicsTagsDocsStub
*
* ### Member functions
* Additionally, you can also access variables by its member functions. The
* convention for the member function is `get_{name}` where `{name}` is the
* tag name in small letters. For example, to access the variable
* elastica::tags::Position above, you can invoke the `get_position()`
* member function
*/
// clang-format on
using CosseratRodWithoutDamping = detail::CosseratRodWithoutDamping;
//**************************************************************************

} // namespace cosserat_rod

} // namespace elastica
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
//
// Created by Tejaswin Parthasarathy on 10/30/21.
//

#pragma once

//******************************************************************************
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
//
// Created by Tejaswin Parthasarathy on 5/20/21.
//

#pragma once

#include <string>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
//
// Created by Tejaswin Parthasarathy on 1/8/22.
//

#pragma once

#include <string>
Expand Down
8 changes: 8 additions & 0 deletions backend/src/Systems/CosseratRods/Utility.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#pragma once

//******************************************************************************
// Includes
//******************************************************************************

#include "Systems/CosseratRods/Utility/CenterOfMass.hpp"
#include "Systems/CosseratRods/Utility/Energy.hpp"
35 changes: 35 additions & 0 deletions backend/src/Systems/States/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Distributed under the MIT License. See LICENSE.txt for details.

set(LIBRARY States)

add_elastica_library(${LIBRARY} INTERFACE)

elastica_target_headers(
${LIBRARY}
INCLUDE_DIRECTORY ${CMAKE_SOURCE_DIR}/elastica
HEADERS
States.hpp
Types.hpp
TypeTraits.hpp
)

elastica_target_sources(
${LIBRARY}
INTERFACE
States.hpp
Types.hpp
TypeTraits.hpp
)

add_subdirectory(Expressions)
add_library(${LIBRARY}::Expressions ALIAS StateExpressions)

add_subdirectory(TypeTraits)
add_library(${LIBRARY}::TypeTraits ALIAS StateTypeTraits)

target_link_libraries(
${LIBRARY}
INTERFACE
StateExpressions
StateTypeTraits
)
8 changes: 8 additions & 0 deletions backend/src/Systems/States/Concepts.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
* Concepts

* Basic Expression templates modeled after the Blaze library.
* No need to make it too "smart" : Blaze handles that load
* Need to make it variadic to handle many number of disjointly
evolving "states" : any dependence should come from the kernels
* LICENSE : BSD, from blaze
* TODO : Make it official (include blaze's headers etc.) in every file.
1 change: 1 addition & 0 deletions backend/src/Systems/States/Expressions/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Traits/*
55 changes: 55 additions & 0 deletions backend/src/Systems/States/Expressions/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Distributed under the MIT License. See LICENSE.txt for details.

set(LIBRARY StateExpressions)

add_elastica_library(${LIBRARY} INTERFACE)

elastica_target_headers(
${LIBRARY}
INCLUDE_DIRECTORY ${CMAKE_SOURCE_DIR}/elastica
HEADERS
backends.hpp
OrderTags.hpp
SE3.hpp
SO3.hpp
States.hpp
)

elastica_target_sources(
${LIBRARY}
INTERFACE
backends.hpp
OrderTags.hpp
SE3.hpp
SO3.hpp
States.hpp
)

add_subdirectory(backends)
add_library(${LIBRARY}::Backends ALIAS StateExpressionBackends)

add_subdirectory(Expr)
add_library(${LIBRARY}::Expr ALIAS StateExpressionTemplates)

add_subdirectory(OrderTags)
add_library(${LIBRARY}::OrderTags ALIAS StateExpressionOrderTags)

add_subdirectory(SE3)
add_library(${LIBRARY}::SE3 ALIAS SE3Expressions)

add_subdirectory(SO3)
add_library(${LIBRARY}::SO3 ALIAS SO3Expressions)

add_subdirectory(States)
add_library(${LIBRARY}::States ALIAS StateTemplates)

target_link_libraries(
${LIBRARY}
INTERFACE
StateExpressionOrderTags
StateExpressionTemplates
StateExpressionBackends
SE3Expressions
SO3Expressions
StateTemplates
)
32 changes: 32 additions & 0 deletions backend/src/Systems/States/Expressions/Expr/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Distributed under the MIT License. See LICENSE.txt for details.

set(LIBRARY StateExpressionTemplates)

add_elastica_library(${LIBRARY} INTERFACE)

elastica_target_headers(
${LIBRARY}
INCLUDE_DIRECTORY ${CMAKE_SOURCE_DIR}/elastica
StateAddExpr.hpp
StateExpr.hpp
StateTimeDeltaMultExprBase.hpp
StateTimeMultExpr.hpp
)

elastica_target_sources(
${LIBRARY}
INTERFACE
StateAddExpr.hpp
StateExpr.hpp
StateTimeDeltaMultExprBase.hpp
StateTimeMultExpr.hpp
)


target_link_libraries(
${LIBRARY}
INTERFACE
Utilities
ErrorHandling
StateTypeTraits
)
Loading

0 comments on commit b42fab3

Please sign in to comment.