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

Simple output file of Press program: reference values, aerodynamic coefficients, flow parameters. More...

#include <sdsa_file.h>

Inheritance diagram for SDSA_FILE:
IOFUN

Public Member Functions

void Clean (void)
 cleans local variables
 
void SetName (const char *FileName)
 set pathname for the [.sdsa] file
 
int Read (const char *FileName)
 reads the [.sdsa] file
 
int Read (void)
 reads the [.sdsa] file defined by SetName function
 
int Write (const char *FileName)
 writes the [.sdsa] file
 
int Write (void)
 writes the [.sdsa] file defined by SetName function
 

Public Attributes

double S
 reference area
 
double MAC
 mean aerodynamic chord
 
double B
 reference wingspan
 
double Swet
 wetted area
 
double X
 X coordinate fo the origin for moment components.
 
double Z
 Z coordinate fo the origin for moment components.
 
double Alfa
 angle of attack [deg]
 
double Beta
 sideslip angle [deg]
 
double Mach
 Mach number.
 
double P
 roll rate [rad/s]
 
double Q
 pitch rate [rad/s]
 
double R
 yaw rate [rad/s]
 
double Cx
 drag coefficient (body axis system - pressure component)
 
double Cy
 sideforce coefficient (body axis system)
 
double Cz
 lift coefficient (body axis system)
 
double Cl
 rolling moment coefficient (body axis system)
 
double Cm
 pitching moment coefficient (body axis system)
 
double Cn
 yawing moment coefficient (body axis system)
 
double Cxs
 drag coefficient (stability axis system - pressure component)
 
double Cys
 sideforce coefficient (stability axis system)
 
double Czs
 lift coefficient (stability axis system)
 
double Cls
 rolling moment coefficient (stability axis system)
 
double Cms
 pitching moment coefficient (stability axis system)
 
double Cns
 yawing moment coefficient (stability axis system)
 
double Cxi
 induced drag coefficient
 
double Czi
 lift coefficients that relates to induced drag
 

Additional Inherited Members

- 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.
 

Detailed Description

Simple output file of Press program: reference values, aerodynamic coefficients, flow parameters.

Definition at line 27 of file sdsa_file.h.

Constructor & Destructor Documentation

◆ SDSA_FILE()

SDSA_FILE::SDSA_FILE ( void )

Definition at line 22 of file sdsa_file.cpp.

22{ Clean(); }
void Clean(void)
cleans local variables
Definition sdsa_file.cpp:26

◆ ~SDSA_FILE()

SDSA_FILE::~SDSA_FILE ( void )

Definition at line 24 of file sdsa_file.cpp.

24{}

Member Function Documentation

◆ Clean()

void SDSA_FILE::Clean ( void )

cleans local variables

Definition at line 26 of file sdsa_file.cpp.

27{
28 S = B = MAC = Swet = 0.0;
29 X = Z = 0.0;
30 Alfa = Beta = Mach = 0.0;
31 P = Q = R = 0.0;
32 Cx = Cy = Cz = Cl = Cm = Cn = 0.0;
33 Cxs = Cys = Czs = Cls = Cms = Cns = 0.0;
34 Cxi = Czi = 0.0;
35
36 file_flag = 0;
37}
double B
reference wingspan
Definition sdsa_file.h:36
double R
yaw rate [rad/s]
Definition sdsa_file.h:45
double Mach
Mach number.
Definition sdsa_file.h:42
double Cxi
induced drag coefficient
Definition sdsa_file.h:58
double S
reference area
Definition sdsa_file.h:34
double Z
Z coordinate fo the origin for moment components.
Definition sdsa_file.h:39
double Cls
rolling moment coefficient (stability axis system)
Definition sdsa_file.h:55
double Cxs
drag coefficient (stability axis system - pressure component)
Definition sdsa_file.h:52
double Cx
drag coefficient (body axis system - pressure component)
Definition sdsa_file.h:46
double Cl
rolling moment coefficient (body axis system)
Definition sdsa_file.h:49
double Swet
wetted area
Definition sdsa_file.h:37
double Czi
lift coefficients that relates to induced drag
Definition sdsa_file.h:59
double Cys
sideforce coefficient (stability axis system)
Definition sdsa_file.h:53
double X
X coordinate fo the origin for moment components.
Definition sdsa_file.h:38
double Cns
yawing moment coefficient (stability axis system)
Definition sdsa_file.h:57
double Beta
sideslip angle [deg]
Definition sdsa_file.h:41
double Cz
lift coefficient (body axis system)
Definition sdsa_file.h:48
double Cn
yawing moment coefficient (body axis system)
Definition sdsa_file.h:51
double P
roll rate [rad/s]
Definition sdsa_file.h:43
double Cms
pitching moment coefficient (stability axis system)
Definition sdsa_file.h:56
double MAC
mean aerodynamic chord
Definition sdsa_file.h:35
double Q
pitch rate [rad/s]
Definition sdsa_file.h:44
double Cm
pitching moment coefficient (body axis system)
Definition sdsa_file.h:50
double Cy
sideforce coefficient (body axis system)
Definition sdsa_file.h:47
double Czs
lift coefficient (stability axis system)
Definition sdsa_file.h:54
double Alfa
angle of attack [deg]
Definition sdsa_file.h:40

