-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathCCPACSConfiguration.h
256 lines (186 loc) · 9.47 KB
/
CCPACSConfiguration.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
/*
* Copyright (C) 2007-2013 German Aerospace Center (DLR/SC)
*
* Created: 2010-08-13 Markus Litz <[email protected]>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file
* @brief Implementation of CPACS configuration handling routines.
*/
#ifndef CCPACSCONFIGURATION_H
#define CCPACSCONFIGURATION_H
#include "tigl_internal.h"
#include "CTiglUIDManager.h"
#include "CTiglLogging.h"
#include "CCPACSAircraftModel.h"
#include "CCPACSRotorcraftModel.h"
#include "generated/CPACSHeader.h"
#include "CCPACSWings.h"
#include "CCPACSRotors.h"
#include "CCPACSFuselages.h"
#include "CCPACSACSystems.h"
#include "CCPACSFarField.h"
#include "CCPACSGuideCurveProfiles.h"
#include "TopoDS_Compound.hxx"
#include "BRep_Builder.hxx"
#include "CTiglShapeCache.h"
#include "CTiglMemoryPool.h"
#include "CSharedPtr.h"
#include "CCPACSProfiles.h"
#include "CCPACSEngines.h"
namespace tigl
{
class CCPACSEnginePylons;
class CTiglFusePlane;
typedef CSharedPtr<CTiglFusePlane> PTiglFusePlane;
class CCPACSConfiguration
{
public:
// Constructor
TIGL_EXPORT CCPACSConfiguration(TixiDocumentHandle tixiHandle);
// Virtual Destructor
TIGL_EXPORT virtual ~CCPACSConfiguration();
// Invalidates the internal state of the configuration and forces
// recalculation of wires, lofts etc.
TIGL_EXPORT void Invalidate();
// Read CPACS configuration
TIGL_EXPORT void ReadCPACS(const std::string& configurationUID);
// Write CPACS configuration
TIGL_EXPORT void WriteCPACS(const std::string& configurationUID);
// Returns the underlying tixi document handle used by a CPACS configuration
TIGL_EXPORT TixiDocumentHandle GetTixiDocumentHandle() const;
// Returns whether this configuration is a rotorcraft
TIGL_EXPORT bool IsRotorcraft() const;
// Returns true if a wing or rotor profile with the given uid exists
TIGL_EXPORT bool HasWingProfile(std::string uid) const;
// Returns the class which holds all wing profiles
TIGL_EXPORT boost::optional<CCPACSWingProfiles&> GetWingProfiles();
TIGL_EXPORT boost::optional<const CCPACSWingProfiles&> GetWingProfiles() const;
// Returns the class which holds all rotor profiles
TIGL_EXPORT boost::optional<CCPACSRotorProfiles&> GetRotorProfiles();
// Returns the class which holds all wing profiles
TIGL_EXPORT boost::optional<CCPACSFuselageProfiles&> GetFuselageProfiles();
// Returns the wing or rotor profile for a given uid.
TIGL_EXPORT CCPACSWingProfile& GetWingProfile(std::string uid) const;
// Returns the total count of wings (including rotor blades) in a configuration
TIGL_EXPORT int GetWingCount() const;
// Returns the count of rotor blade wings in a configuration
TIGL_EXPORT int GetRotorBladeCount() const;
// Returns the wing (or rotor blade) for a given index.
TIGL_EXPORT CCPACSWing& GetWing(int index) const;
// Returns the wing (or rotor blade) for a given UID.
TIGL_EXPORT CCPACSWing& GetWing(const std::string& UID) const;
// Returns the wing (or rotor blade) index for a given UID.
TIGL_EXPORT int GetWingIndex(const std::string& UID) const;
// Returns the total count of generic systems in a configuration
TIGL_EXPORT int GetGenericSystemCount();
// Returns the generic system for a given index.
TIGL_EXPORT CCPACSGenericSystem& GetGenericSystem(int index);
// Returns the generic system for a given UID.
TIGL_EXPORT CCPACSGenericSystem& GetGenericSystem(const std::string& UID);
// Returns the total count of rotors in a configuration
TIGL_EXPORT int GetRotorCount() const;
// Returns the rotor for a given index.
TIGL_EXPORT CCPACSRotor& GetRotor(int index) const;
// Returns the rotor for a given UID.
TIGL_EXPORT CCPACSRotor& GetRotor(const std::string& UID) const;
// Returns the rotor index for a given UID.
TIGL_EXPORT int GetRotorIndex(const std::string& UID) const;
TIGL_EXPORT TopoDS_Shape GetParentLoft(const std::string& UID);
TIGL_EXPORT bool HasFuselageProfile(std::string uid) const;
// Returns the total count of fuselage profiles in this configuration
TIGL_EXPORT int GetFuselageProfileCount() const;
// Returns the fuselage profile for a given index.
TIGL_EXPORT CCPACSFuselageProfile& GetFuselageProfile(int index) const;
// Returns the fuselage profile for a given uid.
TIGL_EXPORT CCPACSFuselageProfile& GetFuselageProfile(std::string uid) const;
// Returns the total count of fuselages in a configuration
TIGL_EXPORT int GetFuselageCount() const;
// Returns the fuselage for a given index.
TIGL_EXPORT CCPACSFuselage& GetFuselage(int index) const;
// Returns the fuselage for a given UID.
TIGL_EXPORT CCPACSFuselage& GetFuselage(const std::string& UID) const;
// Returns the fuselage index for a given UID.
TIGL_EXPORT int GetFuselageIndex(const std::string& UID) const;
// Returns list of fuselages
TIGL_EXPORT CCPACSFuselages& GetFuselages();
TIGL_EXPORT const CCPACSFuselages& GetFuselages() const;
// Returns ducts
TIGL_EXPORT bool HasDucts() const;
TIGL_EXPORT boost::optional<CCPACSDucts>& GetDucts();
TIGL_EXPORT const boost::optional<CCPACSDucts>& GetDucts() const;
// Returns list of engine pylons
TIGL_EXPORT boost::optional<CCPACSEnginePylons>& GetEnginePylons();
TIGL_EXPORT const boost::optional<CCPACSEnginePylons>& GetEnginePylons() const;
// Returns list of engines
TIGL_EXPORT boost::optional<CCPACSEngines>& GetEngines();
TIGL_EXPORT const boost::optional<CCPACSEngines>& GetEngines() const;
// Returns list of engine positions
TIGL_EXPORT boost::optional<CCPACSEnginePositions>& GetEnginePositions();
TIGL_EXPORT const boost::optional<CCPACSEnginePositions>& GetEnginePositions() const;
TIGL_EXPORT CCPACSEngine& GetEngine(const std::string& UID) const;
// Returns the farfield
TIGL_EXPORT CCPACSFarField& GetFarField();
// Returns the number of external objects (i.e. linked CAD files like STEP, IGES)
TIGL_EXPORT int GetExternalObjectCount() const;
TIGL_EXPORT CCPACSExternalObject& GetExternalObject(int index) const;
// Returns the guide curve profile for a given UID.
TIGL_EXPORT CCPACSGuideCurveProfile& GetGuideCurveProfile(std::string UID);
TIGL_EXPORT const CCPACSGuideCurveProfile& GetGuideCurveProfile(std::string UID) const;
// Returns the uid manager
TIGL_EXPORT CTiglUIDManager& GetUIDManager();
TIGL_EXPORT const CTiglUIDManager& GetUIDManager() const;
// Returns the algorithm for fusing the aircraft
TIGL_EXPORT PTiglFusePlane AircraftFusingAlgo();
// Returns the length of the airplane
TIGL_EXPORT double GetAirplaneLenth();
// Returns the UID of the loaded configuration.
TIGL_EXPORT const std::string& GetUID() const;
TIGL_EXPORT CTiglShapeCache& GetShapeCache();
TIGL_EXPORT CTiglMemoryPool& GetMemoryPool();
/** Getter/Setter for member name */
TIGL_EXPORT std::string GetName() const;
/** Getter/Setter for member description */
TIGL_EXPORT std::string GetDescription() const;
/** Getter for member header */
TIGL_EXPORT CCPACSHeader* GetHeader();
/** Getter for member wings */
TIGL_EXPORT CCPACSWings& GetWings();
TIGL_EXPORT const CCPACSWings& GetWings() const;
TIGL_EXPORT boost::optional<CCPACSACSystems&> GetACSystems();
TIGL_EXPORT boost::optional<const CCPACSACSystems&> GetACSystems() const;
private:
// Copy constructor
CCPACSConfiguration(const CCPACSConfiguration&);
// Assignment operator
void operator=(const CCPACSConfiguration&);
private:
CTiglUIDManager uidManager; /**< Stores the unique ids of the components. */ // list as first member, has to be created first and destroyed last
boost::optional<CCPACSAircraftModel> aircraftModel;
boost::optional<CCPACSRotorcraftModel> rotorcraftModel;
boost::optional<CCPACSProfiles> profiles; /**< Wing airfoils, fuselage profiles, rotor airfoils, guide curve profiles */
boost::optional<CCPACSEngines> engines; /**< Engines under vehicle node */
TixiDocumentHandle tixiDocumentHandle; /**< Handle for internal TixiDocument */
CCPACSHeader header; /**< Configuration header element */
CCPACSFarField farField; /**< Far field configuration for CFD tools */
PTiglFusePlane aircraftFuser; /**< The aircraft fusing algo */
CTiglShapeCache shapeCache;
CTiglMemoryPool memoryPool;
};
/// Computes the bounding box coordinates of the specified component
TIGL_EXPORT void ComponentGetBoundingBox(const CCPACSConfiguration& config, const std::string& uid, CTiglPoint& min, CTiglPoint& max);
/// Computes the bounding box of the whole aircraft
TIGL_EXPORT void ConfigurationGetBoundingBox(const CCPACSConfiguration& config, CTiglPoint& min, CTiglPoint& max);
} // end namespace tigl
#endif // CCPACSCONFIGURATION_H