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

Parameters file for PanProject program - creates POLAR for particular A/C configuration (grid+wake file) More...

#include <panukl_plr.h>

Inheritance diagram for PANUKL_PLR:
IOFUN

Public Member Functions

void Clean ()
 cleans local variables
 
int Read (char *PolarFile)
 reads the [.plr] file
 
int Write (char *PolarFile)
 writes the [.plr] file
 

Public Attributes

char POLAR_dir [256]
 path name for output - aerodynamic data files to create POLAR
 
double dAlfa0
 left (lower) bound of angle of attack [deg]
 
double dAlfak
 right (upper) bound of angle of attack [deg]
 
double dAlf
 step of angle of attack [deg]
 
double dMa
 Mach number.
 
double dCfe
 parasite drag coefficient
 
char DAT_file [256]
 data (grid+wake) file [.DAT] for A/C configuration
 
char OUT_file [256]
 output polar file [.TXT]
 
int iCompress
 compressibility flag (0-none, 1-Prandtl-Galuert, 2-Karman-Tsien, 3-direct)
 
int iMaxProc
 max number of parallel process (shouldn't be greater than real number of CPUs (cores)
 
int iProc
 current number of CPUs (cores) - set by program
 
int iNum1
 number of the first panel taken for global coefficients calculation
 
int iNum2
 number of the last panel taken for global coefficients calculation
 
int iMeth
 number of differentiation method (see PANUKL manual)
 
int iAngle
 averaging flag (0/1)
 
int iPitchX
 flag to take X component of forces for pitching moment calculation(0/1)
 
double dXNum1
 lower bound of range of X coordinate taken for global coefficients calculation
 
double dXNum2
 upper bound of range of X coordinate taken for global coefficients calculation

 

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

Parameters file for PanProject program - creates POLAR for particular A/C configuration (grid+wake file)

Definition at line 27 of file panukl_plr.h.

Constructor & Destructor Documentation

◆ PANUKL_PLR()

PANUKL_PLR::PANUKL_PLR ( void )

Definition at line 23 of file panukl_plr.cpp.

23{ Clean(); }
void Clean()
cleans local variables

◆ ~PANUKL_PLR()

PANUKL_PLR::~PANUKL_PLR ( void )

Definition at line 25 of file panukl_plr.cpp.

25{}

Member Function Documentation

◆ Clean()

void PANUKL_PLR::Clean ( void )

cleans local variables

Definition at line 27 of file panukl_plr.cpp.

28{
29 memset( POLAR_dir, 0, 256 );
30 memset( DAT_file, 0, 256 );
31 memset( OUT_file, 0, 256 );
32
33 dAlfa0 = dAlfak = dAlf = 0.0;
34 dMa = 0.0;
35 iNum1 = iNum2 = 0;
36 iProc = 0;
37 iMeth = 0;
38 iAngle = 0;
39 iCompress = 0;
40 iPitchX = 0;
41 dXNum1 = dXNum2 = 0.0;
42 dCfe = 0.0;
43 iMaxProc = 0;
44}
double dXNum2
upper bound of range of X coordinate taken for global coefficients calculation
Definition panukl_plr.h:54
char POLAR_dir[256]
path name for output - aerodynamic data files to create POLAR
Definition panukl_plr.h:31
int iProc
current number of CPUs (cores) - set by program
Definition panukl_plr.h:45
char DAT_file[256]
data (grid+wake) file [.DAT] for A/C configuration
Definition panukl_plr.h:40
double dAlf
step of angle of attack [deg]
Definition panukl_plr.h:35
int iAngle
averaging flag (0/1)
Definition panukl_plr.h:50
int iPitchX
flag to take X component of forces for pitching moment calculation(0/1)
Definition panukl_plr.h:51
int iMeth
number of differentiation method (see PANUKL manual)
Definition panukl_plr.h:49
double dMa
Mach number.
Definition panukl_plr.h:36
double dXNum1
lower bound of range of X coordinate taken for global coefficients calculation
Definition panukl_plr.h:53
int iNum2
number of the last panel taken for global coefficients calculation
Definition panukl_plr.h:48
double dCfe
parasite drag coefficient
Definition panukl_plr.h:38
int iCompress
compressibility flag (0-none, 1-Prandtl-Galuert, 2-Karman-Tsien, 3-direct)
Definition panukl_plr.h:43
double dAlfa0
left (lower) bound of angle of attack [deg]
Definition panukl_plr.h:33
double dAlfak
right (upper) bound of angle of attack [deg]
Definition panukl_plr.h:34
int iMaxProc
max number of parallel process (shouldn't be greater than real number of CPUs (cores)
Definition panukl_plr.h:44
char OUT_file[256]
output polar file [.TXT]
Definition panukl_plr.h:41
int iNum1
number of the first panel taken for global coefficients calculation
Definition panukl_plr.h:47

◆ Read()

int PANUKL_PLR::Read ( char * PolarFile)

reads the [.plr] file

Definition at line 46 of file panukl_plr.cpp.

47{
48 FILE *File;
49 File = fopen( PolarFile, "r" );
50 if( File == NULL )
51 {
52 fprintf( stderr, "[.PLR] file open error to reading (%s)\n", PolarFile );
53 return (-1);
54 }
55
56 ReadComm( File );
57 ReadStr( File, POLAR_dir );
58 ReadStr( File, DAT_file );
59 ReadStr( File, OUT_file );
60 ReadPar( File, "%lf %lf %lf", &dAlfa0, &dAlfak, &dAlf );
61 ReadPar( File, "%lf", &dMa );
62
63 ReadPar( File, "%d", &iProc );
64
65 ReadPar( File, "%d %d", &iNum1, &iNum2 );
66 ReadPar( File, "%d", &iMeth );
67 ReadPar( File, "%d", &iAngle );
68 ReadPar( File, "%lf %lf", &dXNum1, &dXNum2 );
69 ReadPar( File, "%d", &iCompress );
70 ReadPar( File, "%d", &iPitchX );
71
72 ReadPar( File, "%lf", &dCfe );
73
74 ReadPar( File, "%d", &iMaxProc );
75
76 fclose( File );
77
81
82 iMaxProc = iMaxProc > 64 ? 64 : iMaxProc;
83 iMaxProc = iMaxProc < 1 ? 1 : iMaxProc;
84
85 return (0);
86}
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 ClipFileName(char *string)
Clipping of the ending blanc characters of "string".
Definition iofun.cpp:250
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 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 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

◆ Write()

int PANUKL_PLR::Write ( char * PolarFile)

writes the [.plr] file

Definition at line 88 of file panukl_plr.cpp.

89{
90 FILE *File;
91 File = fopen( PolarFile, "w" );
92 if( File == NULL )
93 {
94 fprintf( stderr, "[.PLR] file open error to writing (%s)\n", PolarFile );
95 return (-1);
96 }
97
98 fprintf( File, "# Panukl -> POLAR configuration file\n");
99 fprintf( File, "%s # POLAR output directory\n", POLAR_dir );
100 fprintf( File, "%s # data (grid+wake) file [.dat] for A/C configuration\n", DAT_file );
101 fprintf( File, "%s # output polar file [.TXT]\n", OUT_file );
102
103 fprintf( File, "%7.3f %7.3f %7.3f # Alfa0, Alfa1, dA - angle of attack sequence [deg]\n", dAlfa0, dAlfak, dAlf );
104 fprintf( File, "%7.3f # Mach number \n", dMa );
105
106 fprintf( File, "%3d # type of linear system solver (1-LAPACK OPTIMIZED, 0-NOT OPTIMIZED)\n", iProc );
107
108 fprintf( File, "%d %d # range of panel's indices for pressure calculation\n", iNum1, iNum2 );
109 fprintf( File, "%3d # number of differentiation method\n", iMeth );
110 fprintf( File, "%3d # averaging flag\n", iAngle );
111 fprintf( File, "%6.2f %6.2f # range of X coordinates for pressure calculation\n", dXNum1, dXNum2 );
112 fprintf( File, "%3d # compressibility flag (0-none, 1-PG, 2-KT, 3-direct)\n", iCompress );
113 fprintf( File, "%3d # X component of pressure in pitching moment\n", iPitchX );
114
115 fprintf( File, "%10.6f # Cfe - equivalent parasite drag\n", dCfe );
116
117 fprintf( File, "%3d # max number of parallel process\n", iMaxProc );
118
119 fclose( File );
120
121 return (0);
122}

Member Data Documentation

◆ dAlf

double PANUKL_PLR::dAlf

step of angle of attack [deg]

Definition at line 35 of file panukl_plr.h.

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

◆ dAlfa0

double PANUKL_PLR::dAlfa0

left (lower) bound of angle of attack [deg]

Definition at line 33 of file panukl_plr.h.

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

◆ dAlfak

double PANUKL_PLR::dAlfak

right (upper) bound of angle of attack [deg]

Definition at line 34 of file panukl_plr.h.

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

◆ DAT_file

char PANUKL_PLR::DAT_file[256]

data (grid+wake) file [.DAT] for A/C configuration

Definition at line 40 of file panukl_plr.h.

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

◆ dCfe

double PANUKL_PLR::dCfe

parasite drag coefficient

Definition at line 38 of file panukl_plr.h.

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

◆ dMa

double PANUKL_PLR::dMa

Mach number.

Definition at line 36 of file panukl_plr.h.

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

◆ dXNum1

double PANUKL_PLR::dXNum1

lower bound of range of X coordinate taken for global coefficients calculation

Definition at line 53 of file panukl_plr.h.

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

◆ dXNum2

double PANUKL_PLR::dXNum2

upper bound of range of X coordinate taken for global coefficients calculation

Definition at line 54 of file panukl_plr.h.

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

◆ iAngle

int PANUKL_PLR::iAngle

averaging flag (0/1)

Definition at line 50 of file panukl_plr.h.

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

◆ iCompress

int PANUKL_PLR::iCompress

compressibility flag (0-none, 1-Prandtl-Galuert, 2-Karman-Tsien, 3-direct)

Definition at line 43 of file panukl_plr.h.

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

◆ iMaxProc

int PANUKL_PLR::iMaxProc

max number of parallel process (shouldn't be greater than real number of CPUs (cores)

Definition at line 44 of file panukl_plr.h.

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

◆ iMeth

int PANUKL_PLR::iMeth

number of differentiation method (see PANUKL manual)

Definition at line 49 of file panukl_plr.h.

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

◆ iNum1

int PANUKL_PLR::iNum1

number of the first panel taken for global coefficients calculation

Definition at line 47 of file panukl_plr.h.

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

◆ iNum2

int PANUKL_PLR::iNum2

number of the last panel taken for global coefficients calculation

Definition at line 48 of file panukl_plr.h.

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

◆ iPitchX

int PANUKL_PLR::iPitchX

flag to take X component of forces for pitching moment calculation(0/1)

Definition at line 51 of file panukl_plr.h.

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

◆ iProc

int PANUKL_PLR::iProc

current number of CPUs (cores) - set by program

Definition at line 45 of file panukl_plr.h.

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

◆ OUT_file

char PANUKL_PLR::OUT_file[256]

output polar file [.TXT]

Definition at line 41 of file panukl_plr.h.

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

◆ POLAR_dir

char PANUKL_PLR::POLAR_dir[256]

path name for output - aerodynamic data files to create POLAR

Definition at line 31 of file panukl_plr.h.

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


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