TBTK
Solver.h
Go to the documentation of this file.
1 /* Copyright 2017 Kristofer Bj√∂rnson
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
23 #ifndef COM_DAFER45_TBTK_SOLVER_SOLVER
24 #define COM_DAFER45_TBTK_SOLVER_SOLVER
25 
26 #include "TBTK/Model.h"
27 
28 namespace TBTK{
29 namespace Solver{
30 
32 class Solver{
33 public:
35  Solver();
36 
38  virtual ~Solver();
39 
43  virtual void setModel(Model &model);
44 
48  Model& getModel();
49 
53  const Model& getModel() const;
54 private:
56  Model *model;
57 };
58 
59 inline void Solver::setModel(Model &model){
60  this->model = &model;
61 }
62 
64  TBTKAssert(
65  model != nullptr,
66  "Solver::getModel()",
67  "Model not set.",
68  "Use Solver::setSolver() to set model."
69  );
70  return *model;
71 }
72 
73 inline const Model& Solver::getModel() const{
74  TBTKAssert(
75  model != nullptr,
76  "Solver::getModel()",
77  "Model not set.",
78  "Use Solver::setSolver() to set model."
79  );
80  return *model;
81 }
82 
83 }; //End of namespace Solver
84 }; //End of namespace TBTK
85 
86 #endif
Base class for Solvers.
Definition: Solver.h:32
Model & getModel()
Definition: Solver.h:63
Container of Model related information.
virtual void setModel(Model &model)
Definition: Solver.h:59
Definition: ModelFactory.h:35
Container of Model related information.
Definition: Model.h:52