CONFIG LIB 1.5
Configuration Files Library (by TGG 2020)
Loading...
Searching...
No Matches
MS2_Data Class Reference

MS2 data structure manipulation. More...

#include <ms2data.h>

Inheritance diagram for MS2_Data:
MS2_Data_Struct IOFUN

Public Member Functions

bool WriteGeneral (std::ostream &f)
 writes general data, incuding reference values
 
bool WriteWing (std::ostream &fout, MS2_Wing wing, int no)
 writes wing's data
 
bool WriteWingModule (std::ostream &fout, MS2_ModWingModule mod)
 writes modular wing's data
 
bool WriteSection (std::ostream &fout, MS2_Section sect)
 writes data of wing built from sections
 
bool WriteProfile (std::ostream &fout, MS2_Profile airfoil)
 writes airfoil data
 
bool WriteFuselage (std::ostream &fout)
 writes fuselage data
 
bool WriteConns (std::ostream &fout, bool bCom=true)
 writes connections data
 
bool WriteWakes (std::ostream &fout, bool bCom=true)
 writes extra wake infos
 
bool WriteEmbededProfiles (std::ostream &fout, std::vector< MS2_Profile > *airfoil)
 writes embeded airfoil geometry
 
virtual bool ReadWing (FILE *t, MS2_Wing &wing, int iW, bool bRestrictive, bool auto_mod)
 reads wing data (see MS2_Wing)
 
bool ReadWingModule (FILE *t, MS2_ModWingModule &mod, bool bRestrictive)
 reads Wing Module data (see MS2_ModWingModule)
 
bool ReadSection (FILE *t, MS2_Section &sect)
 reads Wing Section data (see MS2_Section)
 
bool ReadProfile (FILE *t, MS2_Profile &airfoil, const char *desc, bool bRestrictive)
 reads Profile data structure (see MS2_Profile)
 
bool ReadProfile (FILE *t, MS2_Profile &airfoil)
 reads Profile data in case AIRFOIL_FILE type
 
bool ReadFusFromParams (FILE *t, bool bRestrictive)
 reads Fuselage data in case fuselage defined using modules
 
bool ReadFusEllipse (FILE *t, MS2_SuperEllipse &SupEll, const char *desc)
 reads fuselage elipse data
 
bool ReadFusAirfoil (FILE *t, MS2_FusAirfoil &airfoil, const char *desc, bool bRestrictive)
 reads airfoil data used to define fuselage shape
 
bool ReadChordDivision (FILE *t, MS2_Wing &wing, bool bRestrictive)
 reads user define chord division (see DT_USER)
 
virtual void Comment (void)
 displays comment (warning or information)
 
void Clear (void)
 clear local variables
 
void SetDefaults (void)
 set default reference values
 
bool Read (const char *file, bool bRestrictive, bool auto_mod)
 reads ms2 file
 
bool Write (const char *file)
 writes ms2 file
 
int GetVersion (void)
 returns ms2 file version
 
int GetNWings (void)
 returns number of wings
 
int GetNConns (void)
 returns number of connections
 
int GetNWakes (void)
 returns number of wake infos
 
int GetNProfs (void)
 returns number of embeded airfoils
 
std::string WingSurfName (int n)
 returns wing surface type (name) - see MS2WingSurf
 
std::string DivTypeName (int div)
 returns chordwise division type (name) - see MS2DivType
 

Static Public Member Functions

static void ClearFusCurve (MS2_FusCurve &cvr, int elltype)
 cleans MS2_FusCurve object (fuselge module)
 
static void SetFusCurveDefs (MS2_FusCurve &cvr, int elltype)
 sets MS2_Profile object (airfoil)
 
static void ClearGeneral (MS2_General &gen)
 cleans MS2_General object (general data)
 
static void SetPrfDefs (MS2_Profile &prf)
 sets MS2_Profile object (airfoil)
 
static void SetWingDefs (MS2_Wing &wing)
 sets MS2_Wing object (wing definition)
 
static void SetSectionDefs (MS2_Section &sect)
 sets MS2_Section object (wing section definition)
 
static void SetModuleDefs (MS2_ModWingModule &mod)
 sets MS2_ModWingModule object (wing module definition)
 
static void SetNacelleWingDefs (MS2_NacelleWing &nac)
 sets MS2_NacelleWing object (jet nacelle definition)
 
static void SetFuselageDefs (MS2_Fuselage &fus)
 sets MS2_Fuselage object (fuselage definition)
 
static void SetConnectionDefs (MS2_Conn &conn)
 sets MS2_Conn object (wings connection)
 
static void SetWakeDefs (MS2_Wake &wake)
 sets MS2_Wake object (wake information)
 
static void ClearPrf (MS2_Profile &prf)
 cleans MS2_Profile object (airfoil)
 
static void ClearWing (MS2_Wing &wing)
 cleans MS2_Wing object (wing definition)
 
static void ClearSection (MS2_Section &sect)
 cleans MS2_Section object (wing section definition)
 
static void ClearModule (MS2_ModWingModule &mod)
 cleans MS2_ModWingModule object (wing module definition)
 
static void ClearNacelleWing (MS2_NacelleWing &nac)
 cleans MS2_NacelleWing object (jet nacelle definition)
 
static void ClearFuselage (MS2_Fuselage &fus)
 cleans MS2_Fuselage object (fuselage definition)
 
static void ClearConnection (MS2_Conn &conn)
 cleans MS2_Conn object (wings connection)
 
static void ClearWake (MS2_Wake &wake)
 cleans MS2_Wake object (wake information)
 
static void CONNECT2MS2_Conn (CONNECT_DATA &Con, MS2_Conn &newConn)
 converts CONNECT_DATA to MS2_Conn
 
static void MS2_Conn2CONNECT (MS2_Conn &Conn, CONNECT_DATA &newCon)
 converts MS2_Conn to CONNECT_DATA
 
static int find_section (FILE *ff, const char *sec)
 to find the section in ms2 file - imported from "mesh2.h"
 
static bool has_section (FILE *t, const char *sec)
 check if section exist
 
static std::string ConnTypeName (int n)
 returns connection type name
 
static std::string WakeTypeName (int n)
 returns wake info type name
 
static std::string TruncateQuotMarks (std::string str)
 truncates the quote marks from string
 
static std::string RemoveWhiteSpaces (std::string str)
 removes white chars from string
 
static std::string GetNACANoAsString (int no)
 converts NACA profile number to string
 
- Static Public Member Functions inherited from IOFUN
static void Win2Unix (char *s)
 conversion of directory separators - MS Windows to Unix
 
static void Unix2Win (char *s)
 conversion of directory separators - Unix to MS Windows
 
static int ReadComm (FILE *stream)
 Function to read of a comment till the end of line. It returns 0 or EOF if it is performed.
 
static void ReadDummy (FILE *stream)
 Function to read a comment line.
 
static int ReadPar (FILE *stream, const char *Format, void *Par)
 Function to read one variable. The type of variable depends on Format, compatible with stdio library.
 
static int ReadPar (FILE *stream, const char *Format, void *Par1, void *Par2)
 Function to read two variables. The type of variables depends on Format, compatible with stdio library.
 
static int ReadPar (FILE *stream, const char *Format, void *Par1, void *Par2, void *Par3)
 Function to read three variables. The type of variables depends on Format, compatible with stdio library.
 
static int ReadPar (FILE *stream, const char *Format, void *Par1, void *Par2, void *Par3, void *Par4)
 Function to read four variables. The type of variables depends on Format, compatible with stdio library.
 
static int ReadVect3 (FILE *stream, double *Par, double dScal=1.)
 Function to read double vector "Par" of "3" dimension from FILE "stream". The read values are scaled by multiplier "dScal".
 
static int ReadVect3 (FILE *stream, float *Par, float fScal=1.)
 Function to read float vector "Par" of "3" dimension from FILE "stream". The read values are scaled by multiplier "fScal".
 
static int ReadVect3 (FILE *stream, long *Par, long lScal=1)
 Function to read long vector "Par" of "3" dimension from FILE "stream". The read values are scaled by multiplier "lScal".
 
static int ReadVect3 (FILE *stream, int *Par, int iScal=1)
 Function to read int vector "Par" of "3" dimension from FILE "stream". The read values are scaled by multiplier "iScal".
 
static int ReadVect (FILE *stream, double *Par, int n, double dScal=1.)
 Function to read double vector "Par" of "n" dimension from FILE "stream". The read values are scaled by multiplier "dScal".
 
static int ReadVect (FILE *stream, float *Par, int n, float fScal=1.)
 Function to read float vector "Par" of "n" dimension from FILE "stream". The read values are scaled by multiplier "fScal".
 
static int ReadVect (FILE *stream, long *Par, int n, long lScal=1)
 Function to read long vector "Par" of "n" dimension from FILE "stream". The read values are scaled by multiplier "lScal".
 
static int ReadVect (FILE *stream, int *Par, int n, int iScal=1)
 Function to read int vector "Par" of "n" dimension from FILE "stream". The read values are scaled by multiplier "iScal".
 
static int ReadStr (FILE *stream, char *Par)
 Function to read the new line from FILE "stream" and to store it in table of char "Par". The starting and ending blanc charaters are clipped.
 
static void ReadStrL (FILE *stream, char *Par, int *len)
 Function to read the string (Par) from FILE "stream". It reads from current pointer of FILE to the end of line or EOF. Number of read characters is returned in "len".
 
static void ClipString (char *string)
 Clipping of the "string" up to the first blanc character or comment "#" character.
 
static void ClipFileName (char *string)
 Clipping of the ending blanc characters of "string".
 
static bool CompareStrings (char *str1, char *str2)
 Compares two strings (str1 and str2). Returns true if they match, false otherwise.
 
static int file_exist (const char *name)
 Returns true (1) if file "name" does exist, 0 otherwise.
 
static const char * filename_name (const char *name)
 Returns pointer to filename without path.
 
static const char * filename_ext (const char *buf)
 Returns pointer to filename extension.
 
static char * filename_setext (char *buf, int buflen, const char *ext)
 set/change filename extension
 
static int filename_dir (char *name)
 returns the length of the path in (path)name
 
static const char * filename_date (const char *name)
 Returns pointer to the string that contains the date of last file modification/creation.
 
static FILE * fopen (const char *filename, const char *mode)
 Cross-platform function to fopen function that supports UTF-8 encoded name.
 
static int stat (const char *f, struct stat *b)
 Cross-platform function to stat() a file using a UTF-8 encoded name or value.
 
static size_t strlcpy (char *d, const char *s, size_t bufsize)
 The implementation of nonstandard strlcpy function.
 
static int nLines (FILE *stream)
 Returns number of lines of text file from current pointer to EOF.
 
static int nColumns (FILE *stream, char Par[][32])
 Returns number of columns of text file (number of strings in the first line). Names of columns are stored in Par array.
 
static int isstrblank (char *cc, int iLen)
 Checks if string (cc) is blank (1/0)
 
static void ReadVect3 (FILE *stream, VECTOR_3D *Vec, double dScal=1.)
 Function to read VECTOR_3D Vec components from FILE "stream". The read values are scaled by multiplier "dScal".
 
static int readln (FILE *ff, char *value_x)
 Pascal style "readln" function to read string.
 
static int readln (FILE *ff, int *value_x)
 Pascal style "readln" function to read int.
 
static int readln (FILE *ff, long *value_x)
 Pascal style "readln" function to read long.
 
static int readln (FILE *ff, float *value_x)
 Pascal style "readln" function to read float.
 
static int readln (FILE *ff, double *value_x)
 Pascal style "readln" function to read double.
 
static int readln (FILE *ff, long double *value_x)
 Pascal style "readln" function to read long double.
 
static int readln (FILE *ff)
 Pascal style "readln" function to read comment.
 
static int readln (FILE *ff, VECTOR_3D *vec)
 Pascal style "readln" function to read VECTOR_3D components.
 
static int read (FILE *ff, char *value_x)
 Pascal style "read" function to read string.
 
static int read (FILE *ff, int *value_x)
 Pascal style "read" function to read int.
 
static int read (FILE *ff, long *value_x)
 Pascal style "read" function to read long.
 
static int read (FILE *ff, float *value_x)
 Pascal style "read" function to read float.
 
static int read (FILE *ff, double *value_x)
 Pascal style "read" function to read double.
 
static int read (FILE *ff, long double *value_x)
 Pascal style "read" function to read long double.
 
static int read (FILE *ff, VECTOR_3D *vec)
 Pascal style "read" function to read VECTOR_3D components.
 

Protected Member Functions

std::string RemoveExt (std::string filename)
 removes the filename extention
 
int GetIndpWingNo (void)
 returns number of indepedentend wings (MASTER & INDEPENDENT)
 
int GetDpWingNo (void)
 returns number of depedentend wings (SLAVE)
 

Protected Attributes

int iVersion
 version of read file
 
char cComment [256]
 message text in case of error
 

Static Protected Attributes

static const int CURRENT_VERSION = 55
 current version of ms2data module
 
static std::map< int, const char * > AirfoilTypeStr = CreateAirfoilTypeStr()
 file, NACA, table
 
static std::map< int, const char * > FusTypeStr = CreateFusTypeStr()
 file, parameters
 
static std::map< int, const char * > FusCvrStr = CreateFusCvrStr()
 spine, up cvr etc.
 
static std::map< int, const char * > FusCvrTypeStr = CreateFusCvrTypeStr()
 ellipse, airfoil etc.
 
static std::map< int, const char * > FusAirfoilSide = CreateFusAirfoilSide()
 up , down
 
static std::map< int, const char * > WingTypeStr = CreateWingTypeStr()
 sections, modules, nacelle
 
static std::map< int, const char * > WingModTypeStr = CreateWingModTypeStr()
 root, equi line, arc, line
 
static std::map< int, const char * > WingModPanConcStr = CreateWingModConcStr()
 paneling distribution in module wings modules ( left, right center )
 
static std::map< int, const char * > WingDivSourceStr = CreateWingDivSourceStr()
 master, slave
 
static std::map< int, const char * > WingSurfSideStr = CreateWingSurfSideStr()
 all, top, bottom
 
static std::map< int, const char * > WingRibTypeStr = CreateWingRibTypeStr()
 open, external, both
 
static std::map< int, const char * > WingSectionDivStr = CreateWingSectionDivStr()
 linear, cosine etc.
 
static std::map< int, const char * > NacelleSwirlStr = CreateNacelleSwirlStr()
 swirl up, swirl down
 
static std::map< int, const char * > NacelleRangeStr = CreateNacelleRangeStr()
 swirl range: full, half
 

Additional Inherited Members

- Public Attributes inherited from MS2_Data_Struct
MS2_General General
 general geometric data
 
MS2_Fuselage Fuselage
 fuselage data
 
std::vector< MS2_WingWings
 wings data
 
std::vector< MS2_ConnConns
 connections data
 
std::vector< MS2_WakeWakes
 special info for wake calculation
 
std::vector< MS2_ProfileProfiles
 embedded profiles
 

Detailed Description

MS2 data structure manipulation.

Definition at line 36 of file ms2data.h.

Constructor & Destructor Documentation

◆ MS2_Data()

MS2_Data::MS2_Data ( void )

Definition at line 173 of file ms2data.cpp.

174{
175 Clear();
176}
void Clear(void)
clear local variables
Definition ms2data.cpp:183

◆ ~MS2_Data()

MS2_Data::~MS2_Data ( void )
virtual

Definition at line 178 of file ms2data.cpp.

179{
180
181}

Member Function Documentation

◆ Clear()

void MS2_Data::Clear ( void )

clear local variables

Definition at line 183 of file ms2data.cpp.

184{
185 //Version
186 iVersion = 0;
189 Wings.clear();
190 Conns.clear();
191 Wakes.clear();
192}
static void ClearGeneral(MS2_General &gen)
cleans MS2_General object (general data)
Definition ms2data.cpp:220
int iVersion
version of read file
Definition ms2data.h:40
static void ClearFuselage(MS2_Fuselage &fus)
cleans MS2_Fuselage object (fuselage definition)
Definition ms2data.cpp:231
std::vector< MS2_Wake > Wakes
special info for wake calculation
std::vector< MS2_Wing > Wings
wings data
MS2_Fuselage Fuselage
fuselage data
std::vector< MS2_Conn > Conns
connections data
MS2_General General
general geometric data

◆ ClearConnection()

void MS2_Data::ClearConnection ( MS2_Conn & conn)
static

cleans MS2_Conn object (wings connection)

Definition at line 465 of file ms2data.cpp.

