VPTissue Reference Manual
SimState.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2016 Universiteit Antwerpen
3  *
4  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
5  * the European Commission - subsequent versions of the EUPL (the "Licence");
6  * You may not use this work except in compliance with the Licence.
7  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the Licence is distributed on an "AS IS" basis,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the Licence for the specific language governing
13  * permissions and limitations under the Licence.
14  */
20 #include "SimState.h"
21 
23 
24 #include <boost/property_tree/xml_parser.hpp>
25 #include <iostream>
26 #include <iomanip>
27 
28 using namespace std;
29 using boost::property_tree::ptree;
30 using namespace boost::property_tree::xml_parser;
31 using namespace SimPT_Sim::Util;
32 
33 namespace SimPT_Sim {
34 
35 int SimState::GetTimeStep() const
36 {
37  return m_time_step;
38 }
39 
40 double SimState::GetTime() const
41 {
42  return m_time;
43 }
44 
45 MeshState SimState::GetMeshState() const
46 {
47  return m_mesh_state;
48 }
49 
50 ptree SimState::GetParameters() const
51 {
52  return m_parameters;
53 }
54 
55 string SimState::GetProjectName() const
56 {
57  return m_project_name;
58 }
59 
60 ptree SimState::GetRandomEngineState() const
61 {
62  return m_re_state;
63 }
64 
65 void SimState::SetTimeStep(int step)
66 {
67  m_time_step = step;
68 }
69 
70 void SimState::SetTime(double t)
71 {
72  m_time = t;
73 }
74 
75 void SimState::SetMeshState(const MeshState& mesh_state)
76 {
77  m_mesh_state = mesh_state;
78 }
79 
80 void SimState::SetParameters(const ptree& parameters)
81 {
82  m_parameters = parameters;
83 }
84 
85 void SimState::SetProjectName(string project_name)
86 {
87  m_project_name = project_name;
88 }
89 
90 void SimState::SetRandomEngineState(const ptree& re_state)
91 {
92  m_re_state = re_state;
93 }
94 
95 void SimState::PrintToStream(ostream& out) const
96 {
97  out << "SimState at time step: " << this->m_time_step;
98  out << ", time: " << this->m_time << endl;
99  m_mesh_state.PrintToStream(out);
100  out << "Simulation parameters:" << endl;
101  write_xml(out, m_parameters, XmlWriterSettings::GetTab());
102  out << "Random engine state:" << endl;
103  write_xml(out, m_re_state, XmlWriterSettings::GetTab());
104 }
105 
106 }
107 
void PrintToStream(std::ostream &out) const
Prints a textual representation of this MeshState to output stream.
Definition: MeshState.cpp:303
STL namespace.
Namespace for miscellaneous utilities.
Definition: PTreeFile.cpp:44
Namespace for the core simulator.
Header for SimState.
Contains the state of the whole Mesh at a given simulation step.
Definition: MeshState.h:41
Xml writer settings class.