◆ Read() [1/2]

int SDSA_FILE::Read ( const char * FileName)

reads the [.sdsa] file

Definition at line 45 of file sdsa_file.cpp.

46{
47 FILE *File;
48 File = fopen( SDSA_file, "r" );
49 if( File == NULL )
50 {
51 fprintf( stderr, "[.sdsa] file open error to reading (%s)\n", SDSA_file );
52 return (-1);
53 }
54
55 ReadPar( File, "%lf", &S );
56 ReadPar( File, "%lf", &MAC );
57 ReadPar( File, "%lf", &B );
58 ReadPar( File, "%lf", &Swet );
59 ReadPar( File, "%lf %lf", &X, &Z );
60 ReadPar( File, "%lf", &Alfa );
61 ReadPar( File, "%lf", &Beta );
62 ReadPar( File, "%lf", &Mach );
63 ReadPar( File, "%lf", &P );
64 ReadPar( File, "%lf", &Q );
65 ReadPar( File, "%lf", &R );
66 ReadPar( File, "%lf", &Cx );
67 ReadPar( File, "%lf", &Cy );
68 ReadPar( File, "%lf", &Cz );
69 ReadPar( File, "%lf", &Cl );
70 ReadPar( File, "%lf", &Cm );
71 ReadPar( File, "%lf", &Cn );
72 ReadPar( File, "%lf", &Cxs );
73 ReadPar( File, "%lf", &Cys );
74 ReadPar( File, "%lf", &Czs );
75 ReadPar( File, "%lf", &Cls );
76 ReadPar( File, "%lf", &Cms );
77 ReadPar( File, "%lf", &Cns );
78 ReadPar( File, "%lf", &Cxi );
79 ReadPar( File, "%lf", &Czi );
80
81 fclose( File );
82
83 return 0;
84}
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 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

◆ Read() [2/2]

int SDSA_FILE::Read ( void )

reads the [.sdsa] file defined by SetName function

Definition at line 86 of file sdsa_file.cpp.

87{
88 if( file_flag == 0 )return -1;
89 return Read( file_name );
90}
int Read(void)
reads the [.sdsa] file defined by SetName function
Definition sdsa_file.cpp:86

Referenced by Read().

◆ SetName()

void SDSA_FILE::SetName ( const char * FileName)

set pathname for the [.sdsa] file

Definition at line 39 of file sdsa_file.cpp.

40{
41 strcpy( file_name, SDSA_file );
42 file_flag = 1;
43}

◆ Write() [1/2]

int SDSA_FILE::Write ( const char * FileName)

writes the [.sdsa] file

Definition at line 92 of file sdsa_file.cpp.

93{
94 FILE *File;
95 File = fopen( SDSA_file, "w" );
96 if( File == NULL )
97 {
98 fprintf( stderr, "[.sdsa] file open error to writing (%s)\n", SDSA_file );
99 return (-1);
100 }
101
102 fprintf( File, "%14.8G # S\n", S );
103 fprintf( File, "%14.8G # MAC\n", MAC );
104 fprintf( File, "%14.8G # B\n", B );
105 fprintf( File, "%14.8G # Swet\n", Swet );
106 fprintf( File, "%14.8G %f # X,Y (ref)\n", X, Z );
107 fprintf( File, "%14.8G # Alfa\n", Alfa );
108 fprintf( File, "%14.8G # Beta\n", Beta );
109 fprintf( File, "%14.8G # Mach\n", Mach );
110 fprintf( File, "%14.8G # P\n", P );
111 fprintf( File, "%14.8G # Q\n", Q );
112 fprintf( File, "%14.8G # R\n", R );
113 fprintf( File, "%14.8G # Cx\n", Cx );
114 fprintf( File, "%14.8G # Cy\n", Cy );
115 fprintf( File, "%14.8G # Cz\n", Cz );
116 fprintf( File, "%14.8G # Cl\n", Cl );
117 fprintf( File, "%14.8G # Cm\n", Cm );
118 fprintf( File, "%14.8G # Cn\n", Cn );
119 fprintf( File, "%14.8G # Cxs\n", Cxs );
120 fprintf( File, "%14.8G # Cys\n", Cys );
121 fprintf( File, "%14.8G # Czs\n", Czs );
122 fprintf( File, "%14.8G # Cls\n", Cls );
123 fprintf( File, "%14.8G # Cms\n", Cms );
124 fprintf( File, "%14.8G # Cns\n", Cns );
125 fprintf( File, "%14.8G # Cxi\n", Cxi );
126 fprintf( File, "%14.8G # Czi\n", Czi );
127
128 fclose( File );
129
130 return 0;
131}

◆ Write() [2/2]

int SDSA_FILE::Write ( void )

writes the [.sdsa] file defined by SetName function