466{
467 conn.Name .clear();
468 conn.Type = 0; //vert to horiz
469 conn.Active = 0;
470 conn.Wing1No = 0;
471 conn.Wing2No = 0;
472 conn.Wing1Rib = 0;
473 conn.Wing2Rib = 0;
474 conn.Wing2LongLE = 0;
475 conn.Wing2LongTE = 0;
476 conn.Wing2Surf = 0;
477}
int Type
Type of connection (horizontal, vertical, parallel) - according to MS2ConnType.
int Wing2No
number of 2'nd wing
int Wing2LongTE
number of wing's 2 longeron connected to trailing point of wing 1
int Wing2Rib
number of wing's 2 rib connected to wing 1
int Active
1 - active, 0 - not active
int Wing1Rib
number of wing's 1 rib connected to wing 2
int Wing2LongLE
number of wing's 2 longeron connected to leading point of wing 1
std::string Name
name of particular connection
int Wing2Surf
wing 2 surface for modification (0-bottom, 1-top in horizontal connection or 0-exterior,...
int Wing1No
number of 1'st wing

Referenced by Read().

◆ ClearFusCurve()

void MS2_Data::ClearFusCurve ( MS2_FusCurve & cvr,
int elltype )
static

cleans MS2_FusCurve object (fuselge module)

Definition at line 279 of file ms2data.cpp.

280{
281 cvr.Type = ELLIPSE;
282 cvr.Factor = 0;
283 cvr.Ellipse.EllType = elltype;
284 cvr.Ellipse.NF = cvr.Ellipse.NR = 0;
285 cvr.Ellipse.L = 0;
286 cvr.Ellipse.H = 0;
287 cvr.Ellipse.CvFactF = cvr.Ellipse.CvFactR = 0;
289 cvr.Airfoil.Name.clear();
290 cvr.Airfoil.NACAnumber = 12;
291 cvr.Airfoil.Side = 0;
292}
@ AIRFOIL_FILE
airfoil geometry defined in the separate file
int Side
airfoil's side
int Type
curve type ( see MS2FusCvrType )
MS2_SuperEllipse Ellipse
data used when Type is ELLIPSE
double Factor
data used when Type is CONSTANT
MS2_FusAirfoil Airfoil
data used when Type is AIRFOIL
int NACAnumber
code number of NACA - 4 or 5 digits in case iType == AIRFOIL_NACA
std::string Name
full name with file path
int iType
type of profile data: 0 - from file, 1 - NACA 4 or 5 digits airfoil, 2 - data embedded in MS2 file
double L
front length
int NF
division number front
double CvFactR
convexity factor rear
int EllType
Ellipse type - ( spine ellipse or normal ellipse )
int NR
division number rear
double H
front height
double CvFactF
convexity factor front

Referenced by ClearFuselage().

◆ ClearFuselage()

void MS2_Data::ClearFuselage ( MS2_Fuselage & fus)
static

cleans MS2_Fuselage object (fuselage definition)

Definition at line 231 of file ms2data.cpp.

232{
233 fus.Type = 0;
234 fus.Exists = false;
235 fus.Active = 0;
236 fus.UserDiv.clear();
237 fus.File.Name.clear();
238 fus.Params.Name.clear();
239 fus.Params.Nup = fus.Params.Ndown = 0;
240 fus.Params.Scale = fus.Params.ScaleX = fus.Params.ScaleY = fus.Params.ScaleZup = fus.Params.ScaleZdown = 0;
241 fus.Params.X0 = fus .Params.Y0 = fus.Params.Z0 = 0.0;
242 fus.Params.BendLength = 0;
243 fus.Params.BendAngle = 0;
244 fus.Params.Length = 0;
245
246 ClearFusCurve( fus.Params.SpineCvr, ELLIPSE_SPINE );
247 ClearFusCurve( fus.Params.UpCvr, ELLIPSE_NORMAL );
248 ClearFusCurve( fus.Params.SideCvr, ELLIPSE_NORMAL );
249 ClearFusCurve( fus.Params.DownCvr, ELLIPSE_NORMAL );
250 ClearFusCurve( fus.Params.CvFactUp, ELLIPSE_NORMAL);
251 ClearFusCurve( fus.Params.CvFactDown, ELLIPSE_NORMAL );
252}
static void ClearFusCurve(MS2_FusCurve &cvr, int elltype)
cleans MS2_FusCurve object (fuselge module)
Definition ms2data.cpp:279
std::string Name
fuselage data (geometry) filename
double X0
x coordinate of nose origin
double Y0
y coordinate of nose origin
double BendLength
bend distance
MS2_FusCurve CvFactUp
ConvexityFactor curve (upper)
double Length
fuselage length
double ScaleX
scale longwise X axis
double ScaleZup
scale longwise Z axis Up
int Ndown
division of bottom part
MS2_FusCurve UpCvr
Z Upper contour line.
double ScaleY
scale longwise Y axis
int Nup
division of top part
std::string Name
fuselage name
double ScaleZdown
scale longwise Z axis Down
double Scale
general scale
MS2_FusCurve CvFactDown
ConvexityFactor curve (lower)
double Z0
z coordinate of nose origin
MS2_FusCurve DownCvr
Z Lower contour line.
double BendAngle
bend angle [deg]
MS2_FusCurve SpineCvr
X contour line.
MS2_FusCurve SideCvr
Y contour line.
int Active
1 - active, 0 - not active
MS2_Fuselage_File File
fuselage from *.f file
std::vector< double > UserDiv
user defined divisions
int Type
MS2FusType.
bool Exists
fuselage presence flag
MS2_Fuselage_Params Params
fuselage build from parameters

Referenced by Clear(), and Read().

◆ ClearGeneral()

void MS2_Data::ClearGeneral ( MS2_General & gen)
static

cleans MS2_General object (general data)

Definition at line 220 of file ms2data.cpp.

221{
222 gen.InpFileName.clear();
223 gen.SymmOpt = 0;
224 gen.OutOpt = 0;
225 gen.RefVal.AutoComp = 0;
226 gen.RefVal.B = gen.RefVal.MAC = gen.RefVal.S = 0;
227 gen.RefVal.Scale = 1;
228 gen.RefVal.MX = gen.RefVal.MZ = 0;
229}
std::string InpFileName
output [*.inp] file name
int OutOpt
output type ( see MS2OutOpt )
MS2_Ref RefVal
reference values
int SymmOpt
symmetry ( see MS2SymmOpt )
double MAC
Mean Aerodynamic Chord.
double MX
X coordinate of reference point for moment calculation.
double Scale
scale of geometry (default Scale=1)
double MZ
Z coordinate of reference point for moment calculation.
bool AutoComp
compute reference parameters automatically (flag)
double B
wing span
double S
reference (main wing) area

Referenced by Clear(), and Read().

◆ ClearModule()

void MS2_Data::ClearModule ( MS2_ModWingModule & mod)
static

cleans MS2_ModWingModule object (wing module definition)

Definition at line 430 of file ms2data.cpp.

431{
432 mod.Type = 0;
433 mod.Profil.Name.clear();
434 mod.Profil.NACAnumber = 4415;
435 mod.X0 = mod.Y0 = mod.Z0 = 0.0;
436 mod.XRef = 0.0;
437 mod.C = 0;
438 mod.Alfa = 0.0;
439 mod.Fi = mod.Gamma = 0.0;
440 mod.L = 0;
441 mod.R = 0;
442 mod.N = 0;
443 mod.NDist = 0;
444 mod.SpanPanConc = 0;
445}
double Y0
y coordinate of origin
int SpanPanConc
paneling distribution concentration( Left, center, right )
double Alfa
twist angle [deg]
int N
number of division
double Z0
z coordinate of origin
int Type
type of module - see MS2WingModuleType
double Gamma
dihedral angle [deg]
double NDist
division dist
double Fi
skew angle [deg]
MS2_Profile Profil
airfoil data
double X0
x coordinate of origin
double XRef
first definition curve's start point location [MAC]
double C
Mean Aerodynamic Chord (MAC)

Referenced by ReadWing().

◆ ClearNacelleWing()

void MS2_Data::ClearNacelleWing ( MS2_NacelleWing & nac)
static

cleans MS2_NacelleWing object (jet nacelle definition)

Definition at line 517 of file ms2data.cpp.

518{
519 nac.Profil.Name.clear();
520 nac.Profil.NACAnumber = 12;
521 nac.NUp = nac.NDown = 0;
522 nac.SwirlType = 0;
523 nac.SwirlRange = 0;
524 nac.X0 = nac.Y0 = nac.Z0 = 0.0;
525 nac.L = 0;
526 nac.CvFactUp = nac.CvFactDown = 0.0;
527 nac.Y = nac.ZUp = nac.ZDown = 0.0;
528 nac.fi = nac.theta = nac.psi = 0.0;
529}
int SwirlRange
full or half
double Y
Y dimension (semiaxis longwise Y)
double CvFactUp
convexity factor of top part
int SwirlType
swirl direction (external or internal)
double X0
x coordinate of origin
double Z0
z coordinate of origin
double ZUp
Z up dimension (upper semiaxis longwise Z)
double L
length (chord)
int NUp
division of top part - number of wing sections
int NDown
division of bottom part - number of wing sections
double fi
roll rotation angle [deg]
double psi
yaw rotation angles [deg]
double Y0
y coordinate of origin
MS2_Profile Profil
airfoil data
double theta
pitch rotation angle [deg]
double CvFactDown
convexity factor of bottom part
double ZDown
Z down dimension (lower semiaxis longwise Z)

Referenced by ClearWing(), and ReadWing().

◆ ClearPrf()

void MS2_Data::ClearPrf ( MS2_Profile & prf)
static

cleans MS2_Profile object (airfoil)

Definition at line 406 of file ms2data.cpp.

407{
408 prf.Name.clear();
409 prf.ShortName.clear();
410 prf.Xd.clear();
411 prf.Xg.clear();
412 prf.Zd.clear();
413 prf.Zg.clear();
414 prf.iType = AIRFOIL_FILE;
415 prf.NACAnumber = 4415;
416}
std::vector< double > Xd
X coordinate of lower contour of airfoil.
std::string ShortName
airfoil name without file path
std::vector< double > Zd
Z coordinate of lower contour of airfoil.
std::vector< double > Xg
X coordinate of upper contour of airfoil.
std::vector< double > Zg
Z coordinate of upper contour of airfoil.

Referenced by ReadProfile(), and ReadProfile().

◆ ClearSection()

void MS2_Data::ClearSection ( MS2_Section & sect)
static

cleans MS2_Section object (wing section definition)

Definition at line 370 of file ms2data.cpp.

371{
372 sect.Profil.Name.clear();
373 sect.Profil.ShortName.clear();
374 sect.X = sect.Z = 0.0;
375 sect.Y = 0.0;
376 sect.RotX = sect.RotY = sect.RotZ = 0.0;
377 sect.No = 0;
378 sect.Chord = 0;
380 sect.Profil.NACAnumber = 4415;
381 sect.CtrlFlag = 0;
382 sect.CoefPosFlag = 1;
383 sect.Deflection = 0.0;
384 sect.Hinge_X = 0.75;
385 sect.Hinge_Z = 0.0;
386}
double Deflection
control surface deflection [deg] (+ down deflection)
bool CtrlFlag
control surface flag: 1 - present, 0 - does not exist
int No
section number
double Hinge_X
hinge X position
double Z
Z coordinate of origin [m].
double Chord
chord [m]
double Hinge_Z
hinge Z position
double Y
Y coordinate of origin [m].
double X
X coordinate of origin [m].
double RotZ
rotation angle along Z axis [deg]
MS2_Profile Profil
airfoil data
double RotX
rotation angle along X axis [deg]
double RotY
rotation angle along Y axis [deg]
bool CoefPosFlag
position definition flag (see MS2ControlSurfaceDef)

Referenced by ReadWing().

◆ ClearWake()

void MS2_Data::ClearWake ( MS2_Wake & wake)
static

cleans MS2_Wake object (wake information)

Definition at line 493 of file ms2data.cpp.

494{
495 wake.Name .clear();
496 wake.Type = 0;
497 wake.Active = 0;
498 wake.Wing1No = 0;
499 wake.Wing2No = 0;
500 wake.Wing1Rib = 0;
501 wake.Wing2Rib = 0;
502 wake.Wing2Surf = 0;
503}
int Wing2No
number of 2'nd wing
std::string Name
name of particular wake information
int Wing1Rib
number of wing's 1 rib connected to wing 2 by wake line
int Wing2Rib
number of wing's 2 rib which modifies wake line
int Wing1No
number of 1'st wing (INDEPENDENT)
int Wing2Surf
wing 2 surface for wake modification (0-bottom, 1-top in case of vertical wake or 0-exterior,...
int Active
1 - active, 0 - not active
int Type
type of wake plane WAKE_H (horizontal) or WAKE_V (vertical)

Referenced by Read().

◆ ClearWing()

void MS2_Data::ClearWing ( MS2_Wing & wing)
static

cleans MS2_Wing object (wing definition)

Definition at line 310 of file ms2data.cpp.

311{
312 wing.ID = 0;
313 wing.Active = 0;
314 wing.Type = 0;
315 wing.DivSource = 0;
316 wing.ComputeInt = 0;
317 wing.LongeronNo = 0;
318 wing.RibType = 0;
319 wing.Name.clear();
320 wing.SurfType = 0;
321 wing.DivNo = 10;
322 wing.DivType = 0;
323 wing.TwistRef = 0;
324 wing.UserDiv.clear();
325 wing.SmartBypass = 0;
326 wing.BypassDepth = 0;
327 //From sections
328 wing.Sec.Sections.clear();
329 wing.Sec.DivType = SDT_LINEAR;
330 //From modules
331 wing.Mod.Modules.clear();
332 wing.UseMunk = 0;
333 wing.SRef = 1.0;
334 wing.CzDes = 1;
335 //nacelle
336 ClearNacelleWing( wing.Nac );
337}
static void ClearNacelleWing(MS2_NacelleWing &nac)
cleans MS2_NacelleWing object (jet nacelle definition)
Definition ms2data.cpp:517
@ SDT_LINEAR
linear (constant spanwise length)
std::vector< MS2_ModWingModule > Modules
vector (list) of modules used to define wing
std::vector< MS2_Section > Sections
wing sections set
int DivType
type of spanwise division - see MS2SpanDivType
MS2_SecWing Sec
Section wing definition.
double TwistRef
twist reference point (0...1)
int Type
type of the wing ( see MS2WingType )
int RibType
see MS2WingRibType
int DivSource
1 - master, 0 - slave, -1 - independent (
std::vector< double > UserDiv
user defined chord division
int SurfType
wing surface to create ( see MS2WingSurf )
int ComputeInt
1 - compute fuselage-wing intersection, 0 - wing is glued to the fuselage
int Active
1 - active, 0 - not active
MS2_ModWing Mod
Module wing definition.
int DivNo
number of chord division points
int UseMunk
(0,1) Use Munk minimum induced drag theorem
int LongeronNo
fuselage longeron No which will be connected with wing's leading edge
double SRef
reference area for min induced drag calculation
MS2_NacelleWing Nac
Nacelle definition.
int DivType
chord division type
int BypassDepth
max. depth of bypassing - number of longerons to be deflected
int SmartBypass
smart deflection of longerons to bypass the wing (0 - no, 1 - yes, modifies the section points)
int ID
unique object ID
std::string Name
name of wing
double CzDes
design lift force coefficient

Referenced by Read(), and SetWingDefs().

◆ Comment()

void MS2_Data::Comment ( void )
virtual

displays comment (warning or information)

Definition at line 674 of file ms2data.cpp.

675{
676 fprintf( stderr, "%s\n", cComment );
677}
char cComment[256]
message text in case of error
Definition ms2data.h:41

Referenced by Read(), ReadChordDivision(), ReadFusAirfoil(), ReadFusFromParams(), ReadProfile(), ReadWing(), ReadWingModule(), and Write().

◆ CONNECT2MS2_Conn()

void MS2_Data::CONNECT2MS2_Conn ( CONNECT_DATA & Con,
MS2_Conn & newConn )
static

converts CONNECT_DATA to MS2_Conn

Definition at line 2258 of file ms2data.cpp.

2259{
2260 newConn.Type = Con.iTyp;
2261 newConn.Active = Con.iActive;
2262 newConn.Wing1No = Con.CP1;
2263 newConn.Wing2No = Con.CP2;
2264 newConn.Wing1Rib = Con.Czeb1;
2265 newConn.Wing2Rib = Con.Czeb2;
2266 newConn.Wing2LongLE = Con.Cstart;
2267 newConn.Wing2LongTE = Con.Cend;
2268 newConn.Wing2Surf = Con.Csurf;
2269 newConn.Name = Con.ConName;//ConnectionDesc( newConn );
2270 //fprintf( stderr,"Conn desc: %s\n",newConn.Name.c_str() );
2271}
int Czeb1
number of wing 1 rib connected to wing 2
Definition conect_data.h:47
int Cend
number of wing 2 longeron connected to trailing point of wing 1
Definition conect_data.h:50
int Czeb2
number of wing 2 rib connected to wing 1
Definition conect_data.h:48
int CP2
number of the 2nd wing (horizontal in case of vertical connection)
Definition conect_data.h:46
int iActive
is connection section active ( 1- active, 2 - not active)
Definition conect_data.h:44
int iTyp
Type of connection ( horizontal, vertical, parallel )
Definition conect_data.h:43
std::string ConName
Name of connection.
Definition conect_data.h:54
int Csurf
surface of wing 2 which will be modified (0-bottom or exterior, 1-top or interior)
Definition conect_data.h:51
int CP1
number of the 1st wing (vertical in case of horizontal connection)
Definition conect_data.h:45
int Cstart
number of wing 2 longeron connected to leading point of wing 1
Definition conect_data.h:49

Referenced by Read().

◆ ConnTypeName()

string MS2_Data::ConnTypeName ( int n)
static

returns connection type name

Definition at line 595 of file ms2data.cpp.

596{
597 string retStr = "";
598 switch( n )
599 {
600 case CON_H :
601 retStr = "Vertical (#1) to horizontal (#2)";
602 break;
603 case CON_V :
604 retStr = "Horizontal (#1) to vertical (#2)";
605 break;
606 case CON_P :
607 retStr = "Parallel connection";
608 break;
609 default :
610 retStr = "Unknown";
611 break;
612 }
613 return retStr;
614}
@ CON_H
horizontal (e.g. T tail)
@ CON_V
vertical (e.g. winglets)
@ CON_P
parallel

◆ DivTypeName()

string MS2_Data::DivTypeName ( int div)

returns chordwise division type (name) - see MS2DivType

Definition at line 569 of file ms2data.cpp.

570{
571 string retStr = "";
572 switch( div )
573 {
574 case DT_LINEAR :
575 //retStr = "linear";
576 //break;
577 case DT_COSINE :
578 // retStr = "cosine";
579 // break;
580 case DT_PROFILE :
581 // retStr = "profile";
582 // break;
583 case DT_AUTO :
584 // retStr = "unknown";
585 // break;
586 retStr = string( WingSectionDivStr[div]);
587 break;
588 default :
589 retStr = "";
590 break;
591 }
592 return retStr;
593}
static std::map< int, const char * > WingSectionDivStr
linear, cosine etc.
Definition ms2data.h:57
@ DT_PROFILE
based on airfoil data
@ DT_AUTO
"unknown" in MS2Edit, in SLAVE wing case (see MS2WingDivSource)
@ DT_LINEAR
linear (constant chordwise length)
@ DT_COSINE
constant chordwise angle projection

◆ find_section()

int MS2_Data::find_section ( FILE * ff,
const char * sec )
static

to find the section in ms2 file - imported from "mesh2.h"

Definition at line 2287 of file ms2data.cpp.

2288{
2289//Metoda find section przeniesiona z "mesh2h/cpp" Author: T.Grabowski
2290 char ss[200];
2291 int N;
2292 do
2293 {
2294 fscanf( t, "%s", ss );
2295 if( ReadComm(t) == EOF )
2296 {
2297 rewind(t);
2298 fprintf(stderr,"brak sekcji: %s\n", sec);
2299 return 0;
2300 }
2301 }
2302 while( strcmp(ss,sec) );
2303
2304 ReadPar( t, "%d", &N );
2305 return N;
2306}
static int ReadComm(FILE *stream)
Function to read of a comment till the end of line. It returns 0 or EOF if it is performed.
Definition iofun.cpp:42
static int ReadPar(FILE *stream, const char *Format, void *Par)
Function to read one variable. The type of variable depends on Format, compatible with stdio library.
Definition iofun.cpp:67

Referenced by Read().

◆ GetDpWingNo()

int MS2_Data::GetDpWingNo ( void )
protected

returns number of depedentend wings (SLAVE)

Definition at line 2923 of file ms2data.cpp.

2924{
2925 int iRet = 0;
2926 for( int i=0;i < (int)Wings.size();i++ )
2927 {
2928 if( Wings[i].DivSource == WING_DIV_SLAVE ) iRet++;
2929 }
2930 return iRet;
2931}
@ WING_DIV_SLAVE
fuselage enforces wing's chord division

Referenced by WriteGeneral().

◆ GetIndpWingNo()

int MS2_Data::GetIndpWingNo ( void )
protected

returns number of indepedentend wings (MASTER & INDEPENDENT)

Definition at line 2913 of file ms2data.cpp.

2914{
2915 int iRet = 0;
2916 for( int i=0;i < (int)Wings.size();i++ )
2917 {
2918 if( Wings[i].DivSource == WING_DIV_MASTER ) iRet++;
2919 if( Wings[i].DivSource == WING_DIV_INDEPENDENT ) iRet++;
2920 }
2921 return iRet;
2922}
@ WING_DIV_MASTER
wing enforces fuselage's chord division
@ WING_DIV_INDEPENDENT
wing has its own division and doesn't enforce division to fuselage

Referenced by WriteGeneral().

◆ GetNACANoAsString()

string MS2_Data::GetNACANoAsString ( int no)
static

converts NACA profile number to string

Definition at line 664 of file ms2data.cpp.

665{
666 char tmp[11];
667 if( no > 9999 )
668 sprintf(tmp,"%05u",no);
669 else
670 sprintf(tmp,"%04u",no);
671 return string( tmp );
672}

Referenced by ReadProfile(), and WriteProfile().

◆ GetNConns()

int MS2_Data::GetNConns ( void )
inline

returns number of connections

Definition at line 104 of file ms2data.h.

◆ GetNProfs()

int MS2_Data::GetNProfs ( void )
inline

returns number of embeded airfoils

Definition at line 106 of file ms2data.h.

◆ GetNWakes()

int MS2_Data::GetNWakes ( void )
inline

returns number of wake infos

Definition at line 105 of file ms2data.h.

◆ GetNWings()

int MS2_Data::GetNWings ( void )
inline

returns number of wings

Definition at line 103 of file ms2data.h.

◆ GetVersion()

int MS2_Data::GetVersion ( void )
inline

returns ms2 file version

Definition at line 102 of file ms2data.h.

◆ has_section()

bool MS2_Data::has_section ( FILE * t,
const char * sec )
static

check if section exist

Definition at line 2308 of file ms2data.cpp.

2309{
2310 char ss[200];
2311 do
2312 {
2313 fscanf( t, "%s", ss );
2314 if( ReadComm(t) == EOF )
2315 {
2316 rewind(t);
2317 fprintf(stderr,"missing section: %s\n", sec); fflush( stderr );
2318 return false;
2319 }
2320 }
2321 while( strcmp(ss,sec) );
2322 return true;
2323}

Referenced by Read().

◆ MS2_Conn2CONNECT()

void MS2_Data::MS2_Conn2CONNECT ( MS2_Conn & Conn,
CONNECT_DATA & newCon )
static

converts MS2_Conn to CONNECT_DATA

Definition at line 2273 of file ms2data.cpp.

2274{
2275 newCon.iTyp = Conn.Type;
2276 newCon.iActive = Conn.Active;
2277 newCon.ConName = Conn.Name;
2278 newCon.CP1 = Conn.Wing1No;
2279 newCon.CP2 = Conn.Wing2No;
2280 newCon.Czeb1 = Conn.Wing1Rib;
2281 newCon.Czeb2 = Conn.Wing2Rib;
2282 newCon.Cstart = Conn.Wing2LongLE;
2283 newCon.Cend = Conn.Wing2LongTE;
2284 newCon.Csurf = Conn.Wing2Surf;
2285}

Referenced by WriteConns().

◆ Read()

bool MS2_Data::Read ( const char * file,
bool bRestrictive,
bool auto_mod )

reads ms2 file

Definition at line 681 of file ms2data.cpp.

682{
683 // Zmodyfikowana wersja metody czytajacej dane z pliku *.ms2
684 // Oryginaln : metoda "int MESH::czytaj_ms2 ( char* nazwainf )" (plik: mesh2.cpp) Author: P.Blaszczyk (modif. T.Grabowski)
685 FILE *t;
686 t=fopen(file,"rt");
687 int i,np;
688 char ss[200],sss[20],ssss[11];
689 int Pil, PVil, PPil;
690
691 if( t == NULL )
692 {
693 sprintf( cComment, "Can't find file %s.", file );
694 Comment();
695 return false;
696 }
697
698 //read version
699 rewind(t);
700 int iVer = 0;
701 iVer = find_section( t, "begin_version" );
702
703 if( iVer == 0 ) //section not found
704 iVersion = 2;
705 else
706 {
707 if( iVer!=2 && iVer != 3 && iVer != 31 && iVer != 32 && iVer != 40 && iVer != 50 && iVer != 51 && iVer != 52 && iVer != 53 && iVer != 54 && iVer != 55)
708 {
709 sprintf( cComment, "Version - wrong ms2 data file version (%d)", iVer );
710 Comment();
711 return false;
712 }
713 iVersion = iVer;
714 }
715
716 rewind(t);
717
718 bool has_main = has_section( t, "begin" );
719 if( !has_main )
720 {
721 sprintf( cComment, "Error: No global section in configuration file.");
722 Comment();
723 return false;
724 }
725
726 fscanf( t, "%s", ss );
727 ReadComm( t );
729 if (strcmp(ss,"*****")!=0)
730 {
731 General.RefVal.S = atof(ss); //SSS=atof(ss);
732 ReadPar (t, "%lf", &General.RefVal.MAC); //readln (t,&SCA);
733 ReadPar (t, "%lf", &General.RefVal.B); //readln (t,&B);
734 ReadPar (t, "%lf", &General.RefVal.MX); //readln (t,&X025);
735 ReadPar (t, "%lf", &General.RefVal.MZ); //readln (t,&Z025);
736 ReadPar (t, "%lf", &General.RefVal.Scale); //readln (t,&SKALA);
737 ReadComm (t);
738 General.RefVal.AutoComp = false;
739 }
740 else
741 {
742 if( iVersion > 52 )
743 {
744 ReadPar (t, "%lf", &General.RefVal.Scale); //readln (t,&SKALA);
745 ReadComm (t);
746 }
747 General.RefVal.AutoComp = true;
748 }
749
750 char nazwaout[200];
751 //readln (t,nazwaout);
752 ReadStr( t, nazwaout );
753 General.InpFileName = string( nazwaout );
754 if( iVersion >= 54 )
755 ReadPar( t, "%d", &General.AutoInpFileName );
756 else
758
759 //liczba platow ze zdefiniowanym podzialem , liczba platow bez zdef. podzialu
760 ReadPar (t, "%d", &Pil);
761 ReadPar (t, "%d", &PVil);
762 PPil = Pil+PVil;
763 //Flaga symmetrii i typ pliku wyjsciowego
764 General.SymmOpt = 0;
765 General.OutOpt = 0;
766 if( iVersion >= 52)
767 {
768 ReadPar( t, "%d", &General.SymmOpt );
769 ReadPar( t, "%d", &General.OutOpt );
770 }
771 else
772 {
773 fscanf( t, "%s", ss );
774 ReadComm( t );
775 if (strcmp(ss,"end")!=0) General.SymmOpt = atoi(ss); //iSym=atoi(ss);
776 }
777
778 //airfoils data
779 Profiles.clear();
780 if( iVersion >= 50 )
781 {
782 rewind(t);
783
784 int NN = 0;
785 while( true )
786 {
787 sprintf( ssss, "%d", NN );
788 string cname = string( "begin_airfoil" ) + string( ssss );
789 //cout << cname << endl; fflush( stdout );
790 if( has_section( t, cname.c_str() ) == false )break;
791 MS2_Profile PP;
792 if( ReadProfile( t, PP ) == false )
793 {
794 if( bRestrictive ) return false;
795 break;
796 }
797 Profiles.push_back( PP );
798 NN++;
799 }
800 }
801
802 //WINGS
803 Wings.clear();
804 for (np=0;np<PPil;np++)
805 {
806 //itoa(np,ssss,10);
807 sprintf(ssss,"%d",np);
808 strcpy(sss,"begin_wing");
809 strcat(sss,ssss);
810 do
811 {
812 //readln (t,ss);
813 fscanf( t, "%s", ss );
814 ReadComm( t );
815 }
816 while (strcmp(ss,sss));
817 MS2_Wing newWing;
818 ClearWing( newWing );
819 if( !ReadWing( t, newWing, np, bRestrictive, auto_mod ) ) return false;
820 Wings.push_back( newWing );
821 }
822
823 //FUSELAGE
824 rewind(t);
827 Fuselage.Exists = (bool)find_section( t, "begin_fuselage" );
828 if ( Fuselage.Exists )
829 {
830 if( iVersion == 2 )
831 {
832 Fuselage.Type = FT_FILE; //default fuselage type for version
833 Fuselage.Active = 1;
834 }
835 else
836 {
837 char tmpStr[20];
838 int iRead = ReadPar( t, "%d", &Fuselage.Active );
839 if( Fuselage.Active != 0 )Fuselage.Active = 1;
840 iRead = ReadStr( t, tmpStr );
841 // ReadDummy(t);
842 if(/*iRead == 0 || */ iRead == EOF )
843 {
844 sprintf( cComment, "Fuselage - wrong fuselage type (type=%s)", tmpStr );
845 Comment();
846 return false;
847 }
848 if( CompareStrings( tmpStr, (char*)FusTypeStr[(int)FT_FILE] ) )
849 {
851 }
852 else if( CompareStrings( tmpStr, (char*)FusTypeStr[(int)FT_PARAMS] ) )
853 {
855 }
856 else
857 {
858 sprintf( cComment, "Fuselage - wrong fuselage type (type=%s)", tmpStr );
859 Comment();
860 return false;
861 }
862 }
863
864 if( Fuselage.Type == FT_FILE )
865 {
866 char Knazwa[200];
867 ReadStr( t, Knazwa );
868 Fuselage.File.Name = string( Knazwa );
870 if( Fuselage.File.Name.empty() )
871 {
872 sprintf( cComment, "Fuselage - empty fuselage name" );
873 Comment();
874 return false;
875 }
876 ReadDummy( t );
877 }
878 else if( Fuselage.Type == FT_PARAMS )
879 {
880 if( ReadFusFromParams( t , bRestrictive ) == false )return false;
881 }
882 else
883 {
884 sprintf( cComment, "Fuselage - wrong fuselage type (type=%d)", Fuselage.Type );
885 Comment();
886 return false;
887 }
888 int Kidod = 0;
889 ReadPar (t,"%d",&Kidod);
890 double wspKdod = 0;
891 Fuselage.UserDiv.clear();
892 for (i=0;i<Kidod;i++)
893 {
894 fscanf (t,"%lf",&wspKdod);
895 Fuselage.UserDiv.push_back( wspKdod );
896 }
897 //ReadComm( t );
898
899 if( iVersion >= 51 )
901 else
902 {
904 Fuselage.iSecN = 10;
905 }
906 ReadDummy( t );
907 }
908
909 //CONNECTIONS
910 Conns.clear();
911 rewind(t);
912 int ICon = find_section( t, "begin_connections" );
913 if( ICon > 0 )
914 {
915 for( int i=0; i<ICon; i++ )
916 {
917 MS2_Conn newConn;
918 ClearConnection( newConn );
919 CONNECT_DATA Con;
920 Con.Read(t, (int)CON_H, iVersion);
921 CONNECT2MS2_Conn( Con, newConn );
922 //if( MS2_Data::CheckConnData( newConn, Wings, HasGUI() ) == false )
923 //{
924 // if( bRestrictive ) return false;
925 //}
926 Conns.push_back( newConn );
927 }
928 }
929 if( iVersion == 2 )
930 {
931 // V - CONNECTIONS
932 rewind(t);
933 int IConV = find_section( t, "begin_connections_V" );
934 if( IConV > 0 )
935 {
936 for( int i=0; i<IConV; i++ )
937 {
938 MS2_Conn newConn;
939 ClearConnection( newConn );
940 CONNECT_DATA ConV;
941 ConV.Read(t, (int)CON_V, iVersion);
942 CONNECT2MS2_Conn( ConV, newConn );
943 //if( CheckConnData( newConn, Wings, HasGUI() ) == false )
944 //{
945 // if( bRestrictive ) return false;
946 //}
947 Conns.push_back( newConn );
948 }
949 }
950 }
951 //WAKE info
952 Wakes.clear();
953 rewind(t);
954 int IWake = find_section( t, "begin_wake_info" );
955 if( IWake > 0 )
956 {
957 char name[200];
958 for( int i=0; i<IWake; i++ )
959 {
960 MS2_Wake newWake;
961 ClearWake( newWake );
962
963 ReadStr( t, name );
964 int iTyp = WAKE_H;
965 if( CompareStrings( name, (char*)(WakeTypeName((int)WAKE_H)).c_str() ) == true )
966 iTyp = WAKE_H;
967 else if( CompareStrings( name, (char*)(WakeTypeName((int)WAKE_V)).c_str() ) == true )
968 iTyp = WAKE_V;
969 newWake.Type = iTyp;
970 ReadStr( t, name );
971 newWake.Name = string( name );
972 fscanf ( t, "%d", &newWake.Active );
973 fscanf ( t, "%d", &newWake.Wing1No );
974 fscanf ( t, "%d", &newWake.Wing2No );
975 fscanf ( t, "%d", &newWake.Wing1Rib );
976 fscanf ( t, "%d", &newWake.Wing2Rib );
977 fscanf ( t, "%d", &newWake.Wing2Surf );
978 //if( MS2_Data::CheckWakeData( newWake, Wings, HasGUI() ) == false )
979 //{
980 // if( bRestrictive ) return false;
981 //}
982 Wakes.push_back( newWake );
983 }
984 }
985
987 fclose (t);
988
989 return true;
990}
Structure, which defines connection of two wings.
Definition conect_data.h:34
int Read(FILE *f, int typ, int version=2)
Read connection section (within MS2 file reading)
static FILE * fopen(const char *filename, const char *mode)
Cross-platform function to fopen function that supports UTF-8 encoded name.
Definition iofun.cpp:358
static void ReadDummy(FILE *stream)
Function to read a comment line.
Definition iofun.cpp:50
static int ReadStr(FILE *stream, char *Par)
Function to read the new line from FILE "stream" and to store it in table of char "Par"....
Definition iofun.cpp:163
static bool CompareStrings(char *str1, char *str2)
Compares two strings (str1 and str2). Returns true if they match, false otherwise.
Definition iofun.cpp:270
static void ClearWing(MS2_Wing &wing)
cleans MS2_Wing object (wing definition)
Definition ms2data.cpp:310
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
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 SetFuselageDefs(MS2_Fuselage &fus)
sets MS2_Fuselage object (fuselage definition)
Definition ms2data.cpp:254
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
static void CONNECT2MS2_Conn(CONNECT_DATA &Con, MS2_Conn &newConn)
converts CONNECT_DATA to MS2_Conn
Definition ms2data.cpp:2258
static std::string TruncateQuotMarks(std::string str)
truncates the quote marks from string
Definition ms2data.cpp:634
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
bool ReadProfile(FILE *t, MS2_Profile &airfoil, const char *desc, bool bRestrictive)
reads Profile data structure (see MS2_Profile)
Definition ms2data.cpp:2107
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
@ FDT_DATA
coordinates defined by user (FT_FILE) or by parameters (FT_PARAMS)
@ WAKE_H
horizontal (e.g. wing, horzontal tail)
@ WAKE_V
vertical (e.g. vertical stabilizer)
@ FT_FILE
from *.f file
@ FT_PARAMS
built from parameters
connection
std::vector< MS2_Profile > Profiles
embedded profiles
int iSecN
number of points that define the section
int iDivSectionType
type of section division - see MS2FusSecDivType
int AutoInpFileName
(0,1) automatic output file name [.inp] based on ms2 file name
Profile definition.
wing definition

◆ ReadChordDivision()

bool MS2_Data::ReadChordDivision ( FILE * t,
MS2_Wing & wing,
bool bRestrictive )

reads user define chord division (see DT_USER)

Definition at line 1824 of file ms2data.cpp.

1825{
1826 char tmpStr[255];
1827 int iRead = fscanf( t, "%s", tmpStr );
1828 if( /*iRead == 0 ||*/ iRead == EOF )
1829 {
1830 sprintf( cComment, "Wing \"%s\" - wrong wing section division", wing.Name.c_str() );
1831 Comment();
1832 return false;
1833 }
1834
1835 //if (strcmp(ss,"unknown")==0)
1836 if( CompareStrings( tmpStr , (char*)WingSectionDivStr[(int)DT_AUTO]))
1837 {
1838 wing.DivType = DT_AUTO;
1839 if( iVersion == 2 )
1840 {
1842 }
1843
1844 if( wing.DivSource != WING_DIV_SLAVE )
1845 {
1846 sprintf( cComment, "Wing \"%s\" - The \"%s\" chord division type is not valid for \"%s\" wings", wing.Name.c_str(), tmpStr, WingDivSourceStr[wing.DivSource]);
1847 Comment();
1848 if( bRestrictive )
1849 return false;
1850 else
1852 }
1853 }
1854 //else if (strcmp(ss,"profile")==0)
1855 else if( CompareStrings( tmpStr , (char*)WingSectionDivStr[(int)DT_PROFILE]))
1856 {
1857 wing.DivType = DT_PROFILE;
1858 }
1859 //else if (strcmp(ss,"cosine")==0)
1860 else if( CompareStrings( tmpStr , (char*)WingSectionDivStr[(int)DT_COSINE]))
1861 {
1862 ReadPar (t, "%d", &wing.DivNo );
1863 wing.DivType = DT_COSINE;
1864 }
1865 //else if (strcmp(ss,"linear")==0)
1866 else if( CompareStrings( tmpStr , (char*)WingSectionDivStr[(int)DT_LINEAR]))
1867 {
1868 ReadPar (t, "%d", &wing.DivNo );
1869 wing.DivType = DT_LINEAR;
1870 }
1871 else
1872 { //user defined
1873 int i = 0;
1874 while( tmpStr[i] != '\0' )
1875 {
1876 if( isdigit( tmpStr[0]) == 0 )
1877 {
1878 sprintf( cComment, "Wing \"%s\" - Wrong chord division \"%s\"", wing.Name.c_str(), tmpStr );
1879 Comment();
1880 if( bRestrictive ) return false;
1881 }
1882 i++;
1883 }
1884
1885 wing.DivType = DT_USER;
1886 vector<double> tmp;
1887 tmp.push_back( (double)atof(tmpStr) );
1888
1889 double tmpDiv = 0;
1890 int iRead = 0;
1891 do
1892 {
1893 iRead = fscanf( t, "%s", tmpStr );
1894 // fprintf( stderr, "tmpStr %s %d\n", tmpStr, i );
1895 while( tmpStr[i] != '\0' )
1896 {
1897 if( isdigit( tmpStr[0]) == 0 )
1898 {
1899 sprintf( cComment, "Wing \"%s\" - Wrong chord division \"%s\"", wing.Name.c_str(), tmpStr );
1900 Comment();
1901 return false;
1902 }
1903 i++;
1904 }
1905 // iRead = fscanf(t, "%lf", &tmpDiv );
1906 if( /*iRead == 0 || */ iRead == EOF )
1907 {
1908 sprintf( cComment, "Wing \"%s\" - Wrong chord division.", wing.Name.c_str() );
1909 Comment();
1910 return false;
1911 }
1912 tmpDiv = (double)atof(tmpStr) ;
1913 //fprintf( stderr, "tmpDiv = %f\n", tmpDiv );
1914 if( tmp[tmp.size()-1 ] > tmpDiv )
1915 {
1916 // fprintf( stderr, "tmpStr %s\n", tmpStr );
1917 sprintf( cComment, "Wing \"%s\" - Chord division is not in ascending order.", wing.Name.c_str() );
1918 Comment();
1919 if( bRestrictive )
1920 return false;
1921 }
1922
1923 if( tmp[tmp.size()-1 ] == tmpDiv )
1924 {
1925 sprintf( cComment, "Wing \"%s\" - Repeated chord division (%4.2f) will be ignored.", wing.Name.c_str(), tmpDiv );
1926 Comment();
1927 ReadDummy( t );
1928 continue;
1929 }
1930
1931 tmp.push_back( tmpDiv );
1932 ReadDummy( t );
1933 }
1934 while (fabs(tmpDiv-100.0)>1e-19 );
1935/*
1936 if( (int)tmp.size() > Mmax )
1937 {
1938 fprintf( stderr, "Wing \"%s\" - too many wing longerons (max=%d)", wing.Name.c_str(), Mmax );
1939 if( HasGUI() )fl_alert( "Wing \"%s\" - too many wing longerons (max=%d)", wing.Name.c_str(), Mmax );
1940 if( bRestrictive )
1941 return false;
1942 }
1943*/
1944 if( tmp[0] != 0 || tmp[tmp.size()-1] != 100 )
1945 {
1946 sprintf( cComment, "Wing \"%s\" - wrong user defined chord division.\nChord division should start with 0 and end at 100.", wing.Name.c_str() );
1947 Comment();
1948 if( bRestrictive )
1949 return false;
1950 }
1951 wing.UserDiv = tmp;
1952 }
1953 return true;
1954}
static std::map< int, const char * > WingDivSourceStr
master, slave
Definition ms2data.h:54
@ DT_USER
user defined

Referenced by ReadWing().

◆ ReadFusAirfoil()

bool MS2_Data::ReadFusAirfoil ( FILE * t,
MS2_FusAirfoil & airfoil,
const char * desc,
bool bRestrictive )

reads airfoil data used to define fuselage shape

Definition at line 1347 of file ms2data.cpp.

1348{
1349 char name[256];
1350 char tempStr[20];
1351
1352 int iRead = fscanf( t, "%s", tempStr ); //side
1353 if( iRead == 0 || iRead == EOF )
1354 {
1355 fprintf( stderr, "Empty/wrong airfoil side in %s.\n", desc );
1356 return false;
1357 }
1358
1359 if( CompareStrings(tempStr, (char*)FusAirfoilSide[(int)AS_UP]) )
1360 {
1361 airfoil.Side = AS_UP;
1362 }
1363 else if( CompareStrings(tempStr, (char*)FusAirfoilSide[(int)AS_DOWN]) )
1364 {
1365 airfoil.Side = AS_DOWN;
1366 }
1367 else
1368 {
1369 fprintf( stderr, "Empty/wrong airfoil side in %s.\n", desc );
1370 if( bRestrictive)
1371 return false;
1372 else
1373 airfoil.Side = AS_UP;
1374 }
1375
1376 if( iVersion >= 50 )
1377 {
1378 ReadProfile( t, airfoil, desc, false );
1379 }
1380 else
1381 {
1382
1383 iRead = fscanf( t, "%s", tempStr );//source
1384
1385 if( iRead == 0 || iRead == EOF )
1386 {
1387 fprintf( stderr, "Empty/wrong airfoil source in %s.\n", desc );
1388 return false;
1389 }
1390
1391 if( CompareStrings(tempStr, (char*)AirfoilTypeStr[(int)AIRFOIL_FILE]) )
1392 {
1393 airfoil.iType = AIRFOIL_FILE;
1394 }
1395 else if( CompareStrings(tempStr, (char*)AirfoilTypeStr[(int)AIRFOIL_NACA]) )
1396 {
1397 airfoil.iType = AIRFOIL_NACA;
1398 }
1399 else
1400 {
1401 fprintf( stderr, "Empty/wrong airfoil source in %s.\n", desc );
1402 return false;
1403 }
1404
1405 if( airfoil.iType == AIRFOIL_FILE )
1406 {
1407 iRead = ReadStr( t, name ); //UWAGA
1408
1409 if( strlen(name)==0 || iRead == EOF /*||iRead == 0 */)
1410 {
1411 sprintf( cComment, "Empty/wrong airfoil name in %s", desc );
1412 Comment();
1413 if( bRestrictive)
1414 return false;
1415 else
1416 airfoil.Name = "NACA4415.prf";
1417 }
1418 else
1419 {
1420 airfoil.Name = string( name );
1421 airfoil.Name = MS2_Data::TruncateQuotMarks( airfoil.Name );
1422 airfoil.ShortName = string( filename_name( airfoil.Name.c_str() ) );
1423 }
1424
1425 }
1426 else if( airfoil.iType == AIRFOIL_NACA )
1427 {
1428 char nacastr[20];
1429 iRead = ReadStr( t, nacastr );
1430 //check if NACA airfoil i 4 or 5 digit
1431 if( (strlen(nacastr) == 4 || strlen(nacastr) == 5 ) && iRead != EOF /*&& iRead != 0 */ ) //UWAGA
1432 {
1433 airfoil.NACAnumber = atoi( nacastr );
1434 }
1435 else
1436 {
1437 sprintf( cComment, "Empty/wrong NACA airfoil number in %s. NACA number %s was read.", desc, nacastr );
1438 Comment();
1439 if( bRestrictive )
1440 return false;
1441 else
1442 airfoil.NACAnumber = 4415;
1443 }
1444 }
1445
1446 }
1447
1448 //ReadDummy( t );
1449 return true;
1450}
static const char * filename_name(const char *name)
Returns pointer to filename without path.
Definition iofun.cpp:284
static std::map< int, const char * > AirfoilTypeStr
file, NACA, table
Definition ms2data.h:44
static std::map< int, const char * > FusAirfoilSide
up , down
Definition ms2data.h:49
@ AIRFOIL_NACA
airfoil geometry computed for 4- and 5-digit NACA profiles
@ AS_UP
upper part
@ AS_DOWN
lower part

Referenced by ReadFusFromParams().

◆ ReadFusEllipse()

bool MS2_Data::ReadFusEllipse ( FILE * t,
MS2_SuperEllipse & SupEll,
const char * desc )

reads fuselage elipse data

Definition at line 1322 of file ms2data.cpp.

1323{
1324 double vect[4]={0};
1325 ReadVect(t,vect,4);
1326 if( SupEll.EllType == ELLIPSE_SPINE )
1327 {
1328 SupEll.NF = (int)vect[0];
1329 SupEll.NR = (int)vect[1];
1330 }
1331 else if( SupEll.EllType == ELLIPSE_NORMAL )
1332 {
1333 SupEll.L = vect[0];
1334 SupEll.H = vect[1];
1335 }
1336
1337 else
1338 {
1339 fprintf( stderr, "Wrong super ellipse type (%d) in %s\n", SupEll.EllType, desc );
1340 return false;
1341 }
1342 SupEll.CvFactF = vect[2];
1343 SupEll.CvFactR = vect[3];
1344 return true;
1345}
static int ReadVect(FILE *stream, double *Par, int n, double dScal=1.)
Function to read double vector "Par" of "n" dimension from FILE "stream". The read values are scaled ...
Definition iofun.cpp:99

Referenced by ReadFusFromParams().

◆ ReadFusFromParams()

bool MS2_Data::ReadFusFromParams ( FILE * t,
bool bRestrictive )

reads Fuselage data in case fuselage defined using modules

Definition at line 994 of file ms2data.cpp.

995{
996 //global
997 char name[200];
998 ReadStr( t, name );
999 Fuselage.Params.Name = string( name );
1001 int iN[2]={0};
1002 ReadVect( t,iN,2,1);
1003 Fuselage.Params.Nup = iN[0];
1004 Fuselage.Params.Ndown = iN[1];
1005
1006 double dVect[5] = {0};
1007 ReadVect(t,dVect,3,1);
1008 Fuselage.Params.X0 = dVect[0];
1009 Fuselage.Params.Y0 = dVect[1];
1010 Fuselage.Params.Z0 = dVect[2];
1011 memset( dVect, 0, sizeof(double)*5 );
1012
1013 ReadVect(t,dVect,5,1);
1014 Fuselage.Params.Scale = dVect[0];
1015 Fuselage.Params.ScaleX = dVect[1];
1016 Fuselage.Params.ScaleY = dVect[2];
1017 Fuselage.Params.ScaleZup = dVect[3];
1018 Fuselage.Params.ScaleZdown = dVect[4];
1019 memset( dVect, 0, sizeof(double)*5 );
1020
1021 ReadVect(t,dVect,3,1);
1022 Fuselage.Params.Length = dVect[0];
1023 Fuselage.Params.BendLength = dVect[1];
1024 Fuselage.Params.BendAngle = dVect[2];
1025
1026 bool bReadStat = true;
1027/*--------------------------------------------------------------------*/
1028 //spine
1029 char tempStr[40];
1030 int iRead = fscanf( t, "%s", tempStr );//fuselage curve name string
1031 if( iRead == 0 || iRead == EOF ) bReadStat = false; //UWAGA
1032
1033 if( CompareStrings(tempStr,(char*)FusCvrStr[(int)CRV_SPINE]) == false || bReadStat == false )
1034 {
1035 sprintf( cComment, "Fuselage spine definition error. Spine definition was not found or was defined incorrectly. (%s)",tempStr);
1036 Comment();
1037 return false;
1038 }
1039
1040 iRead = fscanf( t, "%s", tempStr );
1042 if( CompareStrings(tempStr, (char*)FusCvrTypeStr[(int)ELLIPSE]))
1043 {
1044 Fuselage.Params.SpineCvr.Type = ELLIPSE;
1045 }
1046 else if( CompareStrings(tempStr, (char*)FusCvrTypeStr[(int)AIRFOIL]))
1047 {
1049 }
1050
1051 bReadStat = true;
1052 if( iRead == 0 || iRead == EOF ) bReadStat = false;
1053 if( Fuselage.Params.SpineCvr.Type == ELLIPSE )
1054 {
1055 bReadStat *= ReadFusEllipse( t, Fuselage.Params.SpineCvr.Ellipse, "Spine" );
1056 }
1057 else if( Fuselage.Params.SpineCvr.Type == AIRFOIL )
1058 {
1059 bReadStat *= ReadFusAirfoil( t, Fuselage.Params.SpineCvr.Airfoil, "Spine", bRestrictive );
1060 }
1061 else
1062 {
1063 sprintf( cComment, "Fuselage spine definition error. Wrong spine type (%s)", tempStr );
1064 Comment();
1065 return false;
1066 }
1067 if( bReadStat == false )
1068 {
1069 sprintf( cComment, "Fuselage spine definition error." );
1070 Comment();
1071 return false;
1072 }
1073
1074/*--------------------------------------------------------------------*/
1075 //Up contour
1076 iRead = fscanf( t, "%s", tempStr );
1077 bReadStat = true;
1078 if( iRead == 0 || iRead == EOF ) bReadStat = false;
1079
1080 if( CompareStrings(tempStr,(char*)FusCvrStr[(int)CRV_UP_CONT]) == false || bReadStat == false )
1081 {
1082 sprintf( cComment, "Fuselage up contour definition error. Up contour definition was not foud or was defined incorrectly. (%s)",tempStr);
1083 Comment();
1084 return false;
1085 }
1086 bReadStat = true;
1087 iRead = fscanf( t, "%s", tempStr );
1088 if( iRead == 0 || iRead == EOF ) bReadStat = false;
1089 Fuselage.Params.UpCvr.Type = -99;
1090 if( CompareStrings(tempStr, (char*)FusCvrTypeStr[(int)ELLIPSE]))
1091 {
1092 Fuselage.Params.UpCvr.Type = ELLIPSE;
1093 }
1094 else if( CompareStrings(tempStr, (char*)FusCvrTypeStr[(int)AIRFOIL]))
1095 {
1097 }
1098
1099 if( Fuselage.Params.UpCvr.Type == ELLIPSE )
1100 {
1101 bReadStat *= ReadFusEllipse( t, Fuselage.Params.UpCvr.Ellipse, "Up contour" );
1102 }
1103 else if( Fuselage.Params.UpCvr.Type == AIRFOIL )
1104 {
1105 bReadStat *= ReadFusAirfoil( t, Fuselage.Params.UpCvr.Airfoil, "Up contour", bRestrictive );
1106 }
1107 else
1108 {
1109 sprintf( cComment, "Fuselage up contour definition error. Wrong contour type (%s)", tempStr );
1110 Comment();
1111 return false;
1112 }
1113 if( bReadStat == false )
1114 {
1115 sprintf( cComment, "Fuselage up contour definition error.\n" );
1116 Comment();
1117 return false;
1118 }
1119
1120/*--------------------------------------------------------------------*/
1121 //Side contour
1122 iRead = fscanf( t, "%s", tempStr );
1123 bReadStat = true;
1124 if( iRead == 0 || iRead == EOF ) bReadStat = false; //UWAGA
1125
1126 if( CompareStrings(tempStr,(char*)FusCvrStr[(int)CRV_SIDE_CONT]) == false || bReadStat == false )
1127 {
1128 sprintf( cComment, "Fuselage side contour definition error. Side contour definition was not foud or was defined incorrectly. (%s)",tempStr);
1129 Comment();
1130 return false;
1131 }
1132 bReadStat = true;
1133 iRead = fscanf( t, "%s", tempStr );
1134 if( iRead == 0 || iRead == EOF ) bReadStat = false;
1136 if( CompareStrings(tempStr, (char*)FusCvrTypeStr[(int)ELLIPSE]))
1137 {
1138 Fuselage.Params.SideCvr.Type = ELLIPSE;
1139 }
1140 else if( CompareStrings(tempStr, (char*)FusCvrTypeStr[(int)AIRFOIL]))
1141 {
1143 }
1144
1145 if( Fuselage.Params.SideCvr.Type == ELLIPSE )
1146 {
1147 bReadStat *= ReadFusEllipse( t, Fuselage.Params.SideCvr.Ellipse, "Side contour" );
1148 }
1149 else if( Fuselage.Params.SideCvr.Type == AIRFOIL )
1150 {
1151 bReadStat *= ReadFusAirfoil( t, Fuselage.Params.SideCvr.Airfoil, "Side contour", bRestrictive );
1152 }
1153 else
1154 {
1155 sprintf( cComment, "Fuselage side contour definition error. Wrong contour type (%s)", tempStr );
1156 Comment();
1157 return false;
1158 }
1159 if( bReadStat == false )
1160 {
1161 sprintf( cComment, "Fuselage side contour definition error." );
1162 Comment();
1163 return false;
1164 }
1165
1166/*--------------------------------------------------------------------*/
1167 //down contour
1168 bReadStat = true;
1169 iRead = fscanf( t, "%s", tempStr );
1170 if( iRead == 0 || iRead == EOF ) bReadStat = false;
1171
1172 if( CompareStrings(tempStr,(char*)FusCvrStr[(int)CRV_DOWN_CONT]) == false || bReadStat == false )
1173 {
1174 sprintf( cComment, "Fuselage down contour definition error. Down contour definition was not foud or was defined incorrectly. (%s)",tempStr);
1175 Comment();
1176 return false;
1177 }
1178 bReadStat = true;
1179 iRead = fscanf( t, "%s", tempStr );
1180 if( iRead == 0 || iRead == EOF ) bReadStat = false;
1182 if( CompareStrings(tempStr, (char*)FusCvrTypeStr[(int)ELLIPSE]))
1183 {
1184 Fuselage.Params.DownCvr.Type = ELLIPSE;
1185 }
1186 else if( CompareStrings(tempStr, (char*)FusCvrTypeStr[(int)AIRFOIL]))
1187 {
1189 }
1190
1191 if( Fuselage.Params.DownCvr.Type == ELLIPSE )
1192 {
1193 bReadStat *= ReadFusEllipse( t, Fuselage.Params.DownCvr.Ellipse, "Down contour" );
1194 }
1195 else if( Fuselage.Params.DownCvr.Type == AIRFOIL )
1196 {
1197 bReadStat *= ReadFusAirfoil( t, Fuselage.Params.DownCvr.Airfoil, "Down contour", bRestrictive );
1198 }
1199 else
1200 {
1201 sprintf( cComment, "Fuselage down contour definition error. Wrong contour type (%s)", tempStr );
1202 Comment();
1203 return false;
1204 }
1205 if( bReadStat == false )
1206 {
1207 sprintf( cComment, "Fuselage down contour definition error." );
1208 Comment();
1209 return false;
1210 }
1211
1212/*--------------------------------------------------------------------*/
1213 //up convexity factor curve
1214 bReadStat = true;
1215 iRead = fscanf( t, "%s", tempStr );
1216 if( iRead == 0 || iRead == EOF ) bReadStat = false;
1217
1218 if( CompareStrings(tempStr,(char*)FusCvrStr[(int)CRV_CV_FACT_UP]) == false || bReadStat == false )
1219 {
1220 sprintf( cComment, "Fuselage up convexity factors definition error. Up convexity factors definition was not foud or was defined incorrectly. (%s)",tempStr);
1221 Comment();
1222 return false;
1223 }
1224 bReadStat = true;
1225 iRead = fscanf( t, "%s", tempStr );
1226 if( iRead == 0 || iRead == EOF ) bReadStat = false;
1228 if( CompareStrings(tempStr, (char*)FusCvrTypeStr[(int)ELLIPSE]))
1229 {
1230 Fuselage.Params.CvFactUp.Type = ELLIPSE;
1231 }
1232 else if( CompareStrings(tempStr, (char*)FusCvrTypeStr[(int)AIRFOIL]))
1233 {
1235 }
1236 else if( CompareStrings( tempStr, (char*)FusCvrTypeStr[(int)CONSTANT] ))
1237 {
1238 Fuselage.Params.CvFactUp.Type = CONSTANT;
1239 }
1240
1241 if( Fuselage.Params.CvFactUp.Type == ELLIPSE )
1242 {
1243 bReadStat *= ReadFusEllipse( t, Fuselage.Params.CvFactUp.Ellipse, "Up convexity factors" );
1244 }
1245 else if( Fuselage.Params.CvFactUp.Type == AIRFOIL )
1246 {
1247 bReadStat *= ReadFusAirfoil( t, Fuselage.Params.CvFactUp.Airfoil, "Up convexity factors", bRestrictive );
1248 }
1249 else if( Fuselage.Params.CvFactUp.Type == CONSTANT )
1250 {
1251 ReadPar( t, "%lf", &Fuselage.Params.CvFactUp.Factor);
1252 }
1253 else
1254 {
1255 sprintf( cComment, "Fuselage up convexity factors definition error. Wrong type (%s)", tempStr );
1256 Comment();
1257 return false;
1258 }
1259 if( bReadStat == false )
1260 {
1261 sprintf( cComment, "Fuselage up convexity factors definition error." );
1262 Comment();
1263 return false;
1264 }
1265
1266 //down convexity factor curve
1267 bReadStat = true;
1268 iRead = fscanf( t, "%s", tempStr );
1269 if( iRead == 0 || iRead == EOF ) bReadStat = false;
1270
1271 if( CompareStrings(tempStr,(char*)FusCvrStr[(int)CRV_CV_FACT_DOWN]) == false || bReadStat == false )
1272 {
1273 sprintf( cComment, "Fuselage down convexity factors definition error. Down convexity factors definition was not foud or was defined incorrectly. (%s)",tempStr);
1274 Comment();
1275 return false;
1276 }
1277 bReadStat = true;
1278 iRead = fscanf( t, "%s", tempStr );
1279 if( iRead == 0 || iRead == EOF ) bReadStat = false;
1281 if( CompareStrings(tempStr, (char*)FusCvrTypeStr[(int)ELLIPSE]))
1282 {
1283 Fuselage.Params.CvFactDown.Type = ELLIPSE;
1284 }
1285 else if( CompareStrings(tempStr, (char*)FusCvrTypeStr[(int)AIRFOIL]))
1286 {
1288 }
1289 else if( CompareStrings( tempStr, (char*)FusCvrTypeStr[(int)CONSTANT] ))
1290 {
1291 Fuselage.Params.CvFactDown.Type = CONSTANT;
1292 }
1293
1294 if( Fuselage.Params.CvFactDown.Type == ELLIPSE )
1295 {
1296 bReadStat *= ReadFusEllipse( t, Fuselage.Params.CvFactDown.Ellipse, "Down convexity factors" );
1297 }
1298 else if( Fuselage.Params.CvFactDown.Type == AIRFOIL )
1299 {
1300 bReadStat *= ReadFusAirfoil( t, Fuselage.Params.CvFactDown.Airfoil, "Down convexity factors", bRestrictive );
1301 }
1302 else if( Fuselage.Params.CvFactDown.Type == CONSTANT )
1303 {
1305 }
1306 else
1307 {
1308 sprintf( cComment, "Fuselage down convexity factors definition error. Wrong type (%s)", tempStr );
1309 Comment();
1310 return false;
1311 }
1312 if( bReadStat == false )
1313 {
1314 sprintf( cComment, "Fuselage down convexity factors definition error." );
1315 Comment();
1316 return false;
1317 }
1318
1319 return true;
1320}
AIRFOIL class to manipulate the airfoil geometry or it can read geometry data from file (5 commonly ...
Definition airfoil.h:41
bool ReadFusEllipse(FILE *t, MS2_SuperEllipse &SupEll, const char *desc)
reads fuselage elipse data
Definition ms2data.cpp:1322
static std::map< int, const char * > FusCvrStr
spine, up cvr etc.
Definition ms2data.h:47
bool ReadFusAirfoil(FILE *t, MS2_FusAirfoil &airfoil, const char *desc, bool bRestrictive)
reads airfoil data used to define fuselage shape
Definition ms2data.cpp:1347
static std::map< int, const char * > FusCvrTypeStr
ellipse, airfoil etc.
Definition ms2data.h:48

Referenced by Read().

◆ ReadProfile() [1/2]

bool MS2_Data::ReadProfile ( FILE * t,
MS2_Profile & airfoil )

reads Profile data in case AIRFOIL_FILE type

Definition at line 2233 of file ms2data.cpp.

2234{
2235 char name[256];
2236 int NN = 0;
2237 double xd, xg, zd, zg;
2238
2239 ClearPrf( airfoil );
2240
2241 ReadStr( t, name );
2242 airfoil.Name = airfoil.ShortName = string( name );
2243 ReadPar( t, "%d", &NN );
2244 for( int i=0; i<NN; i++ )
2245 {
2246 ReadPar( t, "%lf %lf %lf %lf", &xd, &zd, &xg, &zg );
2247 airfoil.Xd.push_back( xd );
2248 airfoil.Zd.push_back( zd );
2249 airfoil.Xg.push_back( xg );
2250 airfoil.Zg.push_back( zg );
2251 }
2252 airfoil.iType = AIRFOIL_DATA;
2253
2254 return true;
2255}
static void ClearPrf(MS2_Profile &prf)
cleans MS2_Profile object (airfoil)
Definition ms2data.cpp:406
@ AIRFOIL_DATA
airfoil geometry embeded in MS2 file

◆ ReadProfile() [2/2]

bool MS2_Data::ReadProfile ( FILE * t,
MS2_Profile & airfoil,
const char * desc,
bool bRestrictive )

reads Profile data structure (see MS2_Profile)

Definition at line 2107 of file ms2data.cpp.

2108{
2109 char tempStr[20];
2110 ClearPrf( airfoil );
2111
2112 int iRead = ReadStr( t, tempStr ); // iType
2113
2114 if( iRead == 0 || iRead == EOF )
2115 {
2116 fprintf( stderr, "Empty/wrong airfoil source in %s.\n", desc );
2117 return false;
2118 }
2119
2120 if( CompareStrings(tempStr, (char*)AirfoilTypeStr[(int)AIRFOIL_FILE]) )
2121 {
2122 airfoil.iType = AIRFOIL_FILE;
2123 }
2124 else if( CompareStrings(tempStr, (char*)AirfoilTypeStr[(int)AIRFOIL_NACA]) )
2125 {
2126 airfoil.iType = AIRFOIL_NACA;
2127 }
2128 else if( CompareStrings(tempStr, (char*)AirfoilTypeStr[(int)AIRFOIL_DATA]) )
2129 {
2130 airfoil.iType = AIRFOIL_DATA;
2131 }
2132 else
2133 {
2134 fprintf( stderr, "Empty/wrong airfoil source in %s.\n", desc );
2135 return false;
2136 }
2137
2138// fprintf( stderr, "airfoil source in %s %s\n", desc, tempStr );
2139// fflush( stderr );
2140
2141 char name[256];
2142
2143 if( airfoil.iType == AIRFOIL_FILE )
2144 {
2145 iRead = ReadStr( t, name );
2146
2147 if( strlen(name)==0 || iRead == EOF )
2148 {
2149 if( bRestrictive )
2150 {
2151 sprintf( cComment, "Empty/wrong airfoil name in %s", desc ); Comment();
2152 return false;
2153 }
2154 else
2155 {
2156 sprintf( cComment, "Empty/wrong airfoil filename %s in %s\nNACA 4415 is established", filename_name(name), desc ); Comment();
2157 airfoil.Name = "NACA4415.prf";
2158 }
2159 }
2160 else
2161 {
2162 airfoil.Name = string( name );
2163 airfoil.Name = MS2_Data::TruncateQuotMarks( airfoil.Name );
2164 }
2165
2166 airfoil.ShortName = string( filename_name( airfoil.Name.c_str() ) );
2167 }
2168 else if( airfoil.iType == AIRFOIL_NACA )
2169 {
2170 char nacastr[20];
2171 iRead = ReadStr( t, nacastr );
2172 //check if NACA airfoil i 4 or 5 digit
2173 if( ( strlen(nacastr) == 4 || strlen(nacastr) == 5 ) && iRead != EOF )
2174 {
2175 airfoil.NACAnumber = atoi( nacastr );
2176 }
2177 else
2178 {
2179 sprintf( cComment, "Empty/wrong NACA airfoil number in %s. NACA number %s was read.", desc, nacastr ); Comment();
2180 if( bRestrictive )
2181 return false;
2182 else
2183 airfoil.NACAnumber = 4415;
2184 }
2185 airfoil.ShortName = string( "naca" ) + GetNACANoAsString( airfoil.NACAnumber );
2186 airfoil.Name = airfoil.ShortName;
2187 }
2188 else if( airfoil.iType == AIRFOIL_DATA )
2189 {
2190 iRead = ReadStr( t, name );
2191 airfoil.Name = airfoil.ShortName = string( name );
2192
2193 int iFound = 0;
2194 int N = Profiles.size();
2195 for( int i=0; i<N; i++ )
2196 {
2197 if( Profiles[i].ShortName.compare( airfoil.ShortName ) == 0 )
2198 {
2199 int NN = Profiles[i].Xd.size();
2200 for( int ii=0; ii<NN; ii++ )
2201 {
2202 airfoil.Xd.push_back(Profiles[i].Xd[ii]);
2203 airfoil.Zd.push_back(Profiles[i].Zd[ii]);
2204 airfoil.Xg.push_back(Profiles[i].Xg[ii]);
2205 airfoil.Zg.push_back(Profiles[i].Zg[ii]);
2206 }
2207 iFound = 1;
2208 break;
2209 }
2210 }
2211
2212 if( iFound == 0 )
2213 {
2214 if( bRestrictive )
2215 {
2216 sprintf( cComment, "Empty/wrong airfoil name %s in %s", name, desc ); Comment();
2217 return false;
2218 }
2219 else
2220 {
2221 sprintf( cComment, "Empty/wrong airfoil name %s in %s\nNACA 4415 is established", name, desc ); Comment();
2222 airfoil.iType = AIRFOIL_NACA;
2223 airfoil.NACAnumber = 4415;
2224 airfoil.ShortName = string( "naca" ) + GetNACANoAsString( airfoil.NACAnumber );
2225 airfoil.Name = airfoil.ShortName;
2226 }
2227 }
2228 }
2229
2230 return true;
2231}
static std::string GetNACANoAsString(int no)
converts NACA profile number to string
Definition ms2data.cpp:664

Referenced by Read(), ReadFusAirfoil(), ReadSection(), ReadWing(), and ReadWingModule().

◆ ReadSection()

bool MS2_Data::ReadSection ( FILE * t,
MS2_Section & sect )

reads Wing Section data (see MS2_Section)

Definition at line 2079 of file ms2data.cpp.

2080{
2081 if( iVersion >= 50 )
2082 ReadProfile( t, sect.Profil, "wing section", false );
2083 else
2084 {
2085 //sprawdzic ilosc podzialow wzdluz cieciwy oraz if nrsect-1>Max sect number
2086 char nazwa[256];
2087 ReadStr( t, nazwa);
2088 sect.Profil.Name = string( nazwa );
2090 sect.Profil.ShortName = string( filename_name( sect.Profil.Name.c_str() ) );
2091 sect.Profil.iType = AIRFOIL_FILE;
2092 }
2093
2094 ReadPar ( t, "%lf", &sect.Chord);
2095 ReadPar ( t, "%lf %lf %lf", &sect.X, &sect.Y, &sect.Z );
2096 ReadPar ( t, "%lf %lf %lf", &sect.RotX, &sect.RotY, &sect.RotZ );
2097 if( iVersion >= 55 )
2098 {
2099 ReadPar ( t, "%d %d", &sect.CtrlFlag, &sect.CoefPosFlag );
2100 ReadPar ( t, "%lf %lf %lf", &sect.Deflection, &sect.Hinge_X, &sect.Hinge_Z );
2101 }
2102 ReadPar ( t, "%d", &sect.No );
2103
2104 return true;
2105}

Referenced by ReadWing().

◆ ReadWing()

bool MS2_Data::ReadWing ( FILE * t,
MS2_Wing & wing,
int iW,
bool bRestrictive,
bool auto_mod )
virtual

reads wing data (see MS2_Wing)

Definition at line 1452 of file ms2data.cpp.

1453{
1454 char ss[200];
1455 char name[200];
1456 char tmpStr[20];
1457 ostringstream oss;
1458
1459 wing.ID = iW;
1460
1461 if( iVersion == 2 )
1462 {
1463 oss<<iW;
1464 wing.Type = WING_TYPE_SECTIONS;
1466 wing.Name = "Wing " + oss.str();
1467 wing.Active = 1;
1468 }
1469 else
1470 {
1471 ReadPar( t,"%d", &wing.Active );
1472 //wing type
1473 int iRead = 0;// = fscanf(t, "%s", tmpStr );
1474 ReadStr( t, tmpStr );
1475
1476 if( CompareStrings(tmpStr,(char*)WingTypeStr[(int)WING_TYPE_SECTIONS]))
1477 wing.Type = WING_TYPE_SECTIONS;
1478 else if( CompareStrings(tmpStr,(char*)WingTypeStr[(int)WING_TYPE_MODULES]))
1479 wing.Type = WING_TYPE_MODULES;
1480 else if( CompareStrings(tmpStr,(char*)WingTypeStr[(int)WING_TYPE_NACELLE]))
1481 wing.Type = WING_TYPE_NACELLE;
1482 else
1483 {
1484 sprintf( cComment, "Wing %d - wrong wing type", iW );
1485 Comment();
1486 return false;
1487 }
1488
1489 if( iVersion >= 40 )fscanf( t, "%d", &wing.ID );
1490
1491 //name
1492 ReadStr( t, name );
1493 wing.Name = string( name );
1494 if( wing.Name.empty() )
1495 {
1496 sprintf( cComment, "Wing %d - empty wing's name", iW );
1497 Comment();
1498 return false;
1499 }
1500
1501 //fuselage-wing intersection source
1502 iRead = ReadStr( t, tmpStr ); //div source
1503 if( /*Read == 0 || */iRead == EOF ) //UWAGA
1504 {
1505 sprintf( cComment, "Wing \"%s\" - wrong wing division source (%s)", wing.Name.c_str(), tmpStr );
1506 Comment();
1507 return false;
1508 }
1509 if( CompareStrings( tmpStr, (char*)WingDivSourceStr[(int)WING_DIV_MASTER ]))
1511 else if( CompareStrings( tmpStr, (char*)WingDivSourceStr[(int)WING_DIV_SLAVE ]))
1513 else if( CompareStrings( tmpStr, (char*)WingDivSourceStr[(int)WING_DIV_INDEPENDENT ]))
1515 else
1516 {
1517 sprintf( cComment, "Wing \"%s\" - wrong wing division source (%s)", wing.Name.c_str(), tmpStr );
1518 Comment();
1519 if( bRestrictive )
1520 return false;
1521 else
1522 {
1524 }
1525 }
1526
1527 ReadPar (t,"%d",&wing.ComputeInt);
1528 ReadPar (t,"%d",&wing.LongeronNo);
1529 if( iVersion >= 51 )
1530 {
1531 ReadPar (t,"%d",&wing.SmartBypass);
1532 ReadPar (t,"%d",&wing.BypassDepth);
1533 }
1534 else
1535 {
1536 wing.SmartBypass = 0;
1537 wing.BypassDepth = 0;
1538 }
1539
1540 if( wing.DivSource == WING_DIV_INDEPENDENT )
1541 {
1542 wing.ComputeInt = 0;
1543 wing.LongeronNo = 0;
1544 wing.SmartBypass = 0;
1545 wing.BypassDepth = 0;
1546 }
1547
1548 //surface to create
1549 iRead = ReadStr( t, ss ); //UWAGA
1550 if ( CompareStrings( ss, (char*)WingSurfSideStr[(int)WS_BOTTOM] ) )
1551 wing.SurfType = WS_BOTTOM;
1552 else if ( CompareStrings( ss, (char*)WingSurfSideStr[(int)WS_TOP] ) )
1553 wing.SurfType = WS_TOP;
1554 else if ( CompareStrings( ss, (char*)WingSurfSideStr[(int)WS_ALL] ) )
1555 wing.SurfType = WS_ALL;
1556 else
1557 {
1558 sprintf( cComment, "Wing \"%s\" - wrong wing surface name (%s)", wing.Name.c_str(), ss );
1559 Comment();
1560 if( bRestrictive )
1561 return false;
1562 else
1563 wing.SurfType = WS_ALL;
1564 }
1565 //rib type
1566 iRead = ReadStr( t, tmpStr );//UWAGA
1567 if( /*iRead == 0 ||*/ iRead == EOF )
1568 {
1569 sprintf( cComment, "Wing \"%s\" - wrong wing rib's type", tmpStr );
1570 Comment();
1571 return false;
1572 }
1573 if( CompareStrings(tmpStr,(char*)WingRibTypeStr[(int)WING_RIB_OPEN]))
1574 wing.RibType = WING_RIB_OPEN;
1575 else if( CompareStrings(tmpStr,(char*)WingRibTypeStr[(int)WING_RIB_EXTERNAL]))
1577 else if( CompareStrings(tmpStr,(char*)WingRibTypeStr[(int)WING_RIB_BOTH]))
1578 wing.RibType = WING_RIB_BOTH;
1579 else if( CompareStrings(tmpStr,(char*)WingRibTypeStr[(int)WING_RIB_INTERNAL]))
1581 else
1582 wing.RibType = -99;
1583
1584 if( wing.RibType != WING_RIB_OPEN && wing.RibType != WING_RIB_EXTERNAL && wing.RibType != WING_RIB_BOTH && wing.RibType != WING_RIB_INTERNAL )
1585 {
1586 sprintf( cComment, "Wing \"%s\" - wrong wing rib type", wing.Name.c_str() );
1587 Comment();
1588 if( bRestrictive )
1589 return false;
1590 else
1591 wing.RibType = WING_RIB_BOTH;
1592 }
1593
1594 if( iVersion >= 31 )
1595 {
1596 //twist point location (0..1)
1597 ReadPar(t, "%lf", &wing.TwistRef);
1598 if( wing.TwistRef < 0 || wing.TwistRef>1)
1599 {
1600 sprintf( cComment, "Wing \"%s\" - wrong twist reference point (%f). Value should be between 0 and 1", wing.Name.c_str(),wing.TwistRef );
1601 Comment();
1602 return false;
1603 }
1604
1605 ReadPar( t, "%d", &wing.UseMunk );
1606 if( wing.UseMunk == 1)
1607 {
1608 iRead = fscanf( t,"%lf %lf", &wing.SRef, &wing.CzDes );
1609 if( iRead == 0 || iRead == EOF || ferror(t) != 0 )
1610 {
1611 sprintf( cComment, "Wing \"%s\" - wrong referece area (%f) or Clift design (%f) for minimum drag calculation. Minimum induced drag calculation will be disabled.", wing.Name.c_str(),wing.SRef, wing.CzDes );
1612 Comment();
1613 wing.UseMunk = 0;
1614 wing.CzDes = 1.0;
1615 wing.SRef = 0;
1616 }
1617 }
1618 else if( wing.UseMunk != 0 ) //jesli useMunk nie jest 1 lub 0 znaczy ze plik nie jest poprawny
1619 {
1620 //error
1621 sprintf( cComment, "Wing \"%s\" - wrong minimum drag calculation flag (%d). Value 0 or 1 was expected.", wing.Name.c_str(),wing.UseMunk );
1622 Comment();
1623 wing.UseMunk = 0;
1624 wing.CzDes = 1.0;
1625 wing.SRef = 0;
1626 return false;
1627 }
1628 }
1629 else
1630 {
1631 wing.TwistRef = 0.;
1632 wing.UseMunk = 0;
1633 wing.CzDes = 1.0;
1634 wing.SRef = 0;
1635 }
1636 }
1637
1638 if( wing.Type == WING_TYPE_SECTIONS )
1639 {
1640 if( iVersion == 2 ) //in version 3 moved to the global wing properties
1641 {
1642 ReadPar (t,"%d",&wing.RibType);
1643 if( wing.RibType != WING_RIB_OPEN && wing.RibType != WING_RIB_EXTERNAL && wing.RibType != WING_RIB_BOTH && wing.RibType != WING_RIB_INTERNAL )
1644 {
1645 sprintf( cComment, "Wing \"%s\" - wrong wing rib type", wing.Name.c_str() );
1646 Comment();
1647 if( bRestrictive )
1648 return false;
1649 else
1650 wing.RibType = WING_RIB_BOTH;
1651 }
1652 ReadPar (t,"%d",&wing.ComputeInt);
1653 ReadPar (t,"%d",&wing.LongeronNo);
1654 if( wing.LongeronNo < 0 || wing.ComputeInt < 0 )wing.DivSource = WING_DIV_INDEPENDENT;
1655 }
1656
1657 int iSect = 0;
1658 ReadPar (t,"%d",&iSect);
1659/*
1660 if( iSect > SEC )
1661 {
1662 fprintf( stderr, "Wing \"%s\" - too many wing sections (max=%d)\n", wing.Name.c_str(), SEC );
1663 if( HasGUI() )fl_alert( "Wing \"%s\" - too many wing sections (max=%d)", wing.Name.c_str(), SEC );
1664 return false;
1665 }
1666*/
1667 if( iVersion >= 32 )
1668 {
1669 wing.Sec.DivType = SDT_LINEAR;
1670 int iDivType;
1671 ReadPar (t,"%d",&iDivType);
1672 if( iDivType <= SDT_COSINE_INT )wing.Sec.DivType = iDivType;
1673 }
1674
1675 for( int i=0;i<iSect;i++)
1676 {
1677 MS2_Section newSect;
1678 ClearSection( newSect );
1679 if( ReadSection( t, newSect ) )
1680 wing.Sec.Sections.push_back( newSect );
1681 else
1682 return false;
1683 }
1684 if( iVersion == 2 )
1685 {
1686 if( ReadChordDivision( t, wing, bRestrictive ) == false ) return false;
1687 fscanf( t, "%s", ss );
1688 ReadComm( t );
1689 if (strcmp(ss,"end_wing")!=0)
1690 {
1691 if (strcmp(ss,"bottom")==0) wing.SurfType = WS_BOTTOM;
1692 else wing.SurfType = WS_TOP;
1693 }
1694 else
1695 wing.SurfType = WS_ALL;
1696 }
1697 }
1698 else if( wing.Type == WING_TYPE_MODULES )
1699 {
1700 int count = 0;
1701 ReadPar( t, "%d", &count );
1702 wing.Mod.Modules.clear();
1703 for( int i=0; i< count; i++ )
1704 {
1706 ClearModule( mod );
1707 if( ReadWingModule( t, mod, bRestrictive ) )
1708 {
1709 wing.Mod.Modules.push_back(mod);
1710 }
1711 else
1712 {
1713 sprintf( cComment, "Wing \"%s\" - wrong wing module #%d definition!", wing.Name.c_str(),i );
1714 Comment();
1715 return false;
1716 }
1717 }
1718 }
1719 else if( wing.Type == WING_TYPE_NACELLE )
1720 {
1721 char airfoil[256];
1722 MS2_NacelleWing nac;
1723 ClearNacelleWing( nac );
1724
1725 if( iVersion >= 50 )
1726 ReadProfile( t, nac.Profil, "nacelle airfoil", false );
1727 else
1728 {
1729 int iRead = ReadStr( t, airfoil );
1730 nac.Profil.Name = string( airfoil );
1732 nac.Profil.ShortName = string( filename_name( nac.Profil.Name.c_str() ) );
1734 if( iRead == 0 || iRead == EOF || nac.Profil.Name.empty() )
1735 {
1736 sprintf( cComment, "Wing \"%s\" - empty airfoil's name for nacelle", wing.Name.c_str() );
1737 Comment();
1738 if( bRestrictive )
1739 return false;
1740 else
1741 nac.Profil.Name = "NACA4415.prf";
1742 }
1743 }
1744
1745 ReadPar( t, "%lf %lf %lf", &nac.X0, &nac.Y0, &nac.Z0 );
1746 ReadPar( t, "%lf %lf %lf", &nac.fi, &nac.theta, &nac.psi );
1747 ReadPar( t, "%lf %lf %lf", &nac.L, &nac.CvFactUp, &nac.CvFactDown );
1748 ReadPar( t, "%lf %lf %lf", &nac.Y, &nac.ZUp, &nac.ZDown );
1749
1750 ReadPar( t, "%d %d", &nac.NUp, &nac.NDown );
1751
1752 char nacRange[20];
1753 int iRead = ReadPar( t, "%s %s", tmpStr, nacRange );//UWAGA
1754
1755 if( /*iRead == 0 ||*/ iRead == EOF )
1756 {
1757 nac.SwirlType = -99;
1758 nac.SwirlRange = -99;
1759 }
1760
1761 if( CompareStrings(tmpStr, (char*)NacelleSwirlStr[(int)SWIRL_UP]))
1762 nac.SwirlType = SWIRL_UP;
1763 else if( CompareStrings(tmpStr, (char*)NacelleSwirlStr[(int)SWIRL_DOWN]))
1764 nac.SwirlType = SWIRL_DOWN;
1765 else
1766 nac.SwirlType = -99;
1767
1768 if( ( nac.SwirlType != SWIRL_UP ) && (nac.SwirlType != SWIRL_DOWN ) )
1769 {
1770 sprintf( cComment, "Wing \"%s\" - wrong nacelle swirl type!", wing.Name.c_str() );
1771 Comment();
1772 if( bRestrictive )
1773 return false;
1774 else
1775 nac.SwirlType = SWIRL_UP;
1776 }
1777
1778 if( CompareStrings(nacRange, (char*)NacelleRangeStr[(int)FULL_NACELLE]))
1779 nac.SwirlRange = FULL_NACELLE;
1780 else if( CompareStrings(nacRange, (char*)NacelleRangeStr[(int)HALF_NACELLE]))
1781 nac.SwirlRange = HALF_NACELLE;
1782 else
1783 nac.SwirlRange = -99;
1784
1785 if( ( nac.SwirlRange!= FULL_NACELLE ) && (nac.SwirlRange != HALF_NACELLE ) )
1786 {
1787 sprintf( cComment, "Wing \"%s\" - wrong nacelle swirl range!", wing.Name.c_str() );
1788 Comment();
1789 if( bRestrictive )
1790 return false;
1791 else
1792 nac.SwirlRange = FULL_NACELLE;
1793 }
1794
1795 wing.Nac = nac;
1796 }
1797 else
1798 {
1799 sprintf( cComment, "Wing \"%s\" - wrong wing type!", wing.Name.c_str() );
1800 Comment();
1801 return false;
1802 }
1803
1804 //section division
1805 if( iVersion != 2 )
1806 {
1807 if( ReadChordDivision( t, wing, bRestrictive ) == false ) return false;
1808 }
1809
1810 //Create section wing data for non-section wings
1811/*
1812 if( wing.Type == WING_TYPE_MODULES)
1813 {
1814 Wing_Module2Sec( wing );
1815 }
1816 else if( wing.Type == WING_TYPE_NACELLE )
1817 {
1818 Wing_Nacelle2Sec( wing );
1819 }
1820*/
1821 return true; //VerifyWing( wing, true/*HasGUI()*/, auto_mod, bRestrictive );
1822}
static std::map< int, const char * > NacelleSwirlStr
swirl up, swirl down
Definition ms2data.h:58
static void ClearSection(MS2_Section &sect)
cleans MS2_Section object (wing section definition)
Definition ms2data.cpp:370
static void ClearModule(MS2_ModWingModule &mod)
cleans MS2_ModWingModule object (wing module definition)
Definition ms2data.cpp:430
bool ReadChordDivision(FILE *t, MS2_Wing &wing, bool bRestrictive)
reads user define chord division (see DT_USER)
Definition ms2data.cpp:1824
static std::map< int, const char * > WingRibTypeStr
open, external, both
Definition ms2data.h:56
static std::map< int, const char * > WingTypeStr
sections, modules, nacelle
Definition ms2data.h:51
static std::map< int, const char * > NacelleRangeStr
swirl range: full, half
Definition ms2data.h:59
static std::map< int, const char * > WingSurfSideStr
all, top, bottom
Definition ms2data.h:55
bool ReadWingModule(FILE *t, MS2_ModWingModule &mod, bool bRestrictive)
reads Wing Module data (see MS2_ModWingModule)
Definition ms2data.cpp:1956
bool ReadSection(FILE *t, MS2_Section &sect)
reads Wing Section data (see MS2_Section)
Definition ms2data.cpp:2079
@ WING_RIB_BOTH
both ribs are present (e.g. in case of slotted flap)
@ WING_RIB_OPEN
no closing ribs (e.g. wing is open and connected with winglets)
@ WING_RIB_EXTERNAL
only external rib (typical situataion external rib on wing tip)
@ WING_RIB_INTERNAL
only internal rib
@ SDT_COSINE_INT
constant spanwise angle projection (0, pi/2)
@ WING_TYPE_MODULES
wing defined by modules
@ WING_TYPE_SECTIONS
wing defined by sections
@ WING_TYPE_NACELLE
jet engine nacelle
@ WS_TOP
upper surface (up)
@ WS_ALL
both surfaces (up and bottom)
@ WS_BOTTOM
lower surface (bottom)
module used for "module wing" definition
data of nacelle type of wing
definition of section (used in "Section Wing")

Referenced by Read().

◆ ReadWingModule()

bool MS2_Data::ReadWingModule ( FILE * t,
MS2_ModWingModule & mod,
bool bRestrictive )

reads Wing Module data (see MS2_ModWingModule)

Definition at line 1956 of file ms2data.cpp.

1957{
1958 ReadDummy(t);
1959 char airfoil[255];
1960 char tmpStr[40];
1961 int iRead = 0;
1962 bool bRead = true;
1963 bool readSpanConc = false;
1964
1965 iRead = fscanf( t, "%s", tmpStr );
1966 if( /*iRead == 0 ||*/ iRead == EOF ) //UWAGA
1967 bRead *= false;
1968 if( CompareStrings( tmpStr, (char*)WingModTypeStr[(int)WING_MOD_TYPE_ROOT ]))
1969 mod.Type = WING_MOD_TYPE_ROOT;
1970 else if( CompareStrings( tmpStr, (char*)WingModTypeStr[(int)WING_MOD_TYPE_EQUI_LINE ]))
1971 mod.Type = WING_MOD_TYPE_EQUI_LINE;
1972 else if( CompareStrings( tmpStr, (char*)WingModTypeStr[(int)WING_MOD_TYPE_ARC]))
1973 mod.Type = WING_MOD_TYPE_ARC;
1974 else if( CompareStrings( tmpStr, (char*)WingModTypeStr[(int)WING_MOD_TYPE_LINE ]))
1975 mod.Type = WING_MOD_TYPE_LINE;
1976 else
1977 {
1978 sprintf( cComment, "Wing module reading error - wrong module type (%s)!", tmpStr);
1979 Comment();
1980 return false;
1981 }
1982
1983 iRead = fscanf( t,"%lf %lf", &mod.C, &mod.Alfa );
1984 if( iRead == 0 || iRead == EOF || ferror(t) != 0 )
1985 bRead *= false;
1986
1987 if( mod.Type == WING_MOD_TYPE_ROOT)
1988 {
1989 iRead = fscanf( t, "%lf %lf %lf %lf", &mod.XRef, &mod.X0, &mod.Y0, &mod.Z0 );
1990 if( iRead == 0 || iRead == EOF || ferror(t) != 0 )
1991 bRead *= false;
1992 }
1993 else if( mod.Type == WING_MOD_TYPE_EQUI_LINE )
1994 {
1995 iRead = fscanf( t, "%lf %lf %d %lf %lf %lf %d", &mod.Fi, &mod.Gamma, &mod.N, &mod.NDist, &mod.L, &mod.R, &mod.UseMunk);
1996 if( iRead == 0 || iRead == EOF || ferror(t) != 0 )
1997 bRead *= false;
1998 readSpanConc = true;
1999 }
2000 else if( mod.Type == WING_MOD_TYPE_LINE )
2001 {
2002 iRead = fscanf( t, "%lf %lf %d %lf %lf %lf %d", &mod.Fi, &mod.Gamma, &mod.N, &mod.NDist, &mod.L, &mod.R, &mod.UseMunk);
2003 if( iRead == 0 || iRead == EOF || ferror(t) != 0 )
2004 bRead *= false;
2005 readSpanConc = true;
2006 }
2007 else if( mod.Type == WING_MOD_TYPE_ARC )
2008 {
2009 iRead = fscanf( t, "%lf %lf %d %lf %lf %d", &mod.Fi, &mod.Gamma, &mod.N, &mod.NDist, &mod.R, &mod.UseMunk);
2010 if( iRead == 0 || iRead == EOF || ferror(t) != 0 )
2011 bRead *= false;
2012 readSpanConc = true;
2013 }
2014 else
2015 {
2016 sprintf( cComment, "Wing module reading error - wrong module type (%d)!", mod.Type );
2017 Comment();
2018 return false;
2019 }
2020
2021 if( bRead == false )
2022 {
2023 sprintf( cComment, "Wing module reading error!" );
2024 Comment();
2025 clearerr(t);
2026 return false;
2027 }
2028
2029
2030 if( readSpanConc == true )
2031 {
2032 iRead = fscanf( t, "%s", tmpStr );
2033 if( /*iRead == 0 ||*/ iRead == EOF ) //UWAGA
2034 bRead *= false;
2035 if( CompareStrings( tmpStr, (char*)WingModPanConcStr[(int)WING_MOD_PAN_CONC_LEFT]))
2036 mod.SpanPanConc = WING_MOD_PAN_CONC_LEFT;
2037 else if( CompareStrings( tmpStr, (char*)WingModPanConcStr[(int)WING_MOD_PAN_CONC_CENTER ]))
2038 mod.SpanPanConc = WING_MOD_PAN_CONC_CENTER;
2039 else if( CompareStrings( tmpStr, (char*)WingModPanConcStr[(int)WING_MOD_PAN_CONC_RIGHT]))
2040 mod.SpanPanConc = WING_MOD_PAN_CONC_RIGHT;
2041 else
2042 {
2043 sprintf( cComment, "Wing module reading error - wrong span paneling type (%s)!", tmpStr);
2044 Comment();
2045 return false;
2046 }
2047 }
2048
2049
2050 if( iVersion >= 50 )
2051 ReadProfile( t, mod.Profil, "modular wing airfoil", false );
2052 else
2053 {
2054 iRead = ReadStr( t, airfoil );
2055 mod.Profil.Name = string( airfoil );
2057 mod.Profil.ShortName = string( filename_name( mod.Profil.Name.c_str() ) );
2059 if( iRead == 0 || iRead == EOF )
2060 {
2061 sprintf( cComment, "Wing module reading error - wrong airfoil's name (%s)!", mod.Profil.Name.c_str() );
2062 Comment();
2063 if( bRestrictive )
2064 return false;
2065 else
2066 mod.Profil.Name = "NACA4415.prf";
2067 }
2068 }
2069
2070 if( bRead == false )
2071 {
2072 sprintf( cComment, "Wing module reading error!" );
2073 Comment();
2074 return false;
2075 }
2076 return true;
2077}
static std::map< int, const char * > WingModTypeStr
root, equi line, arc, line
Definition ms2data.h:52
static std::map< int, const char * > WingModPanConcStr
paneling distribution in module wings modules ( left, right center )
Definition ms2data.h:53
int UseMunk
(0,1) Use Munk minimum induced drag theorem

Referenced by ReadWing().

◆ RemoveExt()

std::string MS2_Data::RemoveExt ( std::string filename)
protected

removes the filename extention

Definition at line 2396 of file ms2data.cpp.

2397{
2398 string myFile = filename;
2399 string ext( filename_ext( myFile.c_str() ) );
2400 size_t found;
2401 found = myFile.rfind(ext);
2402 if (found!=string::npos)
2403 myFile.erase( found,ext.length() );
2404 return myFile;
2405}
static const char * filename_ext(const char *buf)
Returns pointer to filename extension.
Definition iofun.cpp:302

◆ RemoveWhiteSpaces()

string MS2_Data::RemoveWhiteSpaces ( std::string str)
static

removes white chars from string

Definition at line 649 of file ms2data.cpp.

650{
651 string retStr = str;
652 int i=0;
653 for( i=0; i<(int)str.length();i++ )
654 {
655 if( !isspace(retStr[i]) ) break;
656 }
657
658 if( i != 0 )
659 retStr = retStr.erase(0,i);
660
661 return retStr;
662}

Referenced by TruncateQuotMarks().

◆ SetConnectionDefs()

void MS2_Data::SetConnectionDefs ( MS2_Conn & conn)
static

sets MS2_Conn object (wings connection)

Definition at line 479 of file ms2data.cpp.

480{
481 conn.Name = "Connection";
482 conn.Active = 1;
483 conn.Type = CON_H; //vert to horiz
484 conn.Wing1No = 0;
485 conn.Wing2No = 1;
486 conn.Wing1Rib = 0;
487 conn.Wing2Rib = 5;
488 conn.Wing2LongLE = 0;
489 conn.Wing2LongTE = 2;
490 conn.Wing2Surf = 0;
491}

◆ SetDefaults()

void MS2_Data::SetDefaults ( void )

set default reference values

Definition at line 194 of file ms2data.cpp.

195{
196 //Version
198 //General
199 General.RefVal.AutoComp = true;
200 General.RefVal.S = 20.0;
201 General.RefVal.B = 10.0;
202 General.RefVal.MAC = 2.0;
203 General.RefVal.MX = 0.25;
204 General.RefVal.MZ = 0.0;
205 General.RefVal.Scale = 1;
208 General.InpFileName = "";
210
211 //Fuselage
213
214 //Wings
215 Wings.clear();
216 Conns.clear();
217 Wakes.clear();
218}
@ OUT_OPT_NODES
mesh written as nodes
@ SYM_OPT_SYM
symmetrical object

◆ SetFusCurveDefs()

void MS2_Data::SetFusCurveDefs ( MS2_FusCurve & cvr,
int elltype )
static

sets MS2_Profile object (airfoil)

Definition at line 294 of file ms2data.cpp.

295{
296 cvr.Type = ELLIPSE;
297 cvr.Factor = 0.5;
298 cvr.Ellipse.EllType = elltype;
299 cvr.Ellipse.NF = cvr.Ellipse.NR = 10;
300 cvr.Ellipse.L = 0.5;
301 cvr.Ellipse.H = 0.25;
302 cvr.Ellipse.CvFactF = cvr.Ellipse.CvFactR = 0.5;
304 cvr.Airfoil.Name = "";
305 cvr.Airfoil.NACAnumber = 12;
306 cvr.Airfoil.Side = AS_UP;
307}

Referenced by SetFuselageDefs().

◆ SetFuselageDefs()

void MS2_Data::SetFuselageDefs ( MS2_Fuselage & fus)
static

sets MS2_Fuselage object (fuselage definition)

Definition at line 254 of file ms2data.cpp.

255{
256 fus.Type = FT_PARAMS;
257 fus.Exists = false;
258 fus.Active = 1;
259 fus.UserDiv.clear();
260
261 fus.File.Name = "";
262
263 fus.Params.Name = "Fuselage";
264 fus.Params.Nup = fus.Params.Ndown = 10;
265 fus.Params.Scale = fus.Params.ScaleX = fus.Params.ScaleY = fus.Params.ScaleZup = fus.Params.ScaleZdown =1;
266 fus.Params.X0 = fus .Params.Y0 = fus.Params.Z0 = 0.0;
267 fus.Params.BendLength = 0.5;
268 fus.Params.BendAngle = 0;
269 fus.Params.Length = 1;
270
271 SetFusCurveDefs( fus.Params.SpineCvr, ELLIPSE_SPINE );
272 SetFusCurveDefs( fus.Params.UpCvr, ELLIPSE_NORMAL );
273 SetFusCurveDefs( fus.Params.SideCvr, ELLIPSE_NORMAL );
274 SetFusCurveDefs( fus.Params.DownCvr, ELLIPSE_NORMAL );
275 SetFusCurveDefs( fus.Params.CvFactUp, ELLIPSE_NORMAL);
276 SetFusCurveDefs( fus.Params.CvFactDown, ELLIPSE_NORMAL );
277}
static void SetFusCurveDefs(MS2_FusCurve &cvr, int elltype)
sets MS2_Profile object (airfoil)
Definition ms2data.cpp:294

Referenced by Read(), and SetDefaults().

◆ SetModuleDefs()

void MS2_Data::SetModuleDefs ( MS2_ModWingModule & mod)
static

sets MS2_ModWingModule object (wing module definition)

Definition at line 447 of file ms2data.cpp.

448{
449 mod.Type = WING_MOD_TYPE_ROOT;
450 mod.Profil.Name = "";
451 mod.Profil.NACAnumber = 4415;
452 mod.X0 = 0.0;
453 mod.Y0 = mod.Z0 = 0.0;
454 mod.XRef = 0.25;
455 mod.C = 1;
456 mod.Alfa = 0.0;
457 mod.Fi = mod.Gamma = 0.0;
458 mod.L = 1.0;
459 mod.R = 0.0;
460 mod.N = 20;
461 mod.NDist = 1;
462 mod.SpanPanConc = WING_MOD_PAN_CONC_CENTER;
463}

◆ SetNacelleWingDefs()

void MS2_Data::SetNacelleWingDefs ( MS2_NacelleWing & nac)
static

sets MS2_NacelleWing object (jet nacelle definition)

Definition at line 531 of file ms2data.cpp.

532{
533 nac.Profil.Name = "";
534 nac.Profil.NACAnumber = 12;
535 nac.NUp = nac.NDown = 10;
536 nac.SwirlType = SWIRL_UP;
537 nac.SwirlRange = FULL_NACELLE;
538 nac.X0 = nac.Y0 = nac.Z0 = 0.0;
539 nac.L = 1;
540 nac.CvFactUp = nac.CvFactDown = 0.5;
541 nac.Y = nac.ZUp = nac.ZDown = 1.0;
542 nac.fi = nac.theta = nac.psi = 0.0;
543}

Referenced by SetWingDefs().

◆ SetPrfDefs()

void MS2_Data::SetPrfDefs ( MS2_Profile & prf)
static

sets MS2_Profile object (airfoil)

Definition at line 418 of file ms2data.cpp.

419{
420 prf.Name.clear();
421 prf.ShortName.clear();
422 prf.Xd.clear();
423 prf.Xg.clear();
424 prf.Zd.clear();
425 prf.Zg.clear();
426 prf.iType = AIRFOIL_NACA;
427 prf.NACAnumber = 4415;
428}

◆ SetSectionDefs()

void MS2_Data::SetSectionDefs ( MS2_Section & sect)
static

sets MS2_Section object (wing section definition)

Definition at line 388 of file ms2data.cpp.

389{
390 sect.Profil.Name = "";
391 sect.Profil.ShortName = "";
392 sect.X = sect.Z = 0.0;
393 sect.Y = 0.0;
394 sect.RotX = sect.RotY = sect.RotZ = 0.0;
395 sect.No = 0;
396 sect.Chord = 10;
398 sect.Profil.NACAnumber = 4415;
399 sect.CtrlFlag = 0;
400 sect.CoefPosFlag = 1;
401 sect.Deflection = 0.0;
402 sect.Hinge_X = 0.75;
403 sect.Hinge_Z = 0.0;
404}

◆ SetWakeDefs()

void MS2_Data::SetWakeDefs ( MS2_Wake & wake)
static

sets MS2_Wake object (wake information)

Definition at line 505 of file ms2data.cpp.

506{
507 wake.Name = "main_wing";
508 wake.Active = 1;
509 wake.Type = WAKE_H; //horizontal wake
510 wake.Wing1No = 0;
511 wake.Wing2No = 0;
512 wake.Wing1Rib = 0;
513 wake.Wing2Rib = 3;
514 wake.Wing2Surf = 0;
515}

◆ SetWingDefs()

void MS2_Data::SetWingDefs ( MS2_Wing & wing)
static

sets MS2_Wing object (wing definition)

Definition at line 339 of file ms2data.cpp.

340{
341 ClearWing( wing );
342 wing.Active = 1;
345 wing.ComputeInt = 0;
346 wing.LongeronNo = 0;
347 wing.RibType = WING_RIB_OPEN;
348 wing.Name = "Wing";
349 wing.SurfType = WS_ALL;
350 wing.DivNo = 15;
351 wing.DivType = DT_LINEAR;
352 wing.TwistRef = 0;
353 wing.UseMunk = 0;
354 wing.SRef = 0;
355 wing.CzDes = 1.0;
356 wing.SmartBypass = 0;
357 wing.BypassDepth = 2;
358
359 wing.UserDiv.clear();
360 //From sections
361 wing.Sec.Sections.clear();
362 wing.Sec.DivType = SDT_LINEAR;
363 //From modules
364 wing.Mod.Modules.clear();
365 //nacelle
366 SetNacelleWingDefs( wing.Nac );
367}
static void SetNacelleWingDefs(MS2_NacelleWing &nac)
sets MS2_NacelleWing object (jet nacelle definition)
Definition ms2data.cpp:531

◆ TruncateQuotMarks()

string MS2_Data::TruncateQuotMarks ( std::string str)
static

truncates the quote marks from string

Definition at line 634 of file ms2data.cpp.

635{
636 string retStr = RemoveWhiteSpaces(str);
637
638 if( retStr[0] == '\"')
639 {
640 retStr = retStr.substr(1,retStr.size()-1);
641 }
642 if( retStr[retStr.size()-1] == '\"' )
643 {
644 retStr.resize( retStr.size()-1);
645 }
646 return retStr;
647}
static std::string RemoveWhiteSpaces(std::string str)
removes white chars from string
Definition ms2data.cpp:649

Referenced by Read(), ReadFusAirfoil(), ReadFusFromParams(), ReadProfile(), ReadSection(), ReadWing(), and ReadWingModule().

◆ WakeTypeName()

string MS2_Data::WakeTypeName ( int n)
static

returns wake info type name

Definition at line 616 of file ms2data.cpp.

617{
618 string retStr = "";
619 switch( n )
620 {
621 case WAKE_H :
622 retStr = "Horizontal";
623 break;
624 case WAKE_V :
625 retStr = "Vertical";
626 break;
627 default :
628 retStr = "Horizontal";
629 break;
630 }
631 return retStr;
632}

Referenced by Read(), and WriteWakes().

◆ WingSurfName()

string MS2_Data::WingSurfName ( int n)

returns wing surface type (name) - see MS2WingSurf

Definition at line 546 of file ms2data.cpp.

547{
548 string retStr = "";
549 switch( n )
550 {
551 case WS_ALL :
552 //retStr = "all";
553 //break;
554 case WS_TOP :
555 //retStr = "top";
556 //break;
557 case WS_BOTTOM :
558 //retStr = "bottom";
559 //break;
560 retStr = string( WingSurfSideStr[n]);
561 break;
562 default :
563 retStr = "";
564 break;
565 }
566 return retStr;
567}

◆ Write()

bool MS2_Data::Write ( const char * file)

writes ms2 file

Definition at line 2327 of file ms2data.cpp.

2328{
2329 bool res = true;
2330 ofstream outFile( file, ios_base::out );
2331 if( outFile.fail() )
2332 {
2333 sprintf( cComment, "Output file can not be opened" );
2334 Comment();
2335 return false;
2336 }
2337 //General
2338 res *= WriteGeneral( outFile );
2339
2340 //Wings
2341 outFile<<endl<<"#######################"<<endl;
2342 outFile<<"/*"<<endl;
2343 outFile<<"WING Section (\"begin_wing*\")"<<endl;
2344 outFile<<" is wing active ( 1- active, 2 - not active)"<<endl;
2345 outFile<<" wing type ("<<WingTypeStr[(int)WING_TYPE_SECTIONS]<<" - build from sections, "<<WingTypeStr[(int)WING_TYPE_MODULES]<<" - build from modules, "<<WingTypeStr[(int)WING_TYPE_NACELLE]<<" - nacelle)"<<endl;
2346 outFile<<" name"<<endl;
2347 outFile<<" create wing as: ("<<WingDivSourceStr[(int)WING_DIV_MASTER]<<", "<< WingDivSourceStr[(int)WING_DIV_SLAVE]<<", "<<WingDivSourceStr[(int)WING_DIV_INDEPENDENT] <<")"<<endl;
2348 outFile<<" compute fuselage-wing intersection: 0 - no, 1 - yes"<<endl;
2349 outFile<<" the fuselage longeron number (according to definition of sections in the fuselage geometry file) which begins the wing"<<endl;
2350 outFile<<" wing surface to create ("<< WingSurfSideStr[(int)WS_ALL]<<", "<< WingSurfSideStr[(int)WS_TOP]<<", "<< WingSurfSideStr[(int)WS_BOTTOM]<<")"<<endl;
2351 outFile<<" rib type ("<< WingRibTypeStr[(int)WING_RIB_OPEN]<<", "<< WingRibTypeStr[(int)WING_RIB_EXTERNAL]<<", "<< WingRibTypeStr[(int)WING_RIB_BOTH]<<", "<< WingRibTypeStr[(int)WING_RIB_INTERNAL]<<")"<<endl;
2352 outFile<<" twist reference point (0...1) (0 - leading edge, 1 - trailing edge)"<<endl;
2353 outFile<<" <rest of wing definition ( see documentation )>"<<endl;
2354 /*
2355 outFile<<" should the closing rib be created (Pclosed: 0 - no, 1 - exterior, 2 - exterior and interior)"<<endl;
2356 outFile<<" intersection of wing and fuselage (Pcut: 0 - no; the wing is joined, 1 -yes) - important if there's a fuselage"<<endl;
2357 outFile<<" the fuselage longeron number (according to definition of sections in the fuselage geometry file) which begins the wing"<<endl;
2358 outFile<<" number of cross-sections - ribs defined for a wing (Pizeb)"<<endl;
2359 outFile<<" definitions of successive cross-sections (Pizeb times)"<<endl;
2360 outFile<<" name of the profile data file (Pprof[Pizeb] - e.g. naca0012.prf)"<<endl;
2361 outFile<<" chord Pc[Pizeb]"<<endl;
2362 outFile<<" coordinates of the leading point (x,y,z), starting point (pps[Pizeb])"<<endl;
2363 outFile<<" angles of rib turns with X Y Z axis"<<endl;
2364 outFile<<" rib number Pnr[Pizeb] - starting from \"0\"; if the rib numbers in successive cross-section definitions aren't "<<endl;
2365 outFile<<" successive natural numbers, additional ribs will be automatically put between defined ones on the assumption"<<endl;
2366 outFile<<" that the wing cross-section change is linear."<<endl;
2367 outFile<<" divides chord wise - this row should look like this:"<<endl;
2368 outFile<<" string of numbers defining the longeron in chord percentages (must begin with 0 and end with 100)"<<endl;
2369 outFile<<" \"cosine n\" - co sinusoidal divide, where n is the number of all longerons"<<endl;
2370 outFile<<" \"linear n\" - linear divide, where n is the number of all longerons"<<endl;
2371 outFile<<" \"unknown\" - no divide defined - it will be taken according to the divide of e.g. fuselage"<<endl;
2372 outFile<<" (useful for fin, when it is adjacent to tail plane)"<<endl;
2373 outFile<<" option - only bottom \"bottom\" or top \"top\" wing surface"<<endl;
2374 */
2375 outFile<<" End of wing section (\"end\")"<<endl;
2376 outFile<<" */"<<endl;
2377 outFile<<"#######################"<<endl<<endl;
2378
2379 for( int i=0;i < (int)Wings.size();i++ )
2380 {
2381 res *= WriteWing( outFile, Wings[i], i );
2382 }
2383 //Fuselage
2384 res *= WriteFuselage( outFile );
2385 //Connections
2386 res *= WriteConns( outFile );
2387 //Wakes
2388 res *= WriteWakes( outFile );
2389 //Profiles
2390 res = WriteEmbededProfiles( outFile, &Profiles );
2391
2392 outFile.close();
2393 return res;
2394}
bool WriteEmbededProfiles(std::ostream &fout, std::vector< MS2_Profile > *airfoil)
writes embeded airfoil geometry
Definition ms2data.cpp:2886
bool WriteFuselage(std::ostream &fout)
writes fuselage data
Definition ms2data.cpp:2503
bool WriteWing(std::ostream &fout, MS2_Wing wing, int no)
writes wing's data
Definition ms2data.cpp:2761
bool WriteConns(std::ostream &fout, bool bCom=true)
writes connections data
Definition ms2data.cpp:2685
bool WriteWakes(std::ostream &fout, bool bCom=true)
writes extra wake infos
Definition ms2data.cpp:2721
bool WriteGeneral(std::ostream &f)
writes general data, incuding reference values
Definition ms2data.cpp:2407

◆ WriteConns()

bool MS2_Data::WriteConns ( std::ostream & fout,
bool bCom = true )

writes connections data

Definition at line 2685 of file ms2data.cpp.

2686{
2687 if( bCom )
2688 {
2689 fout<<endl<<"#######################"<<endl;
2690 fout<<"/*"<<endl;
2691 fout<<"CONNECTIONS section (\"begin_connections\")"<<endl;
2692 fout<<" number of connections - ICon"<<endl;
2693 fout<<" definitions of successive connections (ICon times)"<<endl;
2694 fout<<" type ( Horizontal, Vertical)"<<endl;
2695 fout<<" annotation"<<endl;
2696 fout<<" is section active ( 1- active, 2 - not active)"<<endl;
2697 fout<<" number of the 1st wing (vertical)"<<endl;
2698 fout<<" number of the 2nd wing (horizontal)"<<endl;
2699 fout<<" number of wing 1 rib connected to wing 2 (0-0, 1-last)"<<endl;
2700 fout<<" number of wing 2 rib connected to wing 1"<<endl;
2701 fout<<" number of wing 2 longeron connected to leading point of wing 1"<<endl;
2702 fout<<" number of wing 2 longeron connected to trailing point of wing 1"<<endl;
2703 fout<<" wing 2 surface for modification (0-bottom or exterior, 1-top or interior)"<<endl;
2704 fout<<"End (\"end\")"<<endl;
2705 fout<<"*/"<<endl;
2706 fout<<"#######################"<<endl<<endl;
2707 }
2708
2709 fout<<endl<<"begin_connections"<<endl;
2710 fout<<Conns.size()<<endl;
2711 for( int i=0;i < (int)Conns.size();i++)
2712 {
2713 CONNECT_DATA conn;
2714 MS2_Conn2CONNECT(Conns[i],conn );
2715 conn.Write( fout );
2716 }
2717 fout<<"end"<<endl;
2718 return true;
2719}
int Write(std::ostream &fout)
Write connection section (within MS2 file saving)
static void MS2_Conn2CONNECT(MS2_Conn &Conn, CONNECT_DATA &newCon)
converts MS2_Conn to CONNECT_DATA
Definition ms2data.cpp:2273

Referenced by Write().

◆ WriteEmbededProfiles()

bool MS2_Data::WriteEmbededProfiles ( std::ostream & fout,
std::vector< MS2_Profile > * airfoil )

writes embeded airfoil geometry

Definition at line 2886 of file ms2data.cpp.

2887{
2888 int N = airfoil->size();
2889 for( int i=0; i<N; i++ )
2890 {
2891 fout << endl;
2892 fout << "begin_airfoil" << i << endl;
2893 fout << airfoil->at(i).ShortName << endl;
2894 int NN = airfoil->at(i).Xd.size();
2895 fout << NN << endl;
2896 for( int ii=0; ii<NN; ii++ )
2897 {
2898 fout << airfoil->at(i).Xd[ii] << " ";
2899 fout << airfoil->at(i).Zd[ii] << " ";
2900 fout << airfoil->at(i).Xg[ii] << " ";
2901 fout << airfoil->at(i).Zg[ii] << " ";
2902 fout << endl;
2903 }
2904 fout << "end_airfoil" << endl << endl;
2905 }
2906
2907 return true;
2908}

Referenced by Write().

◆ WriteFuselage()

bool MS2_Data::WriteFuselage ( std::ostream & fout)

writes fuselage data

Definition at line 2503 of file ms2data.cpp.

2504{
2505 fout<<endl<<"#######################"<<endl;
2506 fout<<"/*"<<endl;
2507 fout<<"FUSELAGE Section (\"begin_fuselage\")"<<endl;
2508 fout<<" does the fuselage exist: 1 - fuselage exists, 0 - doesn't exist"<<endl;
2509 fout<<" is the fuselage active: 1 - active, 0 - not active"<<endl;
2510 fout<<" type of fuselage: "<< FusTypeStr[(int)FT_FILE]<<" - from file, "<<FusTypeStr[(int)FT_PARAMS] <<" - automatically generated"<<endl;
2511 fout<<" <type = "<< FusTypeStr[(int)FT_FILE]<<">"<<endl;
2512 fout<<" name of the fuselage sections data file (default extension [.f])"<<endl;
2513 fout<<" <type = "<< FusTypeStr[(int)FT_PARAMS] <<"> (see documentation)"<<endl;
2514 fout<<" number of additional sections computed automatically"<<endl;
2515 fout<<" \"x\" coordinates of additional sections"<<endl;
2516 fout<<"End of fuselage section (\"end\")"<<endl;
2517 fout<<"*/"<<endl;
2518 fout<<"#######################"<<endl<<endl;
2519
2520 fout<<endl<<"begin_fuselage"<<endl;
2521 fout<<(int)Fuselage.Exists<<endl;
2522 fout<<Fuselage.Active<<endl;
2523 if( Fuselage.Exists )
2524 {
2525 //fout<<Fuselage.Type<<endl; //type
2526 fout<<FusTypeStr[Fuselage.Type]<<endl;
2527 if( Fuselage.Type == FT_FILE ) //fuselage from file
2528 {
2529 //fout<<filename_name( Fuselage.File.Name.c_str() )<<endl;
2530 fout<<Fuselage.File.Name<<endl;
2531 }
2532 else //fuselage from parameters
2533 {
2534 //global
2535 fout<<Fuselage.Params.Name<<endl;
2536 fout<<Fuselage.Params.Nup<<" "<<Fuselage.Params.Ndown<<endl;
2537 fout<<Fuselage.Params.X0<<" "<<Fuselage.Params.Y0<<" "<<Fuselage.Params.Z0<<endl;
2540 //spine
2541 fout<<FusCvrStr[CRV_SPINE]<<"\t\t\t"<<FusCvrTypeStr[Fuselage.Params.SpineCvr.Type]<<" ";
2542 if( Fuselage.Params.SpineCvr.Type == ELLIPSE )
2543 {
2544 fout<<Fuselage.Params.SpineCvr.Ellipse.NF<<" ";
2545 fout<<Fuselage.Params.SpineCvr.Ellipse.NR<<" ";
2548 }
2549 else
2550 {
2553 //fout<<" "<<AirfoilTypeStr[Fuselage.Params.SpineCvr.Airfoil.iType];
2554 //if( Fuselage.Params.SpineCvr.Airfoil.iType == AIRFOIL_FILE )
2555 // fout<<" "<<Fuselage.Params.SpineCvr.Airfoil.Name<<endl;
2556 //else
2557 // fout<<" "<<GetNACANoAsString( Fuselage.Params.SpineCvr.Airfoil.NACAnumber)<<endl;
2558 }
2559
2560 //Up contour
2561 fout<<FusCvrStr[CRV_UP_CONT]<<"\t\t\t"<<FusCvrTypeStr[Fuselage.Params.UpCvr.Type]<<" ";
2562 if( Fuselage.Params.UpCvr.Type == ELLIPSE )
2563 {
2564 fout<<Fuselage.Params.UpCvr.Ellipse.L<<" ";
2565 fout<<Fuselage.Params.UpCvr.Ellipse.H<<" ";
2566 fout<<Fuselage.Params.UpCvr.Ellipse.CvFactF<<" ";
2567 fout<<Fuselage.Params.UpCvr.Ellipse.CvFactR<<endl;
2568 }
2569 else
2570 {
2573 //fout<<" "<<AirfoilTypeStr[Fuselage.Params.UpCvr.Airfoil.iType];
2574 //if( Fuselage.Params.UpCvr.Airfoil.iType == AIRFOIL_FILE )
2575 // fout<<" "<<Fuselage.Params.UpCvr.Airfoil.Name<<endl;
2576 //else
2577 // fout<<" "<<GetNACANoAsString( Fuselage.Params.UpCvr.Airfoil.NACAnumber)<<endl;
2578 }
2579
2580 //Side contour
2581 fout<<FusCvrStr[CRV_SIDE_CONT]<<"\t\t"<<FusCvrTypeStr[Fuselage.Params.SideCvr.Type]<<" ";
2582 if( Fuselage.Params.SideCvr.Type == ELLIPSE )
2583 {
2584 fout<<Fuselage.Params.SideCvr.Ellipse.L<<" ";
2585 fout<<Fuselage.Params.SideCvr.Ellipse.H<<" ";
2588 }
2589 else
2590 {
2593 //fout<<" "<<AirfoilTypeStr[Fuselage.Params.SideCvr.Airfoil.iType];
2594 //if( Fuselage.Params.SideCvr.Airfoil.iType == AIRFOIL_FILE )
2595 // fout<<" "<<Fuselage.Params.SideCvr.Airfoil.Name<<endl;
2596 //else
2597 // fout<<" "<<GetNACANoAsString( Fuselage.Params.SideCvr.Airfoil.NACAnumber)<<endl;
2598 }
2599 //down contour
2600 fout<<FusCvrStr[CRV_DOWN_CONT]<<"\t\t"<<FusCvrTypeStr[Fuselage.Params.DownCvr.Type]<<" ";
2601 if( Fuselage.Params.DownCvr.Type == ELLIPSE )
2602 {
2603 fout<<Fuselage.Params.DownCvr.Ellipse.L<<" ";
2604 fout<<Fuselage.Params.DownCvr.Ellipse.H<<" ";
2607 }
2608 else
2609 {
2612 //fout<<" "<<AirfoilTypeStr[Fuselage.Params.DownCvr.Airfoil.iType];
2613 //if( Fuselage.Params.DownCvr.Airfoil.iType == AIRFOIL_FILE )
2614 // fout<<" "<<Fuselage.Params.DownCvr.Airfoil.Name<<endl;
2615 //else
2616 // fout<<" "<<GetNACANoAsString( Fuselage.Params.DownCvr.Airfoil.NACAnumber)<<endl;
2617 }
2618
2619 //convexity factor up
2620 fout<<FusCvrStr[CRV_CV_FACT_UP]<<"\t\t"<<FusCvrTypeStr[Fuselage.Params.CvFactUp.Type]<<" ";
2621 if( Fuselage.Params.CvFactUp.Type == ELLIPSE )
2622 {
2623 fout<<Fuselage.Params.CvFactUp.Ellipse.L<<" ";
2624 fout<<Fuselage.Params.CvFactUp.Ellipse.H<<" ";
2627 }
2628 else if( Fuselage.Params.CvFactUp.Type == AIRFOIL )
2629 {
2632 //fout<<" "<<AirfoilTypeStr[Fuselage.Params.CvFactUp.Airfoil.iType];
2633 //if( Fuselage.Params.CvFactUp.Airfoil.iType == AIRFOIL_FILE )
2634 // fout<<" "<<Fuselage.Params.CvFactUp.Airfoil.Name<<endl;
2635 //else
2636 // fout<<" "<<GetNACANoAsString( Fuselage.Params.CvFactUp.Airfoil.NACAnumber)<<endl;
2637 }
2638 else
2639 {
2640 fout<<Fuselage.Params.CvFactUp.Factor<<endl;
2641 }
2642 //convexity factor down
2643 fout<<FusCvrStr[CRV_CV_FACT_DOWN]<<"\t"<<FusCvrTypeStr[Fuselage.Params.CvFactDown.Type]<<" ";
2644 if( Fuselage.Params.CvFactDown.Type == ELLIPSE )
2645 {
2646 fout<<Fuselage.Params.CvFactDown.Ellipse.L<<" ";
2647 fout<<Fuselage.Params.CvFactDown.Ellipse.H<<" ";
2650 }
2651 else if( Fuselage.Params.CvFactDown.Type == AIRFOIL )
2652 {
2655 //fout<<" "<<AirfoilTypeStr[Fuselage.Params.CvFactDown.Airfoil.iType];
2656 //if( Fuselage.Params.CvFactDown.Airfoil.iType == AIRFOIL_FILE )
2657 // fout<<" "<<Fuselage.Params.CvFactDown.Airfoil.Name<<endl;
2658 //else
2659 // fout<<" "<<GetNACANoAsString( Fuselage.Params.CvFactDown.Airfoil.NACAnumber)<<endl;
2660 }
2661 else
2662 {
2663 fout<<Fuselage.Params.CvFactDown.Factor<<endl;
2664 }
2665 }
2666
2667 //Additional user division
2668 if( !Fuselage.UserDiv.empty() )
2669 {
2670 fout<<Fuselage.UserDiv.size()<<endl;
2671 for( int i=0;i<(int)Fuselage.UserDiv.size();i++) fout<<Fuselage.UserDiv[i]<<" ";
2672 fout<<endl;
2673 }
2674 else
2675 fout<<0<<endl;
2676
2677 fout<<Fuselage.iDivSectionType<<"\t"<<Fuselage.iSecN<<endl;
2678
2679 }
2680 fout<<"end_fuselage"<<endl;
2681
2682 return true;
2683}
bool WriteProfile(std::ostream &fout, MS2_Profile airfoil)
writes airfoil data
Definition ms2data.cpp:2874

Referenced by Write().

◆ WriteGeneral()

bool MS2_Data::WriteGeneral ( std::ostream & f)

writes general data, incuding reference values

Definition at line 2407 of file ms2data.cpp.

2408{
2409 if( iVersion != CURRENT_VERSION ) iVersion = CURRENT_VERSION; //Always save as current version
2410 fout<<"# *****************************************"<<endl;
2411 fout<<"# * *"<<endl;
2412 fout<<"# * Automatically generated config file *"<<endl;
2413 fout<<"# * *"<<endl;
2414 fout<<"# *****************************************"<<endl;
2415 fout<<"#"<<endl;
2416 fout<<"/*"<<endl;
2417 fout<<"Each section in this file begins by keyword \"begin\" and ends by keyword \"end\"."<<endl;
2418 fout<<"Keyword \"begin\" could be extended (e.g. \"begin_wing0\") by name of section:"<<endl;
2419 fout<<"wing*, fuselage, connections, connections_V."<<endl;
2420 fout<<"In the main section reference values (up to row \"*****\")"<<endl;
2421 fout<<"can be omitted - then they will be computed using main wing section (section \"wing0\")."<<endl;
2422 fout<<"The geometry is defined in the axis system defined as follows:"<<endl;
2423 fout<<"\torigin in fuselage nose, leading edge point of main wing (in the symmetry plane),"<<endl;
2424 fout<<"\tit should be the most forward point of the aircraft body,"<<endl;
2425 fout<<"\taxis x - backward, usually longwise the Mean Aerodynamic Chord (MAC)"<<endl;
2426 fout<<"\taxis y - on the right wing,"<<endl;
2427 fout<<"\taxis z - up."<<endl;
2428// fout<<"The geometry should be defined to satisfy positive X coordinates for all aircraft body."<<endl;
2429 fout<<"*/"<<endl;
2430 fout<<endl;
2431 //version
2432 fout<<endl<<"#######################"<<endl;
2433 fout<<"/*"<<endl;
2434 fout<<"Version section (\"begin_version\")"<<endl;
2435 fout<<" version number"<<endl;
2436 fout<<" End of version section (\"end\")"<<endl;
2437 fout<<" */"<<endl;
2438 fout<<"#######################"<<endl<<endl;
2439 fout<<endl<<"begin_version"<<endl;
2440 fout<<iVersion<<endl;
2441 fout<<"end"<<endl;
2442 fout<<endl;
2443 fout<<endl<<"#######################"<<endl;
2444 fout<<"/*"<<endl;
2445 fout<<"Main section (\"begin\")"<<endl;
2446 fout<<"\treference area"<<endl;
2447 fout<<"\tMAC"<<endl;
2448 fout<<"\twing span"<<endl;
2449 fout<<"\tX coordinate of quarter of MAC (it is the point, which is the pole"<<endl;
2450 fout<<"\tZ coordinate of quarter of MAC for moments calculation)"<<endl;
2451 fout<<"\tscale coefficient"<<endl;
2452 fout<<"*****"<<endl;
2453 fout<<"\tname of the output grid file (without extension - default extension [.inp] will be added)"<<endl;
2454 fout<<"\tautomatic output file name flag"<<endl;
2455 fout<<"\t\t1 (default) output file name [.inp] based on ms2 file name"<<endl;
2456 fout<<"\t\t0 full pathname defined by user"<<endl;
2457 fout<<"\tnumber of wings with defined chord wise partition"<<endl;
2458 fout<<"\tnumber of wings without defined chord wise partition"<<endl;
2459 fout<<"\tsymmetry flag:"<<endl;
2460 fout<<"\t\t0 (default if flag doesn't exist) - symmetrical object"<<endl;
2461 fout<<"\t\t1 - right part"<<endl;
2462 fout<<"\t\t-1 - left part"<<endl;
2463 fout<<"\toutput type flag:"<<endl;
2464 fout<<"\t\t0 (default if flag doesn't exist) - mesh written as nodes"<<endl;
2465 fout<<"\t\t1 - mesh written as panels"<<endl;
2466 fout<<"The end of main section (\"end\")"<<endl;
2467 fout<<"*/"<<endl;
2468 fout<<"#######################"<<endl<<endl;;
2469 //begin main section
2470 fout<<endl<<"begin"<<endl;
2471
2472 fout.setf(ios::fixed,ios::floatfield);
2473 fout.precision(5);
2474
2475 if( !General.RefVal.AutoComp )
2476 {
2477 fout<<General.RefVal.S<<endl;
2478 fout<<General.RefVal.MAC<<endl;
2479 fout<<General.RefVal.B<<endl;
2480 fout<<General.RefVal.MX<<endl;
2481 fout<<General.RefVal.MZ<<endl;
2482 fout<<General.RefVal.Scale<<endl;
2483 fout<<"*****"<<endl;
2484 }
2485 else
2486 {
2487 fout<<"*****"<<endl;
2488 fout<<General.RefVal.Scale<<endl;
2489 fout<<"*****"<<endl;
2490 }
2491 fout<<General.InpFileName<<endl;
2492 fout<<General.AutoInpFileName<<endl;
2493// string inpFile( filename_name( General.InpFileName.c_str() ) );
2494// fout<<RemoveExt(inpFile)<<endl;
2495 fout<<GetIndpWingNo()<<endl;
2496 fout<<GetDpWingNo()<<endl;
2497 fout<<General.SymmOpt<<endl;
2498 fout<<General.OutOpt<<endl;
2499 fout<<"end"<<endl;
2500 return true;
2501}
int GetDpWingNo(void)
returns number of depedentend wings (SLAVE)
Definition ms2data.cpp:2923
int GetIndpWingNo(void)
returns number of indepedentend wings (MASTER & INDEPENDENT)
Definition ms2data.cpp:2913

Referenced by Write().

◆ WriteProfile()

bool MS2_Data::WriteProfile ( std::ostream & fout,
MS2_Profile airfoil )

writes airfoil data

Definition at line 2874 of file ms2data.cpp.

2875{
2876 fout << AirfoilTypeStr[airfoil.iType] << endl;
2877 if( airfoil.iType == AIRFOIL_FILE )
2878 fout << airfoil.Name << endl;
2879 if( airfoil.iType == AIRFOIL_NACA )
2880 fout << GetNACANoAsString( airfoil.NACAnumber) << endl;
2881 if( airfoil.iType == AIRFOIL_DATA )
2882 fout << airfoil.ShortName << endl;
2883 return true;
2884}

Referenced by WriteFuselage(), WriteSection(), WriteWing(), and WriteWingModule().

◆ WriteSection()

bool MS2_Data::WriteSection ( std::ostream & fout,
MS2_Section sect )

writes data of wing built from sections

Definition at line 2862 of file ms2data.cpp.

2863{
2864 //fout<<sect.Profil.Name<<endl; //airfoil
2865 WriteProfile( fout, sect.Profil );
2866 fout << sect.Chord << endl;
2867 fout << sect.X << "\t" << sect.Y << "\t" << sect.Z << endl;
2868 fout << sect.RotX << "\t" << sect.RotY << "\t" << sect.RotZ << endl;
2869 fout << sect.CtrlFlag << "\t" << sect.CoefPosFlag << "\n" << sect.Deflection << "\t" << sect.Hinge_X << "\t" << sect.Hinge_Z << endl;
2870 fout << sect.No << endl;
2871 return true;
2872}

Referenced by WriteWing().

◆ WriteWakes()

bool MS2_Data::WriteWakes ( std::ostream & fout,
bool bCom = true )

writes extra wake infos

Definition at line 2721 of file ms2data.cpp.

2722{
2723 if( bCom )
2724 {
2725 fout<<endl<<"#######################"<<endl;
2726 fout<<"/*"<<endl;
2727 fout<<"WAKE INFO section (\"begin_wake_info\")"<<endl;
2728 fout<<" number of defined wakes - IWake"<<endl;
2729 fout<<" definitions of successive wakes (IWake times)"<<endl;
2730 fout<<" type ( Horizontal, Vertical)"<<endl;
2731 fout<<" annotation"<<endl;
2732 fout<<" is section active ( 1- active, 2 - not active)"<<endl;
2733 fout<<" number of the 1st wing (from)"<<endl;
2734 fout<<" number of the 2nd wing (through)"<<endl;
2735 fout<<" number of wing 1 rib connected to wake"<<endl;
2736 fout<<" number of wing 2 rib connected to wake"<<endl;
2737 fout<<" wing 2 surface for wake modification (0-bottom or exterior, 1-top or interior)"<<endl;
2738 fout<<"End (\"end\")"<<endl;
2739 fout<<"*/"<<endl;
2740 fout<<"#######################"<<endl<<endl;
2741 }
2742
2743 fout<<endl<<"begin_wake_info"<<endl;
2744 fout<<Wakes.size()<<endl;
2745 for( int i=0;i < (int)Wakes.size();i++)
2746 {
2747 fout<<WakeTypeName(Wakes[i].Type)<<endl;
2748 fout<<Wakes[i].Name<<endl;
2749 fout<<Wakes[i].Active<<" ";
2750 fout<<Wakes[i].Wing1No<<" ";
2751 fout<<Wakes[i].Wing2No<<" ";
2752 fout<<Wakes[i].Wing1Rib<<" ";
2753 fout<<Wakes[i].Wing2Rib<<" ";
2754 fout<<Wakes[i].Wing2Surf<<" ";
2755 fout<<endl;
2756 }
2757 fout<<"end"<<endl;
2758 return true;
2759}

Referenced by Write().

◆ WriteWing()

bool MS2_Data::WriteWing ( std::ostream & fout,
MS2_Wing wing,
int no )

writes wing's data

Definition at line 2761 of file ms2data.cpp.

2762{
2763 bool res = true;
2764 fout<<endl<<"begin_wing"<<No<<endl;
2765 fout<<wing.Active<<endl;
2766 fout<<WingTypeStr[wing.Type]<<endl;
2767 fout<<wing.ID<<" "<<wing.Name<<endl;
2768 fout<<WingDivSourceStr[wing.DivSource]<<endl;
2769 fout<<wing.ComputeInt<<endl;
2770 fout<<wing.LongeronNo<<endl;
2771 fout<<wing.SmartBypass<<endl;
2772 fout<<wing.BypassDepth<<endl;
2773 fout<<WingSurfSideStr[wing.SurfType]<<endl;
2774 fout<<WingRibTypeStr[wing.RibType]<<endl;
2775 fout<<wing.TwistRef<<endl;
2776 fout<<wing.UseMunk<<endl;
2777 if( wing.UseMunk == 1 )
2778 {
2779 fout<<wing.SRef<<" "<<wing.CzDes<<endl;
2780 }
2781
2782
2783 if( wing.Type == WING_TYPE_SECTIONS )
2784 {
2785 fout<<wing.Sec.Sections.size()<<endl;
2786 fout<<wing.Sec.DivType<<endl;
2787
2788 for( int i=0;i < (int)wing.Sec.Sections.size(); i++ )
2789 res *= WriteSection( fout, wing.Sec.Sections[i] );
2790 }
2791 else if( wing.Type == WING_TYPE_MODULES)
2792 {
2793 fout<<wing.Mod.Modules.size()<<endl;
2794 for( int i=0; i<(int)wing.Mod.Modules.size();i++ )
2795 {
2796 res *= WriteWingModule( fout, wing.Mod.Modules[i] );
2797 }
2798 }
2799 else if( wing.Type == WING_TYPE_NACELLE )
2800 {
2801 MS2_NacelleWing nac = wing.Nac;
2802 //fout<<nac.Profil.Name.c_str()<<endl;
2803 WriteProfile( fout, nac.Profil );
2804 fout<<nac.X0<<" "<<nac.Y0<<" "<<nac.Z0<<endl;
2805 fout<<nac.fi<<" "<<nac.theta<<" "<<nac.psi<<endl;
2806 fout<<nac.L<<" "<<nac.CvFactUp<<" "<<nac.CvFactDown<<endl;
2807 fout<<nac.Y<<" "<<nac.ZUp<<" "<<nac.ZDown<<endl;
2808 fout<<nac.NUp<<" "<<nac.NDown<<endl;
2809 fout<<NacelleSwirlStr[nac.SwirlType]<<" "<<NacelleRangeStr[nac.SwirlRange]<<endl;
2810 }
2811
2812 //chord division
2813 if( wing.DivType != DT_USER )
2814 {
2815 fout<<WingSectionDivStr[wing.DivType]<<" ";
2816 if( wing.DivType == DT_LINEAR || wing.DivType == DT_COSINE )
2817 fout<<wing.DivNo;
2818 fout<<endl;
2819 }
2820 else
2821 {
2822 for( int i=0;i<(int)wing.UserDiv.size();i++ ) fout<<wing.UserDiv[i]<<" ";
2823 fout<<endl;
2824 }
2825
2826 fout<<"end_wing"<<endl;
2827
2828 return res;
2829}
bool WriteWingModule(std::ostream &fout, MS2_ModWingModule mod)
writes modular wing's data
Definition ms2data.cpp:2831
bool WriteSection(std::ostream &fout, MS2_Section sect)
writes data of wing built from sections
Definition ms2data.cpp:2862

Referenced by Write().

◆ WriteWingModule()

bool MS2_Data::WriteWingModule ( std::ostream & fout,
MS2_ModWingModule mod )

writes modular wing's data

Definition at line 2831 of file ms2data.cpp.

2832{
2833 fout<<WingModTypeStr[mod.Type]<<"\t";
2834 fout<<mod.C<<"\t"<<mod.Alfa<<"\t";
2835 if( mod.Type == WING_MOD_TYPE_ROOT )
2836 {
2837 fout<<mod.XRef<<"\t"<<mod.X0<<"\t"<<mod.Y0<<"\t"<<mod.Z0<<"\t";
2838 }
2839 else if( mod.Type == WING_MOD_TYPE_EQUI_LINE )
2840 {
2841 fout<<mod.Fi<<"\t"<<mod.Gamma<<"\t"<<mod.N<<"\t"<<mod.NDist<<"\t"<<mod.L<<"\t"<<mod.R<<"\t"<<mod.UseMunk<<"\t";
2842 fout<<WingModPanConcStr[(int)mod.SpanPanConc]<<"\t";
2843 }
2844 else if( mod.Type == WING_MOD_TYPE_LINE )
2845 {
2846 fout<<mod.Fi<<"\t"<<mod.Gamma<<"\t"<<mod.N<<"\t"<<mod.NDist<<"\t"<<mod.L<<"\t"<<mod.R<<"\t"<<mod.UseMunk<<"\t";
2847 fout<<WingModPanConcStr[(int)mod.SpanPanConc]<<"\t";
2848 }
2849 else if( mod.Type == WING_MOD_TYPE_ARC )
2850 {
2851 fout<<mod.Fi<<"\t"<<mod.Gamma<<"\t"<<mod.N<<"\t"<<mod.NDist<<"\t"<<mod.R<<"\t"<<mod.UseMunk<<"\t";
2852 fout<<WingModPanConcStr[(int)mod.SpanPanConc]<<"\t";
2853 }
2854 else
2855 return false;
2856
2857 //fout<<mod.Profil.Name.c_str()<<endl;
2858 WriteProfile( fout, mod.Profil );
2859
2860 return true;
2861}

Referenced by WriteWing().

Member Data Documentation

◆ AirfoilTypeStr

map< int, const char * > MS2_Data::AirfoilTypeStr = CreateAirfoilTypeStr()
staticprotected

file, NACA, table

Definition at line 44 of file ms2data.h.

Referenced by ReadFusAirfoil(), ReadProfile(), and WriteProfile().

◆ cComment

char MS2_Data::cComment[256]
protected

message text in case of error

Definition at line 41 of file ms2data.h.

Referenced by Comment(), Read(), ReadChordDivision(), ReadFusAirfoil(), ReadFusFromParams(), ReadProfile(), ReadWing(), ReadWingModule(), and Write().

◆ CURRENT_VERSION

const int MS2_Data::CURRENT_VERSION = 55
staticprotected

current version of ms2data module

Definition at line 39 of file ms2data.h.

Referenced by Read(), SetDefaults(), and WriteGeneral().

◆ FusAirfoilSide

map< int, const char * > MS2_Data::FusAirfoilSide = CreateFusAirfoilSide()
staticprotected

up , down

Definition at line 49 of file ms2data.h.

Referenced by ReadFusAirfoil(), and WriteFuselage().

◆ FusCvrStr

map< int, const char * > MS2_Data::FusCvrStr = CreateFusCvrStr()
staticprotected

spine, up cvr etc.

Definition at line 47 of file ms2data.h.

Referenced by ReadFusFromParams(), and WriteFuselage().

◆ FusCvrTypeStr

map< int, const char * > MS2_Data::FusCvrTypeStr = CreateFusCvrTypeStr()
staticprotected

ellipse, airfoil etc.

Definition at line 48 of file ms2data.h.

Referenced by ReadFusFromParams(), and WriteFuselage().

◆ FusTypeStr

map< int, const char * > MS2_Data::FusTypeStr = CreateFusTypeStr()
staticprotected

file, parameters

Definition at line 46 of file ms2data.h.

Referenced by Read(), and WriteFuselage().

◆ iVersion

int MS2_Data::iVersion
protected

◆ NacelleRangeStr

map< int, const char * > MS2_Data::NacelleRangeStr = CreateNacelleRangeStr()
staticprotected

swirl range: full, half

Definition at line 59 of file ms2data.h.

Referenced by ReadWing(), and WriteWing().

◆ NacelleSwirlStr

map< int, const char * > MS2_Data::NacelleSwirlStr = CreateNacelleSwirlStr()
staticprotected

swirl up, swirl down

Definition at line 58 of file ms2data.h.

Referenced by ReadWing(), and WriteWing().

◆ WingDivSourceStr

map< int, const char * > MS2_Data::WingDivSourceStr = CreateWingDivSourceStr()
staticprotected

master, slave

Definition at line 54 of file ms2data.h.

Referenced by ReadChordDivision(), ReadWing(), Write(), and WriteWing().

◆ WingModPanConcStr

map< int, const char * > MS2_Data::WingModPanConcStr = CreateWingModConcStr()
staticprotected

paneling distribution in module wings modules ( left, right center )

Definition at line 53 of file ms2data.h.

Referenced by ReadWingModule(), and WriteWingModule().

◆ WingModTypeStr

map< int, const char * > MS2_Data::WingModTypeStr = CreateWingModTypeStr()
staticprotected

root, equi line, arc, line

Definition at line 52 of file ms2data.h.

Referenced by ReadWingModule(), and WriteWingModule().

◆ WingRibTypeStr

map< int, const char * > MS2_Data::WingRibTypeStr = CreateWingRibTypeStr()
staticprotected

open, external, both

Definition at line 56 of file ms2data.h.

Referenced by ReadWing(), Write(), and WriteWing().

◆ WingSectionDivStr

map< int, const char * > MS2_Data::WingSectionDivStr = CreateWingSectionDivStr()
staticprotected

linear, cosine etc.

Definition at line 57 of file ms2data.h.

Referenced by DivTypeName(), ReadChordDivision(), and WriteWing().

◆ WingSurfSideStr

map< int, const char * > MS2_Data::WingSurfSideStr = CreateWingSurfSideStr()
staticprotected

all, top, bottom

Definition at line 55 of file ms2data.h.

Referenced by ReadWing(), WingSurfName(), Write(), and WriteWing().

◆ WingTypeStr

map< int, const char * > MS2_Data::WingTypeStr = CreateWingTypeStr()
staticprotected

sections, modules, nacelle

Definition at line 51 of file ms2data.h.

Referenced by ReadWing(), Write(), and WriteWing().


The documentation for this class was generated from the following files: