Manual for OpenFLUID 2.1.10

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 /**
34  @file FluidXDescriptor.hpp
35 
36  @author Jean-Christophe Fabre <jean-christophe.fabre@inra.fr>
37  @author Aline LIBRES <aline.libres@gmail.com>
38 */
39 
40 
41 #ifndef __OPENFLUID_FLUIDX_FLUIDXDESCRIPTOR_HPP__
42 #define __OPENFLUID_FLUIDX_FLUIDXDESCRIPTOR_HPP__
43 
44 
45 #include <openfluid/dllexport.hpp>
54 
55 
56 class QDomElement;
57 
58 
59 namespace openfluid {
60 
61 
62 namespace base {
63 class IOListener;
64 }
65 
66 
67 namespace fluidx {
68 
69 
71 {
72  private:
73 
74  typedef std::list<SpatialUnitDescriptor> SpatialUnitsList_t;
75 
76  typedef std::list<AttributesTableDescriptor> AttributesTableList_t;
77 
78  typedef std::list<EventDescriptor> EventsList_t;
79 
80  struct LoadingTempData
81  {
82  SpatialUnitsList_t SpatiaUnits;
83 
84  AttributesTableList_t Attributes;
85 
86  EventsList_t Events;
87  };
88 
90 
92 
94 
95  openfluid::fluidx::DatastoreDescriptor m_DatastoreDescriptor;
96 
97  openfluid::fluidx::MonitoringDescriptor m_MonitoringDescriptor;
98 
99  std::string m_CurrentFile;
100 
101  std::string m_CurrentDir;
102 
103  bool m_RunConfigDefined;
104 
105  bool m_ModelDefined;
106 
107  std::string m_IndentStr;
108 
109  openfluid::base::IOListener* mp_Listener;
110 
111  template<class T> std::string getSeparatedStrFromList(const T& Data,const std::string& Sep);
112 
113  bool extractWareEnabledFromNode(QDomElement& Node);
114 
115  void extractMonitoringFromNode(QDomElement& Node);
116 
117  openfluid::ware::WareParams_t extractParamsFromNode(QDomElement& Node);
118 
120  const openfluid::ware::WareParams_t& OverloadParams);
121 
122  void extractModelFromNode(QDomElement& Node);
123 
124  void extractRunFromNode(QDomElement& Node);
125 
126  void extractDomainFomNode(QDomElement& Node, LoadingTempData& TempData);
127 
128  openfluid::core::UnitClassID_t extractUnitClassIDFromNode(QDomElement& Node);
129 
130  SpatialUnitsList_t extractDomainDefinitionFromNode(QDomElement& Node);
131 
132  AttributesTableDescriptor extractDomainAttributesFromNode(QDomElement& Node);
133 
134  EventsList_t extractDomainCalendarFromNode(QDomElement& Node);
135 
136  void extractDatastoreFromNode(QDomElement& Node);
137 
138  void parseFile(const std::string& Filename, LoadingTempData& TempData);
139 
140  void rebuildSpatialDomainFromTemp(LoadingTempData& TempData);
141 
142  void prepareFluidXDir(const std::string& DirPath);
143 
144  std::string getGeneratorMethodAsStr(openfluid::fluidx::GeneratorDescriptor::GeneratorMethod Method) const;
145 
146  std::string getParamsAsStr(const openfluid::ware::WareParams_t& Params) const;
147 
148  void writeModelToStream(std::ostream& Contents);
149 
150  void writeDomainToStream(std::ostream& Contents);
151 
152  void writeDomainDefinitionToStream(std::ostream& Contents);
153 
154  void writeDomainAttributesToStream(std::ostream& Contents);
155 
156  void writeDomainCalendarToStream(std::ostream& Contents);
157 
158  void writeRunConfigurationToStream(std::ostream& Contents);
159 
160  void writeDatastoreToStream(std::ostream& Contents);
161 
162  void writeMonitoringToStream(std::ostream& Contents);
163 
164 
165  public:
166 
168 
170  { }
171 
172  void loadFromDirectory(const std::string& DirPath);
173 
175  {
176  return m_ModelDescriptor;
177  }
178 
180  {
181  return m_ModelDescriptor;
182  }
183 
185  {
186  return m_DomainDescriptor;
187  }
188 
190  {
191  return m_DomainDescriptor;
192  }
193 
195  {
196  return m_RunDescriptor;
197  }
198 
200  {
201  return m_RunDescriptor;
202  }
203 
205  {
206  return m_DatastoreDescriptor;
207  }
208 
210  {
211  return m_DatastoreDescriptor;
212  }
213 
215  {
216  return m_MonitoringDescriptor;
217  }
218 
220  {
221  return m_MonitoringDescriptor;
222  }
223 
224  void writeToManyFiles(const std::string& DirPath);
225 
226  void writeToSingleFile(const std::string& FilePath);
227 };
228 
229 
230 } } // namespaces
231 
232 
233 #endif /* __OPENFLUID_FLUIDX_FLUIDXDESCRIPTOR_HPP__ */
Definition: FluidXDescriptor.hpp:70
Definition: DatastoreDescriptor.hpp:54
Definition: RunConfigurationDescriptor.hpp:52
Definition: ApplicationException.hpp:47
Definition: IOListener.hpp:53
Definition: SpatialDomainDescriptor.hpp:62
const openfluid::fluidx::SpatialDomainDescriptor & spatialDomain() const
Definition: FluidXDescriptor.hpp:189
const openfluid::fluidx::CoupledModelDescriptor & model() const
Definition: FluidXDescriptor.hpp:179
openfluid::fluidx::RunConfigurationDescriptor & runConfiguration()
Definition: FluidXDescriptor.hpp:194
Definition: CoupledModelDescriptor.hpp:52
openfluid::fluidx::CoupledModelDescriptor & model()
Definition: FluidXDescriptor.hpp:174
const openfluid::fluidx::MonitoringDescriptor & monitoring() const
Definition: FluidXDescriptor.hpp:219
~FluidXDescriptor()
Definition: FluidXDescriptor.hpp:169
openfluid::fluidx::SpatialDomainDescriptor & spatialDomain()
Definition: FluidXDescriptor.hpp:184
std::list< Event > EventsList_t
Definition: EventsCollection.hpp:53
std::map< WareParamKey_t, WareParamValue_t > WareParams_t
Definition: TypeDefs.hpp:128
GeneratorMethod
Definition: GeneratorDescriptor.hpp:54
const openfluid::fluidx::DatastoreDescriptor & datastore() const
Definition: FluidXDescriptor.hpp:209
#define OPENFLUID_API
Definition: dllexport.hpp:86
std::pair< UnitsClass_t, UnitID_t > UnitClassID_t
Definition: TypeDefs.hpp:136
openfluid::fluidx::DatastoreDescriptor & datastore()
Definition: FluidXDescriptor.hpp:204
Definition: AttributesTableDescriptor.hpp:51
Definition: MonitoringDescriptor.hpp:52
const openfluid::fluidx::RunConfigurationDescriptor & runConfiguration() const
Definition: FluidXDescriptor.hpp:199
openfluid::fluidx::MonitoringDescriptor & monitoring()
Definition: FluidXDescriptor.hpp:214