FluidXDescriptor.hpp
Go to the documentation of this file.
1 /*
2 
3  This file is part of OpenFLUID software
4  Copyright(c) 2007, INRA - Montpellier SupAgro
5 
6 
7  == GNU General Public License Usage ==
8 
9  OpenFLUID 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  OpenFLUID 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 OpenFLUID. If not, see <http://www.gnu.org/licenses/>.
21 
22 
23  == Other Usage ==
24 
25  Other Usage means a use of OpenFLUID that is inconsistent with the GPL
26  license, and requires a written agreement between You and INRA.
27  Licensees for Other Usage of OpenFLUID may use this file in accordance
28  with the terms contained in the written agreement between You and INRA.
29 
30 */
31 
32 /**
33  @file FluidXDescriptor.hpp
34 
35  @author Aline LIBRES <aline.libres@gmail.com>
36  @author Jean-Christophe Fabre <jean-christophe.fabre@inra.fr>
37  */
38 
39 
40 #ifndef __OPENFLUID_FLUIDX_FLUIDXDESCRIPTOR_HPP__
41 #define __OPENFLUID_FLUIDX_FLUIDXDESCRIPTOR_HPP__
42 
43 
44 #include <openfluid/dllexport.hpp>
50 #include <openfluid/dllexport.hpp>
52 
53 
54 class QDomElement;
55 
56 
57 namespace openfluid {
58 
59 
60 namespace base {
61 class IOListener;
62 }
63 
64 
65 namespace fluidx {
66 
67 
69 {
70  private:
71 
73 
75 
76  openfluid::fluidx::RunDescriptor m_RunDescriptor;
77 
78  openfluid::fluidx::DatastoreDescriptor m_DatastoreDescriptor;
79 
80  openfluid::fluidx::MonitoringDescriptor m_MonitoringDescriptor;
81 
82  std::string m_CurrentFile;
83 
84  std::string m_CurrentDir;
85 
86  bool m_RunConfigDefined;
87 
88  bool m_ModelDefined;
89 
90  std::string m_IndentStr;
91 
92  openfluid::base::IOListener* mp_Listener;
93 
94  bool extractWareEnabledFromNode(QDomElement& Node);
95 
96  void extractMonitoringFromNode(QDomElement& Node);
97 
98  openfluid::ware::WareParams_t extractParamsFromNode(QDomElement& Node);
99 
101  const openfluid::ware::WareParams_t& OverloadParams);
102 
103  void extractModelFromNode(QDomElement& Node);
104 
105  void extractRunFromNode(QDomElement& Node);
106 
107  void extractDomainFomNode(QDomElement& Node);
108 
109  openfluid::core::UnitClassID_t extractUnitClassIDFromNode(QDomElement& Node);
110 
111  void extractDomainDefinitionFromNode(QDomElement& Node);
112 
113  void extractDomainAttributesFromNode(QDomElement& Node);
114 
115  void extractDomainCalendarFromNode(QDomElement& Node);
116 
117  void extractDatastoreFromNode(QDomElement& Node);
118 
119  void parseFile(std::string Filename);
120 
121  void prepareFluidXDir(const std::string& DirPath);
122 
123  std::string getGeneratorMethodAsStr(openfluid::fluidx::GeneratorDescriptor::GeneratorMethod Method) const;
124 
125  std::string getParamsAsStr(const openfluid::ware::WareParams_t& Params) const;
126 
127  void writeModelToStream(std::ostream& Contents);
128 
129  void writeDomainToStream(std::ostream& Contents);
130 
131  void writeDomainDefinitionToStream(std::ostream& Contents);
132 
133  void writeDomainAttributesToStream(std::ostream& Contents);
134 
135  void writeDomainCalendarToStream(std::ostream& Contents);
136 
137  void writeRunConfigurationToStream(std::ostream& Contents);
138 
139  void writeDatastoreToStream(std::ostream& Contents);
140 
141  void writeMonitoringToStream(std::ostream& Contents);
142 
143 
144  public:
145 
147 
148  ~FluidXDescriptor();
149 
150  void loadFromDirectory(const std::string& DirPath);
151 
153  { return m_ModelDescriptor; }
154 
156  { return m_DomainDescriptor; }
157 
159  { return m_RunDescriptor; }
160 
162  { return m_DatastoreDescriptor; }
163 
165  { return m_MonitoringDescriptor; }
166 
168  { return m_ModelDescriptor; }
169 
171  { return m_DomainDescriptor; }
172 
174  { return m_RunDescriptor; }
175 
177  { return m_DatastoreDescriptor; }
178 
180  { return m_MonitoringDescriptor; }
181 
182  void writeToManyFiles(const std::string& DirPath);
183 
184  void writeToSingleFile(const std::string& FilePath);
185 };
186 
187 
188 } } // namespaces
189 
190 
191 #endif /* __OPENFLUID_FLUIDX_FLUIDXDESCRIPTOR_HPP__ */
Definition: RunDescriptor.hpp:52
openfluid::fluidx::MonitoringDescriptor & monitoringDescriptor()
Definition: FluidXDescriptor.hpp:164
GeneratorMethod
Definition: GeneratorDescriptor.hpp:55
const openfluid::fluidx::RunDescriptor & runDescriptor() const
Definition: FluidXDescriptor.hpp:173
Definition: FluidXDescriptor.hpp:68
Definition: DatastoreDescriptor.hpp:52
openfluid::fluidx::RunDescriptor & runDescriptor()
Definition: FluidXDescriptor.hpp:158
#define OPENFLUID_API
Definition: dllexport.hpp:87
openfluid::fluidx::SpatialDomainDescriptor & spatialDomainDescriptor()
Definition: FluidXDescriptor.hpp:155
Definition: ApplicationException.hpp:47
openfluid::fluidx::DatastoreDescriptor & datastoreDescriptor()
Definition: FluidXDescriptor.hpp:161
const openfluid::fluidx::MonitoringDescriptor & monitoringDescriptor() const
Definition: FluidXDescriptor.hpp:179
openfluid::fluidx::CoupledModelDescriptor & modelDescriptor()
Definition: FluidXDescriptor.hpp:152
Definition: SpatialDomainDescriptor.hpp:54
Definition: IOListener.hpp:54
const openfluid::fluidx::SpatialDomainDescriptor & spatialDomainDescriptor() const
Definition: FluidXDescriptor.hpp:170
std::map< WareParamKey_t, WareParamValue_t > WareParams_t
Definition: TypeDefs.hpp:130
const openfluid::fluidx::CoupledModelDescriptor & modelDescriptor() const
Definition: FluidXDescriptor.hpp:167
std::pair< UnitsClass_t, UnitID_t > UnitClassID_t
Definition: TypeDefs.hpp:91
const openfluid::fluidx::DatastoreDescriptor & datastoreDescriptor() const
Definition: FluidXDescriptor.hpp:176