CppADCodeGen  2.4.3
A C++ Algorithmic Differentiation Package with Source Code Generation
dae_structural_index_reduction.hpp
1 #ifndef CPPAD_CG_DAE_STRUCTURAL_INDEX_REDUCTION_INCLUDED
2 #define CPPAD_CG_DAE_STRUCTURAL_INDEX_REDUCTION_INCLUDED
3 /* --------------------------------------------------------------------------
4  * CppADCodeGen: C++ Algorithmic Differentiation with Source Code Generation:
5  * Copyright (C) 2016 Ciengis
6  *
7  * CppADCodeGen is distributed under multiple licenses:
8  *
9  * - Eclipse Public License Version 1.0 (EPL1), and
10  * - GNU General Public License Version 3 (GPL3).
11  *
12  * EPL1 terms and conditions can be found in the file "epl-v10.txt", while
13  * terms and conditions for the GPL3 can be found in the file "gpl3.txt".
14  * ----------------------------------------------------------------------------
15  * Author: Joao Leal
16  */
17 
18 #include <cppad/cg/dae_index_reduction/dae_index_reduction.hpp>
19 #include <cppad/cg/dae_index_reduction/bipartite_graph.hpp>
20 
21 namespace CppAD {
22 namespace cg {
23 
28 template<class Base>
30 protected:
32  using ADCG = CppAD::AD<CGBase>;
33 protected:
34  //
35  BipartiteGraph<Base> graph_;
36 public:
37 
47  const std::vector<DaeVarInfo>& varInfo,
48  const std::vector<std::string>& eqName) :
49  DaeIndexReduction<Base>(fun),
50  graph_(fun, varInfo, eqName, *this) {
51  }
52 
53  inline virtual ~DaeStructuralIndexReduction() {
54  }
55 
56  inline BipartiteGraph<Base>& getGraph() {
57  return graph_;
58  }
59 
60  inline const BipartiteGraph<Base>& getGraph() const {
61  return graph_;
62  }
63 
69  inline void setPreserveNames(bool p) {
70  graph_.setPreserveNames(p);
71  }
72 
78  inline bool isPreserveNames() const {
79  return graph_.isPreserveNames();
80  }
81 
90  inline size_t getStructuralIndex() const {
91  return graph_.getStructuralIndex();
92  }
93 };
94 
95 } // END cg namespace
96 } // END CppAD namespace
97 
98 #endif
99 
CppAD::AD
Definition: declare_cg.hpp:25
CppAD::cg::DaeIndexReduction
Definition: dae_index_reduction.hpp:31
CppAD::cg::DaeStructuralIndexReduction::isPreserveNames
bool isPreserveNames() const
Definition: dae_structural_index_reduction.hpp:78
CppAD::cg::BipartiteGraph::setPreserveNames
void setPreserveNames(bool p)
Definition: bipartite_graph.hpp:296
CppAD::cg::DaeStructuralIndexReduction::setPreserveNames
void setPreserveNames(bool p)
Definition: dae_structural_index_reduction.hpp:69
CppAD
Definition: abstract_atomic_fun.hpp:19
CppAD::cg::CG
Definition: cg.hpp:29
CppAD::cg::DaeStructuralIndexReduction::DaeStructuralIndexReduction
DaeStructuralIndexReduction(ADFun< CG< Base >> &fun, const std::vector< DaeVarInfo > &varInfo, const std::vector< std::string > &eqName)
Definition: dae_structural_index_reduction.hpp:46
CppAD::cg::BipartiteGraph::isPreserveNames
bool isPreserveNames() const
Definition: bipartite_graph.hpp:305
CppAD::cg::DaeStructuralIndexReduction
Definition: dae_structural_index_reduction.hpp:29
CppAD::cg::BipartiteGraph
Definition: bipartite_graph.hpp:30
CppAD::cg::DaeStructuralIndexReduction::getStructuralIndex
size_t getStructuralIndex() const
Definition: dae_structural_index_reduction.hpp:90
CppAD::cg::BipartiteGraph::getStructuralIndex
size_t getStructuralIndex() const
Definition: bipartite_graph.hpp:314
CppAD::ADFun
Definition: declare_cg.hpp:28