CONFIG LIB 1.5
Configuration Files Library (by TGG 2020)
Loading...
Searching...
No Matches
airfoil.h
1/*********************************************************************/
2/* */
3/* Panukl package - (C) TGG 2002 */
4/* Config files library - (C) TGG 2015 */
5/* */
6/*********************************************************************/
7/* Warszawa, 2020 */
8/*********************************************************************/
9/* */
10/* File: airfoil.h */
11/* */
12/* Author: T.Grabowski */
13/* */
14/* Contents - airfoil class */
15/* */
16/* Last update: 24.11.2020 */
17/* */
18/*********************************************************************/
19/* */
20/* */
21
22#ifndef _AIRFOIL_H_
23#define _AIRFOIL_H_
24
25#include <cstdio>
26#include <cstdlib>
27#include <vector>
28
29#include "iofun.h"
30#include "memfun.h"
31#include "naca.h"
32
40class AIRFOIL : public IOFUN, public MEMFUN
41{
42 // 0 - recognition by content, 1 - recognition by filename extention
43 int iReadType;
44
45 // local variables (arrays)
46 int Nrob;
47 double *Xrob, *Zrob;
48
49 // read by format
50 int Read_PRF_0( char *cFile );
51 int Read_PRF_1( char *cFile );
52 int Read_KOO( char *cFile );
53 int Read_DAT( char *cFile );
54 int Read_DAT_LEDNICER( char *cFile ); // by Anna Sima
55
56 // methods to get file type by a file content or its extension (by Anna Sima)
57 void getiTypeByContent( char *cFile );
58 void getiTypeByExt( char *cFile );
59
60 // methods to provide a valid PRF format
61 int Write_PRF( char *cFile );
62 int Write_DAT( char *cFile );
63
64 // Transformations
65 void PRF2XFOIL( void );
66 void XFOIL2PRF( void );
67 void TE_correct( void );
68 void Check( int *nn, double *X, double *Z );
69
70 // Maths
71 double dAverage( double*, int );
72 double dmin( double d1, double d2){ return( d2 < d1 ? d2 : d1 ); };
73 double dmax( double d1, double d2){ return( d2 > d1 ? d2 : d1 ); };
74 double tabmax( double*, int );
75 double tabmin( double*, int );
76 double dMaxT( double*, int* );
77 double dMinT( double*, int* );
78 double inter1(double *xx, double *yy, unsigned long n, double x );
79 unsigned long locate(double xx[], unsigned long n, double x );
80 double apr3( double dX, double *dXX, double *dYY );
81 void SortClean( int *N, double *X );
82 void Sort1( int N, double dRA[] );
83 void Sort2( int iN, double dRA[], double dKOL[], int iOrder );
84 bool check_order( double d1, double d2, int iFlag = 0 );
85
86 char cc[200];
87 char comment[512];
88
89 protected:
90
91 int iRead;
92
93 int iGUI;
94 void (*alert)( char *c ) = NULL;
95
96 public:
97
98 int Nf;
99 double *Xf;
100 double *Zf;
101
102 int N;
103 double *Xd;
104 double *Xg;
105 double *Zd;
106 double *Zg;
107
115 int iType;
116
117 char cName[100];
118
120 void Print( FILE* f=stdout );
122 int Read( char *cFile );
124 int Write( char *cFile, int iTyp=0 );
125
127 int ReadStatus( void ){ return iRead; };
129 int GetReadType( void ) { return iReadType; };
131 void SetReadType( int iRT ) { iReadType = iRT; };
132
134 int ReadNaca( long int iNACA, int NN=100 );
136 int ReadNaca( char* cNACA, int NN=100 );
138 void Clean( void );
139
140 AIRFOIL( void );
141 ~AIRFOIL( void ){ Clean(); };
142};
143
144#endif /*_AIRFOIL_H_*/
145
146
AIRFOIL class to manipulate the airfoil geometry or it can read geometry data from file (5 commonly ...
Definition airfoil.h:41
double * Xf
X coordinates (Nf points)
Definition airfoil.h:99
void Print(FILE *f=stdout)
prints PRF file (default on stdout)
Definition airfoil.cpp:681
int GetReadType(void)
returns the type of format recognition: 0 - recognition by content (default), 1 - recognition by ...
Definition airfoil.h:129
double * Xd
X coordinates of lower contour (N points)
Definition airfoil.h:103
void Clean(void)
cleans local variables
Definition airfoil.cpp:56
int ReadNaca(long int iNACA, int NN=100)
generates NACA airfoil given by long int value (e.g. iNACA = 23012), NN - the number of points that...
Definition airfoil.cpp:137
double * Zf
Z coordinates (Nf points)
Definition airfoil.h:100
int Read(char *cFile)
reads profile file
Definition airfoil.cpp:73
int ReadStatus(void)
returns read status: 0 - no data, 1 - data read succesfuly
Definition airfoil.h:127
int Nf
size of the vectors with geometry data - compatible with Xfoil
Definition airfoil.h:98
int Write(char *cFile, int iTyp=0)
saves profile file - two types are available: 0 - native PANUKL (4 columns) 3 - SELIG (Xfoil comp...
Definition airfoil.cpp:115
char cName[100]
filename (without path)
Definition airfoil.h:117
int iType
File type: 0 - PRF - PANUKL (prf1) - native PANUKL (4 columns) format 1 - PRF - prf2 - by L....
Definition airfoil.h:115
int N
size of the vectors with geometry data - 4 column native PANUKL format
Definition airfoil.h:102
int iRead
0 - no data, 1 - data read succesfuly
Definition airfoil.h:91
int iGUI
GUI flag - messages displayed using wrapping function "alert".
Definition airfoil.h:93
double * Zg
Z coordinates of upper contour (N points)
Definition airfoil.h:106
void(* alert)(char *c)
virtual fuction to display the message (if iGUI > 0)
Definition airfoil.h:94
double * Zd
Z coordinates of lower contour (N points)
Definition airfoil.h:105
void SetReadType(int iRT)
sets the type of format recognition
Definition airfoil.h:131
double * Xg
X coordinates of upper contour (N points)
Definition airfoil.h:104
Simple I/O functions class.
Definition iofun.h:42
class with overloaded "new" operator initializing object with zeros
Definition memfun.h:34
This file contains some smart I/O functions.
This file contains some smart functions, operators, macros for safe initializing end erasing the memo...