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
7 changed files
with
357 additions
and
0 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,2 @@ | ||
#Parallel.hpp | ||
#Profiling.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,128 @@ | ||
#pragma once | ||
|
||
//****************************************************************************** | ||
/*!\brief Selection of the default backend for quadrature | ||
* \ingroup default_config | ||
* | ||
* The following execution policies are available: | ||
* - scalar | ||
* - simd | ||
* - blaze | ||
* | ||
* This can be customized if needed in the client file. | ||
*/ | ||
#ifndef ELASTICA_COSSERATROD_LIB_QUADRATURE_BACKEND | ||
#define ELASTICA_COSSERATROD_LIB_QUADRATURE_BACKEND simd | ||
#endif | ||
//****************************************************************************** | ||
|
||
//****************************************************************************** | ||
/*!\brief Selection of the default backend for difference | ||
* \ingroup default_config | ||
* | ||
* The following execution policies are available: | ||
* - scalar | ||
* - simd | ||
* - blaze | ||
* | ||
* This can be customized if needed in the client file. | ||
*/ | ||
#ifndef ELASTICA_COSSERATROD_LIB_DIFFERENCE_BACKEND | ||
#define ELASTICA_COSSERATROD_LIB_DIFFERENCE_BACKEND simd | ||
#endif | ||
//****************************************************************************** | ||
|
||
//****************************************************************************** | ||
/*!\brief Selection of the default backend for matvec | ||
* \ingroup default_config | ||
* | ||
* The following execution policies are available: | ||
* - scalar | ||
* - simd | ||
* - blaze | ||
* | ||
* This can be customized if needed in the client file. | ||
*/ | ||
#ifndef ELASTICA_COSSERATROD_LIB_MATVEC_BACKEND | ||
#define ELASTICA_COSSERATROD_LIB_MATVEC_BACKEND simd | ||
#endif | ||
//****************************************************************************** | ||
|
||
//****************************************************************************** | ||
/*!\brief Selection of the default backend for vector-scalar division | ||
* \ingroup default_config | ||
* | ||
* The following execution policies are available: | ||
* - scalar | ||
* - simd | ||
* - blaze | ||
* | ||
* This can be customized if needed in the client file. | ||
*/ | ||
#ifndef ELASTICA_COSSERATROD_LIB_VECSCALARDIV_BACKEND | ||
#define ELASTICA_COSSERATROD_LIB_VECSCALARDIV_BACKEND simd | ||
#endif | ||
//****************************************************************************** | ||
|
||
//****************************************************************************** | ||
/*!\brief Selection of the default backend for vector-scalar multiplication | ||
* \ingroup default_config | ||
* | ||
* The following execution policies are available: | ||
* - scalar | ||
* - simd | ||
* - blaze | ||
* | ||
* This can be customized if needed in the client file. | ||
*/ | ||
#ifndef ELASTICA_COSSERATROD_LIB_VECSCALARMULT_BACKEND | ||
#define ELASTICA_COSSERATROD_LIB_VECSCALARMULT_BACKEND simd | ||
#endif | ||
//****************************************************************************** | ||
|
||
//****************************************************************************** | ||
/*!\brief Selection of the default backend for cross products | ||
* \ingroup default_config | ||
* | ||
* The following execution policies are available: | ||
* - scalar | ||
* - simd | ||
* - blaze | ||
* | ||
* This can be customized if needed in the client file. | ||
*/ | ||
#ifndef ELASTICA_COSSERATROD_LIB_CROSSPRODUCT_BACKEND | ||
#define ELASTICA_COSSERATROD_LIB_CROSSPRODUCT_BACKEND simd | ||
#endif | ||
//****************************************************************************** | ||
|
||
//****************************************************************************** | ||
/*!\brief Selection of the default backend for inv rotate divide | ||
* \ingroup default_config | ||
* | ||
* The following execution policies are available: | ||
* - scalar | ||
* - simd | ||
* - blaze | ||
* | ||
* This can be customized if needed in the client file. | ||
*/ | ||
#ifndef ELASTICA_COSSERATROD_LIB_INV_ROTATE_DIVIDE_BACKEND | ||
#define ELASTICA_COSSERATROD_LIB_INV_ROTATE_DIVIDE_BACKEND simd | ||
#endif | ||
//****************************************************************************** | ||
|
||
//****************************************************************************** | ||
/*!\brief Selection of the default backend for SO3+= | ||
* \ingroup default_config | ||
* | ||
* The following execution policies are available: | ||
* - scalar | ||
* - simd | ||
* | ||
* This can be customized if needed in the client file. | ||
*/ | ||
#ifndef ELASTICA_COSSERATROD_LIB_SO3_ADDITION_BACKEND | ||
#define ELASTICA_COSSERATROD_LIB_SO3_ADDITION_BACKEND simd | ||
#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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#pragma once | ||
|
||
//****************************************************************************** | ||
/*!\brief Selection of the level of logging. | ||
* \ingroup config logging | ||
* | ||
* This macro selects the level of logging, to effectively filter out logs that | ||
* are not deemed necessary. Any logs below the level chosen are not reported | ||
* while a logging level comprises all higher logging levels. For instance, | ||
* if the set ELASTICA_LOG_LEVEL() is `info`, then logs marked with `debug` are | ||
* not printed, but all errors and warning are also printed to the log file(s). | ||
* The following log levels can be chosen: | ||
* | ||
* - ::elastica::logging::inactive | ||
* - ::elastica::logging::error | ||
* - ::elastica::logging::warning | ||
* - ::elastica::logging::info | ||
* - ::elastica::logging::debug | ||
* | ||
* \see elastica::logging::LoggingLevel | ||
*/ | ||
#ifndef ELASTICA_LOG_LEVEL | ||
#define ELASTICA_LOG_LEVEL ::elastica::logging::info | ||
#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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#pragma once | ||
|
||
//****************************************************************************** | ||
/*!\brief Compilation switch for the (de-)activation of the shared-memory | ||
* parallelization | ||
* \ingroup config parallel | ||
* | ||
* This compilation switch enables/disables the shared-memory parallelization. | ||
* In case the switch is set to 1 (i.e. in case the shared-memory | ||
* parallelization is enabled), \elastica is allowed to execute operations in | ||
* parallel. In case the switch is set to 0 (i.e. parallelization | ||
* is disabled), \elastica is restricted from executing operations in parallel. | ||
* | ||
* Possible settings for the shared-memory parallelization switch: | ||
* - Deactivated: \b 0 | ||
* - Activated : \b 1 (default) | ||
* | ||
* \note It is possible to (de-)activate the shared-memory parallelization via | ||
* command line or by defining this symbol manually before including any | ||
* Blaze header file: | ||
* | ||
* \example | ||
* \code | ||
* g++ ... -DELASTICA_USE_SHARED_MEMORY_PARALLELIZATION=1 ... | ||
* \endcode | ||
* | ||
* \code | ||
* #define ELASTICA_USE_SHARED_MEMORY_PARALLELIZATION 1 | ||
* #include <elastica/elastica.hpp> | ||
* \endcode | ||
* | ||
*/ | ||
// #ifndef ELASTICA_USE_SHARED_MEMORY_PARALLELIZATION | ||
// #define ELASTICA_USE_SHARED_MEMORY_PARALLELIZATION @ELASTICA_SMP@ | ||
// #endif | ||
//****************************************************************************** | ||
|
||
//****************************************************************************** | ||
/*!\brief Compile time hint for number of threads to be used in an elastica | ||
* application | ||
* \ingroup parallel | ||
*/ | ||
constexpr std::size_t elastica_threads_hint() { return 2UL; } | ||
//****************************************************************************** | ||
|
||
//****************************************************************************** | ||
/*!\brief Environment variable to set a hint for the number of threads used | ||
* \ingroup parallel | ||
* | ||
* The macro defines the environment variable used to provide hint for the | ||
* number of threads to set for Elastica++ applications. | ||
* For user applications (i.e. when writing your own main-file), this variable | ||
* does not factor in : rather the user can set the number of threads they want | ||
* using the specific parallelism library they employed. | ||
*/ | ||
#define ENV_ELASTICA_NUM_THREADS "ELASTICA_NUM_THREADS" | ||
//**************************************************************************** |
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,14 @@ | ||
## Configuration | ||
|
||
Contains all default-settings to make a default `Elastica++` simulation. The type customizations are defined as macros (as | ||
opposed to type-aliases) to avoid including header files and complicating the editing of these files. Any numeric | ||
customizations | ||
(such as setting a threshold) is done using `constexpr` functions. | ||
|
||
These are later included as proper type-aliases inside ModuleSettings (with appropriate type and configuration checking) | ||
. | ||
|
||
### !!NOTE!! | ||
Only edit these when you feel like the default configuration that you want for `Elastica++` differs from the defaults set in | ||
the Github repository. Else prefer making a configuration in the main.cpp file, as this promotes readability and intent | ||
to the poor souls (made to) read(ing) your code. |
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,130 @@ | ||
#pragma once | ||
|
||
//****************************************************************************** | ||
/*!\brief Selection of the default admissible systems | ||
* \ingroup default_config | ||
* | ||
* This macro selects the default admissible \systems. The purpose of this | ||
* \a typelist is to add tags indicating the admissible \systems in the | ||
* simulation that comprise the degrees of freedom. The following \system tags | ||
* are available: | ||
* | ||
* - elastica::cosserat_rod::CosseratRod | ||
* - elastica::cosserat_rod::CosseratRodWithoutDamping | ||
* - elastica::rigid_body::Sphere | ||
* | ||
* Consult the documentation page of elastica::PhysicalSystemPlugins for more | ||
* information. This can be customized as needed in the client file. | ||
*/ | ||
#ifndef ELASTICA_DEFAULT_ADMISSIBLE_PLUGINS_FOR_SYSTEMS | ||
#define ELASTICA_DEFAULT_ADMISSIBLE_PLUGINS_FOR_SYSTEMS \ | ||
tmpl::list<elastica::cosserat_rod::CosseratRod> | ||
#endif | ||
//****************************************************************************** | ||
|
||
//****************************************************************************** | ||
/*!\brief Selection of the default policy for adding new systems to Blocks | ||
* within the simulator | ||
* \ingroup default_config | ||
* | ||
* This macro select the default Blocking policy for adding Systems within | ||
* \elastica. The following (simple) blocking policies are available: | ||
* | ||
* - elastica::configuration::RestrictSizeAcrossBlockTypesPolicy | ||
* - elastica::configuration::LooselyRestrictSizeAcrossBlockTypesPolicy | ||
* - elastica::configuration::AlwaysNewAcrossBlockTypesPolicy | ||
* - elastica::configuration::AlwaysSameAcrossBlockTypesPolicy | ||
* | ||
* This can be customized if needed in the client file. More complicated | ||
* policies are also possible by composition | ||
*/ | ||
#ifndef ELASTICA_DEFAULT_BLOCKING_POLICY_FOR_SYSTEMS | ||
#define ELASTICA_DEFAULT_BLOCKING_POLICY_FOR_SYSTEMS \ | ||
elastica::configuration::RestrictSizeAcrossBlockTypesPolicy | ||
#endif | ||
//****************************************************************************** | ||
|
||
//****************************************************************************** | ||
/*!\brief Selection of the size parameter for the default policy choosen in | ||
* ELASTICA_DEFAULT_BLOCKING_CRITERIA_FOR_SYSTEMS() | ||
* \ingroup default_config | ||
* | ||
* This value specifies the default size parameter for specifying the blocking | ||
* policy. | ||
*/ | ||
constexpr std::size_t default_blocking_policy_size() { return 1024UL; } | ||
//****************************************************************************** | ||
|
||
//****************************************************************************** | ||
/*!\brief Selection of the default iteration behavior over multiple types of | ||
* \elastica systems | ||
* \ingroup default_config | ||
* | ||
* This macro select the default behavior while iterating over multiple types | ||
* of systems (such as a CosseratRod, Sphere, Capsule) etc. The following | ||
* execution policies are available: | ||
* | ||
* - elastica::configuration::sequential_policy | ||
* - elastica::configuration::parallel_policy | ||
* | ||
* This can be customized if needed in the client file. | ||
*/ | ||
#ifndef ELASTICA_DEFAULT_ITERATION_POLICY_ACROSS_SYSTEM_TYPES | ||
#define ELASTICA_DEFAULT_ITERATION_POLICY_ACROSS_SYSTEM_TYPES \ | ||
::elastica::configuration::sequential_policy | ||
#endif | ||
//****************************************************************************** | ||
|
||
//****************************************************************************** | ||
/*!\brief Selection of the default iteration behavior over a container of | ||
* \elastica systems | ||
* \ingroup default_config | ||
* | ||
* This macro select the default behavior while iterating over multiple systems | ||
* of the same type. The following execution policies are available: | ||
* | ||
* - elastica::configuration::sequential_policy | ||
* - elastica::configuration::parallel_policy | ||
* - elastica::configuration::hybrid_policy | ||
* | ||
* This can be customized if needed in the client file. | ||
*/ | ||
#ifndef ELASTICA_DEFAULT_ITERATION_POLICY_FOR_EACH_SYSTEM_TYPE | ||
#define ELASTICA_DEFAULT_ITERATION_POLICY_FOR_EACH_SYSTEM_TYPE \ | ||
::elastica::configuration::sequential_policy | ||
#endif | ||
//****************************************************************************** | ||
|
||
//****************************************************************************** | ||
/*!\brief Environment variable to control if potential warnings are shown during | ||
* system initialization | ||
* \ingroup systems | ||
* | ||
* The macro defines the environment variable that is searched for controlling | ||
* the behavior of (potential) warnings when initialization systems in | ||
* Elastica++. By default, potential warnings are enabled. To disable user | ||
* warnings the environment variable can be set to 1, i.e. | ||
* \code | ||
* ELASTICA_NO_SYSTEM_WARN=1 ./<your_application> [options] | ||
* \endcode | ||
*/ | ||
#define ENV_ELASTICA_NO_SYSTEM_WARN "ELASTICA_NO_SYSTEM_WARN" | ||
//**************************************************************************** | ||
|
||
//****************************************************************************** | ||
/*!\brief Selection of the default index checking behavior within systems module | ||
* \elastica systems | ||
* \ingroup default_config | ||
* | ||
* This macro select the default behavior while slicing/viewing indices within | ||
* a system. The following execution policies are available: | ||
* | ||
* - checked (checks indices) | ||
* - unchecked (does not check indices) | ||
* | ||
* This can be customized if needed in the client file. | ||
*/ | ||
#ifndef ELASTICA_DEFAULT_SYSTEM_INDEX_CHECK | ||
#define ELASTICA_DEFAULT_SYSTEM_INDEX_CHECK checked | ||
#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