CONFIG LIB 1.5
Configuration Files Library (by TGG 2020)
Loading...
Searching...
No Matches
ms2data.h
Go to the documentation of this file.
1/*********************************************************************/
2/* */
3/* Config files library - (C) TGG 2015 */
4/* */
5/*********************************************************************/
6/* Warszawa, 2015 */
7/*********************************************************************/
8/* */
9/* File: ms2data.h */
10/* */
11/* Author: D.Mieszalski, modif: T.Grabowski */
12/* */
13/* Contents - ms2 data I/O class */
14/* */
15/* */
16/*********************************************************************/
17/* */
18/* */
19
24#ifndef _MS2_DATA_H_
25#define _MS2_DATA_H_
26
27#include <map>
28#include <iostream>
29#include <fstream>
30
31#include "iofun.h"
32#include "conect_data.h"
33
35
36class MS2_Data : public MS2_Data_Struct, public IOFUN
37{
38 protected:
39 static const int CURRENT_VERSION = 55;
41 char cComment[256];
42 std::string RemoveExt( std::string filename );
43
44 static std::map<int,const char*> AirfoilTypeStr;
45 //fuselage string
46 static std::map<int,const char*> FusTypeStr;
47 static std::map<int,const char*> FusCvrStr;
48 static std::map<int,const char*> FusCvrTypeStr;
49 static std::map<int,const char*> FusAirfoilSide;
50 //wing strings
51 static std::map<int,const char*> WingTypeStr;
52 static std::map<int,const char*> WingModTypeStr;
53 static std::map<int,const char*> WingModPanConcStr;
54 static std::map<int,const char*> WingDivSourceStr;
55 static std::map<int,const char*> WingSurfSideStr;
56 static std::map<int,const char*> WingRibTypeStr;
57 static std::map<int,const char*> WingSectionDivStr;
58 static std::map<int,const char*> NacelleSwirlStr;
59 static std::map<int,const char*> NacelleRangeStr;
60
61 int GetIndpWingNo( void );
62 int GetDpWingNo( void );
63
64 public :
65 bool WriteGeneral( std::ostream &f );
66
67 bool WriteWing( std::ostream &fout, MS2_Wing wing, int no );
68 bool WriteWingModule( std::ostream &fout, MS2_ModWingModule mod );
69 bool WriteSection( std::ostream &fout, MS2_Section sect );
70 bool WriteProfile( std::ostream &fout, MS2_Profile airfoil );
71 bool WriteFuselage( std::ostream &fout );
72 bool WriteConns( std::ostream &fout, bool bCom = true );
73 bool WriteWakes( std::ostream &fout, bool bCom = true );
74 bool WriteEmbededProfiles( std::ostream &fout, std::vector<MS2_Profile> *airfoil );
75
76 virtual bool ReadWing( FILE *t, MS2_Wing &wing, int iW, bool bRestrictive, bool auto_mod );
77 bool ReadWingModule( FILE* t, MS2_ModWingModule &mod, bool bRestrictive );
78 bool ReadSection( FILE *t, MS2_Section &sect );
79 bool ReadProfile( FILE *t, MS2_Profile &airfoil, const char* desc, bool bRestrictive );
80 bool ReadProfile( FILE *t, MS2_Profile &airfoil );
81
82 bool ReadFusFromParams( FILE *t, bool bRestrictive);
83 bool ReadFusEllipse( FILE *t, MS2_SuperEllipse &SupEll, const char* desc);
84 bool ReadFusAirfoil( FILE *t, MS2_FusAirfoil &airfoil, const char* desc, bool bRestrictive );
85 bool ReadChordDivision( FILE* t, MS2_Wing &wing, bool bRestrictive );
86 // bool ReadNacelle( FILE *t, MS2_Nacelle & nac, int no );
87
88 static void ClearFusCurve( MS2_FusCurve &cvr, int elltype );
89 static void SetFusCurveDefs( MS2_FusCurve &cvr, int elltype );
90 static void ClearGeneral( MS2_General &gen );
91
92 virtual void Comment( void );
93
94 MS2_Data( void );
95 virtual ~MS2_Data( void );
96
97 void Clear(void);
98 void SetDefaults( void );
99 bool Read( const char * file, bool bRestrictive, bool auto_mod );
100 bool Write( const char *file );
101
102 int GetVersion( void ){ return iVersion; }
103 int GetNWings( void ){ return Wings.size(); }
104 int GetNConns( void ){ return Conns.size(); }
105 int GetNWakes( void ){ return Wakes.size(); }
106 int GetNProfs( void ){ return Profiles.size(); }
107 std::string WingSurfName( int n );
108 std::string DivTypeName( int div );
109
110 static void SetPrfDefs( MS2_Profile &prf );
111 static void SetWingDefs( MS2_Wing &wing );
112 static void SetSectionDefs( MS2_Section &sect );
113 static void SetModuleDefs( MS2_ModWingModule &mod );
114 static void SetNacelleWingDefs( MS2_NacelleWing &nac );
115 static void SetFuselageDefs( MS2_Fuselage &fus );
116 static void SetConnectionDefs( MS2_Conn &conn );
117 static void SetWakeDefs( MS2_Wake &wake );
118
119 static void ClearPrf( MS2_Profile &prf );
120 static void ClearWing( MS2_Wing &wing );
121 static void ClearSection( MS2_Section &sect );
122 static void ClearModule( MS2_ModWingModule &mod );
123 static void ClearNacelleWing( MS2_NacelleWing &nac );
124 static void ClearFuselage( MS2_Fuselage &fus );
125 static void ClearConnection( MS2_Conn &conn );
126 static void ClearWake( MS2_Wake &wake );
127
128 static void CONNECT2MS2_Conn( CONNECT_DATA &Con, MS2_Conn &newConn );
129 static void MS2_Conn2CONNECT( MS2_Conn &Conn, CONNECT_DATA &newCon );
130
131 static int find_section( FILE *ff, const char* sec );
132 static bool has_section( FILE *t, const char * sec );
133
134 static std::string ConnTypeName( int n );
135 static std::string WakeTypeName( int n );
136 static std::string TruncateQuotMarks( std::string str );
137 static std::string RemoveWhiteSpaces( std::string str );
138 static std::string GetNACANoAsString( int no );
139};
140
141#endif
142
143
Structure, which defines connection of two wings.
Definition conect_data.h:34
Simple I/O functions class.
Definition iofun.h:42
MS2 data structure manipulation.
Definition ms2data.h:37
int GetDpWingNo(void)
returns number of depedentend wings (SLAVE)
Definition ms2data.cpp:2923
int GetNWings(void)
returns number of wings
Definition ms2data.h:103
std::string WingSurfName(int n)
returns wing surface type (name) - see MS2WingSurf
Definition ms2data.cpp:546
void SetDefaults(void)
set default reference values
Definition ms2data.cpp:194
static std::map< int, const char * > AirfoilTypeStr
file, NACA, table
Definition ms2data.h:44
static void ClearWing(MS2_Wing &wing)
cleans MS2_Wing object (wing definition)
Definition ms2data.cpp:310
static std::map< int, const char * > NacelleSwirlStr
swirl up, swirl down
Definition ms2data.h:58
bool WriteEmbededProfiles(std::ostream &fout, std::vector< MS2_Profile > *airfoil)
writes embeded airfoil geometry
Definition ms2data.cpp:2886
int GetIndpWingNo(void)
returns number of indepedentend wings (MASTER & INDEPENDENT)
Definition ms2data.cpp:2913
static void ClearGeneral(MS2_General &gen)
cleans MS2_General object (general data)
Definition ms2data.cpp:220
bool WriteFuselage(std::ostream &fout)
writes fuselage data
Definition ms2data.cpp:2503
static std::map< int, const char * > WingModTypeStr
root, equi line, arc, line
Definition ms2data.h:52
virtual void Comment(void)
displays comment (warning or information)
Definition ms2data.cpp:674
static std::map< int, const char * > FusTypeStr
file, parameters
Definition ms2data.h:46
static void SetSectionDefs(MS2_Section &sect)
sets MS2_Section object (wing section definition)
Definition ms2data.cpp:388
static void ClearSection(MS2_Section &sect)
cleans MS2_Section object (wing section definition)
Definition ms2data.cpp:370
static void SetModuleDefs(MS2_ModWingModule &mod)
sets MS2_ModWingModule object (wing module definition)
Definition ms2data.cpp:447
char cComment[256]
message text in case of error
Definition ms2data.h:41
bool ReadFusFromParams(FILE *t, bool bRestrictive)
reads Fuselage data in case fuselage defined using modules
Definition ms2data.cpp:994
static void ClearWake(MS2_Wake &wake)
cleans MS2_Wake object (wake information)
Definition ms2data.cpp:493
static void SetWingDefs(MS2_Wing &wing)
sets MS2_Wing object (wing definition)
Definition ms2data.cpp:339
bool WriteProfile(std::ostream &fout, MS2_Profile airfoil)
writes airfoil data
Definition ms2data.cpp:2874
static void ClearModule(MS2_ModWingModule &mod)
cleans MS2_ModWingModule object (wing module definition)
Definition ms2data.cpp:430
bool WriteWingModule(std::ostream &fout, MS2_ModWingModule mod)
writes modular wing's data
Definition ms2data.cpp:2831
static std::map< int, const char * > WingSectionDivStr
linear, cosine etc.
Definition ms2data.h:57
int iVersion
version of read file
Definition ms2data.h:40
std::string RemoveExt(std::string filename)
removes the filename extention
Definition ms2data.cpp:2396
static void MS2_Conn2CONNECT(MS2_Conn &Conn, CONNECT_DATA &newCon)
converts MS2_Conn to CONNECT_DATA
Definition ms2data.cpp:2273
int GetNProfs(void)
returns number of embeded airfoils
Definition ms2data.h:106
static std::string RemoveWhiteSpaces(std::string str)
removes white chars from string
Definition ms2data.cpp:649
static void ClearFuselage(MS2_Fuselage &fus)
cleans MS2_Fuselage object (fuselage definition)
Definition ms2data.cpp:231
static void SetFuselageDefs(MS2_Fuselage &fus)
sets MS2_Fuselage object (fuselage definition)
Definition ms2data.cpp:254
static void SetPrfDefs(MS2_Profile &prf)
sets MS2_Profile object (airfoil)
Definition ms2data.cpp:418
bool Read(const char *file, bool bRestrictive, bool auto_mod)
reads ms2 file
Definition ms2data.cpp:681
static const int CURRENT_VERSION
current version of ms2data module
Definition ms2data.h:39
static void ClearConnection(MS2_Conn &conn)
cleans MS2_Conn object (wings connection)
Definition ms2data.cpp:465
static int find_section(FILE *ff, const char *sec)
to find the section in ms2 file - imported from "mesh2.h"
Definition ms2data.cpp:2287
bool ReadChordDivision(FILE *t, MS2_Wing &wing, bool bRestrictive)
reads user define chord division (see DT_USER)
Definition ms2data.cpp:1824
int GetNWakes(void)
returns number of wake infos
Definition ms2data.h:105
bool ReadFusEllipse(FILE *t, MS2_SuperEllipse &SupEll, const char *desc)
reads fuselage elipse data
Definition ms2data.cpp:1322
static std::string GetNACANoAsString(int no)
converts NACA profile number to string
Definition ms2data.cpp:664
static void SetWakeDefs(MS2_Wake &wake)
sets MS2_Wake object (wake information)
Definition ms2data.cpp:505
static void ClearPrf(MS2_Profile &prf)
cleans MS2_Profile object (airfoil)
Definition ms2data.cpp:406
static void CONNECT2MS2_Conn(CONNECT_DATA &Con, MS2_Conn &newConn)
converts CONNECT_DATA to MS2_Conn
Definition ms2data.cpp:2258
static std::map< int, const char * > WingModPanConcStr
paneling distribution in module wings modules ( left, right center )
Definition ms2data.h:53
static std::string ConnTypeName(int n)
returns connection type name
Definition ms2data.cpp:595
static void SetFusCurveDefs(MS2_FusCurve &cvr, int elltype)
sets MS2_Profile object (airfoil)
Definition ms2data.cpp:294
static std::map< int, const char * > WingRibTypeStr
open, external, both
Definition ms2data.h:56
bool WriteWing(std::ostream &fout, MS2_Wing wing, int no)
writes wing's data
Definition ms2data.cpp:2761
static std::string TruncateQuotMarks(std::string str)
truncates the quote marks from string
Definition ms2data.cpp:634
static std::map< int, const char * > FusCvrStr
spine, up cvr etc.
Definition ms2data.h:47
bool WriteConns(std::ostream &fout, bool bCom=true)
writes connections data
Definition ms2data.cpp:2685
static std::map< int, const char * > WingTypeStr
sections, modules, nacelle
Definition ms2data.h:51
bool ReadFusAirfoil(FILE *t, MS2_FusAirfoil &airfoil, const char *desc, bool bRestrictive)
reads airfoil data used to define fuselage shape
Definition ms2data.cpp:1347
int GetNConns(void)
returns number of connections
Definition ms2data.h:104
bool WriteWakes(std::ostream &fout, bool bCom=true)
writes extra wake infos
Definition ms2data.cpp:2721
static std::map< int, const char * > FusAirfoilSide
up , down
Definition ms2data.h:49
static std::map< int, const char * > WingDivSourceStr
master, slave
Definition ms2data.h:54
static std::string WakeTypeName(int n)
returns wake info type name
Definition ms2data.cpp:616
static bool has_section(FILE *t, const char *sec)
check if section exist
Definition ms2data.cpp:2308
static std::map< int, const char * > NacelleRangeStr
swirl range: full, half
Definition ms2data.h:59
static void SetConnectionDefs(MS2_Conn &conn)
sets MS2_Conn object (wings connection)
Definition ms2data.cpp:479
static std::map< int, const char * > WingSurfSideStr
all, top, bottom
Definition ms2data.h:55
static void SetNacelleWingDefs(MS2_NacelleWing &nac)
sets MS2_NacelleWing object (jet nacelle definition)
Definition ms2data.cpp:531
bool ReadWingModule(FILE *t, MS2_ModWingModule &mod, bool bRestrictive)
reads Wing Module data (see MS2_ModWingModule)
Definition ms2data.cpp:1956
int GetVersion(void)
returns ms2 file version
Definition ms2data.h:102
static std::map< int, const char * > FusCvrTypeStr
ellipse, airfoil etc.
Definition ms2data.h:48
bool ReadProfile(FILE *t, MS2_Profile &airfoil, const char *desc, bool bRestrictive)
reads Profile data structure (see MS2_Profile)
Definition ms2data.cpp:2107
std::string DivTypeName(int div)
returns chordwise division type (name) - see MS2DivType
Definition ms2data.cpp:569
bool WriteSection(std::ostream &fout, MS2_Section sect)
writes data of wing built from sections
Definition ms2data.cpp:2862
void Clear(void)
clear local variables
Definition ms2data.cpp:183
bool Write(const char *file)
writes ms2 file
Definition ms2data.cpp:2327
static void ClearFusCurve(MS2_FusCurve &cvr, int elltype)
cleans MS2_FusCurve object (fuselge module)
Definition ms2data.cpp:279
bool ReadSection(FILE *t, MS2_Section &sect)
reads Wing Section data (see MS2_Section)
Definition ms2data.cpp:2079
virtual bool ReadWing(FILE *t, MS2_Wing &wing, int iW, bool bRestrictive, bool auto_mod)
reads wing data (see MS2_Wing)
Definition ms2data.cpp:1452
static void ClearNacelleWing(MS2_NacelleWing &nac)
cleans MS2_NacelleWing object (jet nacelle definition)
Definition ms2data.cpp:517
bool WriteGeneral(std::ostream &f)
writes general data, incuding reference values
Definition ms2data.cpp:2407
This file contains some smart I/O functions.
connection
MS2 data structure definition.
std::vector< MS2_Wake > Wakes
special info for wake calculation
std::vector< MS2_Wing > Wings
wings data
std::vector< MS2_Profile > Profiles
embedded profiles
std::vector< MS2_Conn > Conns
connections data
data of airfoil taken to fuselage geometry generating
fuselage outline curve
fuselage definition
general data for ms2 structure (geometry)
module used for "module wing" definition
data of nacelle type of wing
Profile definition.
definition of section (used in "Section Wing")
data for module of super ellipse type
wing definition