BioDynaMo
v1.05.125-2619fe54
Home
Main Page
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
i
k
l
n
o
p
r
s
t
u
v
w
Functions
a
b
c
d
e
f
g
i
l
n
o
p
r
s
t
u
v
w
Variables
Typedefs
Enumerations
Enumerator
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
:
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
~
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
b
c
d
e
f
i
n
p
r
t
v
Enumerations
Enumerator
Related Functions
:
d
e
i
m
o
p
r
s
t
Files
File List
File Members
All
_
b
c
d
h
n
p
s
Functions
Variables
Macros
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
core
multi_simulation
algorithm
algorithm_registry.h
Go to the documentation of this file.
1
// -----------------------------------------------------------------------------
2
//
3
// Copyright (C) 2021 CERN & University of Surrey for the benefit of the
4
// BioDynaMo collaboration. All Rights Reserved.
5
//
6
// Licensed under the Apache License, Version 2.0 (the "License");
7
// you may not use this file except in compliance with the License.
8
//
9
// See the LICENSE file distributed with this work for details.
10
// See the NOTICE file distributed with this work for additional information
11
// regarding copyright ownership.
12
//
13
// -----------------------------------------------------------------------------
14
15
#ifndef CORE_MULTI_SIMULATION_ALGORITHM_ALGORITHM_REGISTRY_H_
16
#define CORE_MULTI_SIMULATION_ALGORITHM_ALGORITHM_REGISTRY_H_
17
18
#include <unordered_map>
19
20
#include "
core/multi_simulation/algorithm/algorithm.h
"
21
#include "
core/multi_simulation/optimization_param.h
"
22
#include "
core/param/param.h
"
23
24
namespace
bdm
{
25
namespace
experimental {
26
27
class
MultiSimulationManager;
28
30
struct
AlgorithmRegistry
{
32
static
AlgorithmRegistry
*
GetInstance
();
33
40
Algorithm
*
GetAlgorithm
(
const
std::string &algo_name);
41
50
bool
AddAlgorithm
(
const
std::string &algo_name,
Algorithm
*algo);
51
52
private
:
54
std::unordered_map<std::string, Algorithm *>
algorithms_
;
55
56
AlgorithmRegistry
();
57
~AlgorithmRegistry
();
58
};
59
60
#define BDM_REGISTER_ALGO(op) \
61
bool op::registered_ = \
62
AlgorithmRegistry::GetInstance()->AddAlgorithm(#op, new op());
63
66
#define BDM_ALGO_HEADER() \
67
private: \
68
static bool registered_;
69
70
// Get Optimization Algorithm from registry
71
inline
Algorithm
*
CreateOptimizationAlgorithm
(
OptimizationParam
*opt_params) {
72
// Check if the parameters are initialized correctly
73
for
(
auto
param : opt_params->
params
) {
74
param->Validate();
75
}
76
auto
ret =
77
AlgorithmRegistry::GetInstance
()->
GetAlgorithm
(opt_params->
algorithm
);
78
return
ret;
79
}
80
81
}
// namespace experimental
82
}
// namespace bdm
83
84
#endif // CORE_MULTI_SIMULATION_ALGORITHM_ALGORITHM_REGISTRY_H_
bdm::OptimizationParam::algorithm
std::string algorithm
Definition:
optimization_param.h:38
bdm::experimental::AlgorithmRegistry::algorithms_
std::unordered_map< std::string, Algorithm * > algorithms_
The map containing the algorithms; accessible by their name.
Definition:
algorithm_registry.h:54
bdm
Definition:
agent.cc:39
bdm::experimental::Algorithm
An interface for creating new optimization algorithms.
Definition:
algorithm.h:30
optimization_param.h
bdm::experimental::AlgorithmRegistry
Registry of all optimization algorithms.
Definition:
algorithm_registry.h:30
bdm::experimental::AlgorithmRegistry::~AlgorithmRegistry
~AlgorithmRegistry()
Definition:
algorithm_registry.cc:21
bdm::OptimizationParam
Definition:
optimization_param.h:24
bdm::experimental::AlgorithmRegistry::AddAlgorithm
bool AddAlgorithm(const std::string &algo_name, Algorithm *algo)
Definition:
algorithm_registry.cc:46
bdm::experimental::AlgorithmRegistry::GetAlgorithm
Algorithm * GetAlgorithm(const std::string &algo_name)
Definition:
algorithm_registry.cc:32
bdm::OptimizationParam::params
std::vector< OptimizationParamType * > params
Definition:
optimization_param.h:39
algorithm.h
param.h
bdm::experimental::AlgorithmRegistry::GetInstance
static AlgorithmRegistry * GetInstance()
Singleton class - returns the static instance.
Definition:
algorithm_registry.cc:27
bdm::experimental::AlgorithmRegistry::AlgorithmRegistry
AlgorithmRegistry()
bdm::experimental::CreateOptimizationAlgorithm
Algorithm * CreateOptimizationAlgorithm(OptimizationParam *opt_params)
Definition:
algorithm_registry.h:71
Generated by
1.8.17