Manual for OpenFLUID 2.1.10

Factory.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 Factory.hpp
35 
36  @author Jean-Christophe FABRE <jean-christophe.fabre@inra.fr>
37  */
38 
39 
40 #ifndef __OPENFLUID_MACHINE_FACTORY_HPP__
41 #define __OPENFLUID_MACHINE_FACTORY_HPP__
42 
43 
44 #include <openfluid/dllexport.hpp>
45 #include <openfluid/core/TypeDefs.hpp>
49 
50 
51 namespace openfluid {
52 
53 
54 namespace base {
55 class ExecutionMessages;
56 class OutputDescriptor;
57 }
58 namespace core {
59 class SpatialGraph;
60 class Datastore;
61 }
62 namespace fluidx {
63 class SpatialDomainDescriptor;
64 class RunDescriptor;
65 class DatastoreDescriptor;
66 } }
67 
68 
69 namespace openfluid { namespace machine {
70 
71 class SimulationBlob;
72 class ModelInstance;
73 class MonitoringInstance;
74 
75 
77 {
78 
79  public:
80 
81  Factory() = delete;
82 
83  /**
84  Builds a spatial graph from a domain descriptor
85  @param[in] Descriptor the spatial domain descriptor
86  @param[out] SGraph the instanciated spatial graph
87  */
88  static void buildDomainFromDescriptor(const openfluid::fluidx::SpatialDomainDescriptor& Descriptor,
90 
91  /**
92  Builds a datastore from a datastore descriptor
93  @param[in] Descriptor the datastore descriptor
94  @param[out] Store the instanciated datastore
95  */
96  static void buildDatastoreFromDescriptor(const openfluid::fluidx::DatastoreDescriptor& Descriptor,
98 
99  /**
100  Builds a coupled model instance from a model descriptor
101  @param[in] ModelDesc the model descriptor
102  @param[out] MInstance the instanciated coupled model
103  */
104  static void buildModelInstanceFromDescriptor(const openfluid::fluidx::CoupledModelDescriptor& ModelDesc,
105  ModelInstance& MInstance);
106 
107  /**
108  Builds a monitoring instance from a monitoring descriptor
109  @param[in] MonDesc the monitoring descriptor
110  @param[out] MonInstance the instanciated monitoring
111  */
112  static void buildMonitoringInstanceFromDescriptor(const openfluid::fluidx::MonitoringDescriptor& MonDesc,
113  MonitoringInstance& MonInstance);
114 
115  /**
116  Fills the current run context from a run configuration descriptor
117  @param[in] RunDesc the run configuration descriptor
118  */
119  static void fillRunContextFromDescriptor(const openfluid::fluidx::RunConfigurationDescriptor& RunDesc);
120 
121  /**
122  Builds a simulation blob from descriptors
123  @param[in] FluidXDesc the descriptors
124  @param[out] SimBlob the instanciated simulation blob
125  */
126  static void buildSimulationBlobFromDescriptors(const openfluid::fluidx::FluidXDescriptor& FluidXDesc,
127  SimulationBlob& SimBlob);
128 
129  /**
130  Builds a generator ID
131  @param[in] VarName The name of the variable produced by the generator
132  @param[in] IsVector true if the variable is a vector, false if it is a scalar
133  @param[in] ClassName The name of the spatial unit class associated where the variable is produced
134  @return the generated ID
135  */
136  static std::string buildGeneratorID(const openfluid::core::VariableName_t& VarName,
137  bool IsVector,
138  const openfluid::core::UnitsClass_t& ClassName)
139  {
140  // <varname>.<unitsclass>.gen<type> where <type> can be scalar or vector
141 
142  std::string GenID(VarName);
143  GenID += ".";
144  GenID += ClassName;
145  GenID += ".gen";
146  if (IsVector)
147  {
148  GenID += "vector";
149  }
150  else
151  {
152  GenID += "scalar";
153  }
154 
155  return GenID;
156  }
157 
158 };
159 
160 
161 } } //namespaces
162 
163 
164 #endif /* __OPENFLUID_MACHINE_FACTORY_HPP__ */
Definition: FluidXDescriptor.hpp:70
Definition: DatastoreDescriptor.hpp:54
Definition: RunConfigurationDescriptor.hpp:52
Definition: SpatialGraph.hpp:52
Definition: ApplicationException.hpp:47
Definition: MonitoringInstance.hpp:58
std::string VariableName_t
Definition: TypeDefs.hpp:131
Definition: SpatialDomainDescriptor.hpp:62
std::string UnitsClass_t
Definition: TypeDefs.hpp:98
Definition: CoupledModelDescriptor.hpp:52
static std::string buildGeneratorID(const openfluid::core::VariableName_t &VarName, bool IsVector, const openfluid::core::UnitsClass_t &ClassName)
Definition: Factory.hpp:136
Definition: ModelInstance.hpp:65
#define OPENFLUID_API
Definition: dllexport.hpp:86
Definition: Datastore.hpp:58
Definition: MonitoringDescriptor.hpp:52
Definition: SimulationBlob.hpp:53
Definition: Factory.hpp:76