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 
41  virtual void setModel(Model &model);
42 
44  Model& getModel();
45 
47  const Model& getModel() const;
48 private:
50  Model *model;
51 };
52 
53 inline void Solver::setModel(Model &model){
54  this->model = &model;
55 }
56 
58  TBTKAssert(
59  model != nullptr,
60  "Solver::getModel()",
61  "Model not set.",
62  "Use Solver::setSolver() to set model."
63  );
64  return *model;
65 }
66 
67 inline const Model& Solver::getModel() const{
68  TBTKAssert(
69  model != nullptr,
70  "Solver::getModel()",
71  "Model not set.",
72  "Use Solver::setSolver() to set model."
73  );
74  return *model;
75 }
76 
77 }; //End of namespace Solver
78 }; //End of namespace TBTK
79 
80 #endif
Base class for Solvers.
Definition: Solver.h:32
Model & getModel()
Definition: Solver.h:57
Container of Model related information.
virtual void setModel(Model &model)
Definition: Solver.h:53
Definition: ModelFactory.h:35
Container of Model related information.
Definition: Model.h:52