Definition at line 133 of file sdsa_file.cpp.

134{
135 if( file_flag == 0 )return -1;
136 return Write( file_name );
137}
int Write(void)
writes the [.sdsa] file defined by SetName function

Referenced by Write().

Member Data Documentation

◆ Alfa

double SDSA_FILE::Alfa

angle of attack [deg]

Definition at line 40 of file sdsa_file.h.

Referenced by Clean(), Read(), and Write().

◆ B

double SDSA_FILE::B

reference wingspan

Definition at line 36 of file sdsa_file.h.

Referenced by Clean(), Read(), and Write().

◆ Beta

double SDSA_FILE::Beta

sideslip angle [deg]

Definition at line 41 of file sdsa_file.h.

Referenced by Clean(), Read(), and Write().

◆ Cl

double SDSA_FILE::Cl

rolling moment coefficient (body axis system)

Definition at line 49 of file sdsa_file.h.

Referenced by Clean(), Read(), and Write().

◆ Cls

double SDSA_FILE::Cls

rolling moment coefficient (stability axis system)

Definition at line 55 of file sdsa_file.h.

Referenced by Clean(), Read(), and Write().

◆ Cm

double SDSA_FILE::Cm

pitching moment coefficient (body axis system)

Definition at line 50 of file sdsa_file.h.

Referenced by Clean(), Read(), and Write().

◆ Cms

double SDSA_FILE::Cms

pitching moment coefficient (stability axis system)

Definition at line 56 of file sdsa_file.h.

Referenced by Clean(), Read(), and Write().

◆ Cn

double SDSA_FILE::Cn

yawing moment coefficient (body axis system)

Definition at line 51 of file sdsa_file.h.

Referenced by Clean(), Read(), and Write().

◆ Cns

double SDSA_FILE::Cns

yawing moment coefficient (stability axis system)

Definition at line 57 of file sdsa_file.h.

Referenced by Clean(), Read(), and Write().

◆ Cx

double SDSA_FILE::Cx

drag coefficient (body axis system - pressure component)

Definition at line 46 of file sdsa_file.h.

Referenced by Clean(), Read(), and Write().

◆ Cxi

double SDSA_FILE::Cxi

induced drag coefficient

Definition at line 58 of file sdsa_file.h.

Referenced by Clean(), Read(), and Write().

◆ Cxs

double SDSA_FILE::Cxs

drag coefficient (stability axis system - pressure component)

Definition at line 52 of file sdsa_file.h.

Referenced by Clean(), Read(), and Write().

◆ Cy

double SDSA_FILE::Cy

sideforce coefficient (body axis system)

Definition at line 47 of file sdsa_file.h.

Referenced by Clean(), Read(), and Write().

◆ Cys

double SDSA_FILE::Cys

sideforce coefficient (stability axis system)

Definition at line 53 of file sdsa_file.h.

Referenced by Clean(), Read(), and Write().

◆ Cz

double SDSA_FILE::Cz

lift coefficient (body axis system)

Definition at line 48 of file sdsa_file.h.

Referenced by Clean(), Read(), and Write().

◆ Czi

double SDSA_FILE::Czi

lift coefficients that relates to induced drag

Definition at line 59 of file sdsa_file.h.

Referenced by Clean(), Read(), and Write().

◆ Czs

double SDSA_FILE::Czs

lift coefficient (stability axis system)

Definition at line 54 of file sdsa_file.h.

Referenced by Clean(), Read(), and Write().

◆ MAC

double SDSA_FILE::MAC

mean aerodynamic chord

Definition at line 35 of file sdsa_file.h.

Referenced by Clean(), Read(), and Write().

◆ Mach

double SDSA_FILE::Mach

Mach number.

Definition at line 42 of file sdsa_file.h.

Referenced by Clean(), Read(), and Write().

◆ P

double SDSA_FILE::P

roll rate [rad/s]

Definition at line 43 of file sdsa_file.h.

Referenced by Clean(), Read(), and Write().

◆ Q

double SDSA_FILE::Q

pitch rate [rad/s]

Definition at line 44 of file sdsa_file.h.

Referenced by Clean(), Read(), and Write().

◆ R

double SDSA_FILE::R

yaw rate [rad/s]

Definition at line 45 of file sdsa_file.h.

Referenced by Clean(), Read(), and Write().

◆ S

double SDSA_FILE::S

reference area

Definition at line 34 of file sdsa_file.h.

Referenced by Clean(), Read(), and Write().

◆ Swet

double SDSA_FILE::Swet

wetted area

Definition at line 37 of file sdsa_file.h.

Referenced by Clean(), Read(), and Write().

◆ X

double SDSA_FILE::X

X coordinate fo the origin for moment components.

Definition at line 38 of file sdsa_file.h.

Referenced by Clean(), Read(), and Write().

◆ Z

double SDSA_FILE::Z

Z coordinate fo the origin for moment components.

Definition at line 39 of file sdsa_file.h.

Referenced by Clean(), Read(), and Write().


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