finite_differences_grid.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * Software License Agreement
4  *
5  * Copyright (c) 2020,
6  * TU Dortmund - Institute of Control Theory and Systems Engineering.
7  * All rights reserved.
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <https://www.gnu.org/licenses/>.
21  *
22  * Authors: Christoph Rösmann
23  *********************************************************************/
24 
25 #ifndef SRC_OPTIMAL_CONTROL_INCLUDE_CORBO_OPTIMAL_CONTROL_STRUCTURED_OCP_DISCRETIZATION_GRIDS_FINITE_DIFFERENCES_GRID_H_
26 #define SRC_OPTIMAL_CONTROL_INCLUDE_CORBO_OPTIMAL_CONTROL_STRUCTURED_OCP_DISCRETIZATION_GRIDS_FINITE_DIFFERENCES_GRID_H_
27 
29 
30 #include <memory>
31 
32 namespace corbo {
33 
35 {
36  public:
37  using Ptr = std::shared_ptr<FiniteDifferencesGrid>;
38  using UPtr = std::unique_ptr<FiniteDifferencesGrid>;
39 
40  FiniteDifferencesGrid() = default;
41  virtual ~FiniteDifferencesGrid() = default;
42 
44  DiscretizationGridInterface::Ptr getInstance() const override { return std::make_shared<FiniteDifferencesGrid>(); }
45 
48 
49 #ifdef MESSAGE_SUPPORT
50  void fromMessage(const messages::FiniteDifferencesGrid& message, std::stringstream* issues);
51  void toMessage(messages::FiniteDifferencesGrid& message) const;
52 
53  void fromMessage(const messages::DiscretizationGrid& message, std::stringstream* issues) override
54  {
55  fromMessage(message.finite_differences_grid(), issues);
56  }
57  void toMessage(messages::DiscretizationGrid& message) const override { toMessage(*message.mutable_finite_differences_grid()); }
58 #endif
59 
60  protected:
61  void createEdges(NlpFunctions& nlp_fun, OptimizationEdgeSet& edges, SystemDynamicsInterface::Ptr dynamics) override;
62 
63  bool isDtFixedIntended() const override { return true; }
64 };
65 
67 
68 } // namespace corbo
69 
70 #endif // SRC_OPTIMAL_CONTROL_INCLUDE_CORBO_OPTIMAL_CONTROL_STRUCTURED_OCP_DISCRETIZATION_GRIDS_FINITE_DIFFERENCES_GRID_H_
Generic factory object.
Definition: factory.h:68
std::unique_ptr< DiscretizationGridInterface > UPtr
bool isDtFixedIntended() const override
#define FACTORY_REGISTER_DISCRETIZATION_GRID(type)
static Factory< DiscretizationGridInterface > & getFactory()
Get access to the associated factory.
void createEdges(NlpFunctions &nlp_fun, OptimizationEdgeSet &edges, SystemDynamicsInterface::Ptr dynamics) override
DiscretizationGridInterface::Ptr getInstance() const override
Return a newly created shared instance of the implemented class.
static Factory & instance()
< Retrieve static instance of the factory
Definition: factory.h:72
std::shared_ptr< DiscretizationGridInterface > Ptr
std::shared_ptr< SystemDynamicsInterface > Ptr
virtual ~FiniteDifferencesGrid()=default


control_box_rst
Author(s): Christoph Rösmann
autogenerated on Mon Feb 28 2022 22:06:51