BioDynaMo  v1.03.61-fe34ced0
set_param.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_OPTIMIZATION_PARAM_TYPE_SET_PARAM_H_
16 #define CORE_MULTI_SIMULATION_OPTIMIZATION_PARAM_TYPE_SET_PARAM_H_
17 
18 #include <string>
19 #include <vector>
20 
22 
23 namespace bdm {
24 
28  SetParam() = default;
29  SetParam(const std::string& name, const std::vector<real_t> v)
30  : OptimizationParamType(name), values(v) {}
31 
32  OptimizationParamType* GetCopy() const override {
33  return new SetParam(*this);
34  }
35 
36  size_t size() const { return values.size(); }
37  real_t at(size_t n) const { return values.at(n); }
38 
39  uint32_t GetNumElements() const override { return this->size(); }
40  real_t GetValue(int n) const override { return this->at(n); }
41 
42  std::vector<real_t> values;
44 };
45 
46 } // namespace bdm
47 
48 #endif // CORE_MULTI_SIMULATION_OPTIMIZATION_PARAM_TYPE_SET_PARAM_H_
bdm::SetParam::GetValue
real_t GetValue(int n) const override
Definition: set_param.h:40
optimization_param_type.h
bdm::SetParam
Definition: set_param.h:27
bdm
Definition: agent.cc:39
bdm::SetParam::GetNumElements
uint32_t GetNumElements() const override
Definition: set_param.h:39
bdm::real_t
double real_t
Definition: real_t.h:21
bdm::SetParam::size
size_t size() const
Definition: set_param.h:36
bdm::SetParam::GetCopy
OptimizationParamType * GetCopy() const override
Definition: set_param.h:32
bdm::OptimizationParamType
An interface for creating different types of optimization parameters.
Definition: optimization_param_type.h:27
bdm::SetParam::at
real_t at(size_t n) const
Definition: set_param.h:37
bdm::SetParam::SetParam
SetParam(const std::string &name, const std::vector< real_t > v)
Definition: set_param.h:29
bdm::SetParam::values
std::vector< real_t > values
Definition: set_param.h:42
bdm::SetParam::BDM_CLASS_DEF_OVERRIDE
BDM_CLASS_DEF_OVERRIDE(SetParam, 1)
bdm::SetParam::SetParam
SetParam()=default