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

main class for PANUKL input and output files manipulation More...

#include <panukl_struct.h>

Inheritance diagram for GRID_ARRAYS:
MEMFUN IOFUN

Public Member Functions

 GRID_ARRAYS (void)
 default constructor
 
 ~GRID_ARRAYS (void)
 destructor
 
Functions to read, write and convert data
int ReadINP (char *FileName)
 reads [.inp] file from pathname FileName
 
int ReadIN1 (FILE *File)
 reads [.inp] data from stream FILE - data written as panels
 
int ReadIN2 (FILE *File)
 reads [.inp] data from stream FILE - data written as nodes
 
int ReadDAT (char *FileName, int iProg)
 reads [.dat] file from pathname FileName - body and wake panels stored in dX array
iProg: 1 initialization for Panukl program, 2 initialization for Press program
 
int ReadDATw (char *FileName)
 reads [.dat] file from pathname FileName - body and wake panels stored in separated arrays (for visualization)
 
int WriteInpFromPanels (char *FileName, int iScale=0)
 writes [.inp] file to pathname FileName - data stored in panels
 
int WriteInpFromPoints (char *FileName, int iScale=0)
 writes [.inp] file to pathname FileName - data stored in nodes
 
int WriteDAT (char *FileName)
 writes [.dat] file to pathname FileName
 
void Panels2Points (void)
 converts panels (std::vector<PANEL>) to nodes (std::vector<VECTOR_3D>)
 
void Points2Panels (void)
 converts nodes (std::vector<VECTOR_3D>) to panels (std::vector<PANEL>)
 
void Corner2Points (int *iD, VECTOR_3D *P)
 assigns panel corner P to node number iD
 
void Panels2Array (void)
 converts panels (std::vector<PANEL>) to array (double X[i,j,k])
 
void Array2Panels (void)
 converts array (double X[i,j,k]) to panels (std::vector<PANEL>)
 
int ReadObjs (FILE *f)
 Reads objects.
 
void WriteObjs (FILE *f)
 Writes objects.
 
Initialization of arrays
void InitRob (void)
 initialization of scratch arrays
 
void InitCommon (void)
 initialization of commonly used arrays
 
void InitForPanukl (void)
 initialization of arrays used by PANUKL (main program)
 
void InitForPress (void)
 initialization of arrays used by Press program
 
Deleting of arrays
void DeleteINP (void)
 
void DeleteDAT (void)
 
void DeleteDATw (void)
 

Static Public Member Functions

static int ReadObjs (FILE *f, std::vector< MS2_OBJ > &Objs, int N1=0, float fVer=VERSION)
 Reads objects from stream (FILE) f, with offset by N1 panels.
 
static int ReadObjs (std::ifstream &f, std::vector< MS2_OBJ > &Objs, int N1=0, float fVer=VERSION)
 Reads objects from stream (ifstream object) f, with offset by N1 panels.
 
static void WriteObjs (FILE *f, std::vector< MS2_OBJ > &Objs)
 Writes objects to stream (FILE) f.
 
- Static Public Member Functions inherited from MEMFUN
static void * operator new (size_t st, const char *text="(unknown)", int ierr_print=1)
 Overloaded "new" operator initializing object with zeros.
 

Public Attributes

float fVer
 version number of data file [.inp] format: from data file on input, defined in VERSION on output
 
double dWsp_sk
 scale factor (default: 1)
 
Reference data
double dSS
 reference area
 
double dCa
 mean aerodynamic chord (MAC)
 
double dBs
 wingspan
 
double dXca25
 x coordinate of reference point for moment calculation (usually 0.25 MAC)
 
double dZca25
 z coordinate of reference point for moment calculation (usually 0.25 MAC)
 
Main arrays dimensions
int iMaxPanelNumber
 number of body (airplane) panels
 
int iMaxWakesNumber
 maximum of numbers of wake strips
 
int iMaxWakePanelNumber
 maximum number of panels in wake strip
 
int iMaxBodyNeighbours
 number of side body-wake neighbours
 
Main arrays and objects <br>
doubledX
 main grid (+ wake for Panukl) X[i,j,k], i=panel number, j=corner number, k=coordinate number
 
doubledXw
 wake grid (Xw[i,j,k])
 
doubledXkw
 side body-wake neighbours (panels)
 
std::vector< PANELPanels
 panels array
 
std::vector< VECTOR_3DPoints
 nodes array
 
std::vector< MS2_OBJObjs
 Objects (MS2_OBJ) vector.
 
Wake data
int iLiczp
 number of wake panels
 
int iLiczw
 number of wake strips
 
intiNkw
 numbers of panels in Xkw (wake grid)
 
intiKw
 info about side body wake neighbours iKw[i,j]
i - side body-wake neighbour number,
j = 0 - number of panels in this neighbour strip
j = 1,2 - numbers of the first and the last object panel neighbouring with the wake
 
intiNeigh
 neighbours numbers array (Nww2,8)
 
intiNnww
 array containing upper surface panels neighbouring with the wake
iNnww[i,j]
i - strip number
j=1 - upper panel number
j=2 - edge number of upper panel neighbouring with the wake
j=3 - wake panel number that is the neighbour of upper panel (j=1)
 
intiNpas
 number of panels in the wake strip [liczw]
 
intiIpas
 wake panels numbers in the strip [liczw, MaxWakePanelNumber]
 
Working variables and arrays for Panukl calculation
int iN
 = iMaxPanelNumber;
 
int iNp
 Number of nodes;.
 
int iNw
 = iN + iLiczw; # airplane + wake (up) (1 panel/strip)
 
int iNw2
 = iNw + iLiczw; # airplane + wake (up+down) (1 panel/strip)
 
int iNww
 = iN + iLiczp; # airplane + wake (up)
 
int iNww2
 = iNww + iLiczw; # airplane + wake (up) + wake (down 1 panel/strip)
 
doubledAi
 coefficient array (N x Nww)
 
doubledRhs
 right hand side vector input - result on output (Nww2)
 
doubledRh
 working area (N)
 
intIPIV
 pivot table
 
int iSym
 symmetry flag
 
Collocation points
doubledXp
 
doubledYp
 
doubledZp
 
Panels centers
doubledX0
 
doubledY0
 
doubledZ0
 
Directional cosines
doubledAlf1
 
doubledAlf2
 
doubledAlf3
 
doubledBet1
 
doubledBet2
 
doubledBet3
 
doubledGam1
 
doubledGam2
 
doubledGam3
 
Velocities, pressure, and other working arrays
doubledQx
 tangential undisturbed velocity - x coordinate
 
doubledQy
 tangential undisturbed velocity - y coordinate
 
doubledQz
 tangential undisturbed velocity - z coordinate
 
doubledSig
 source (singularity) value
 
doubledVxd
 "x" component of induced velocity (from doublet distribution)
 
doubledVyd
 "y" component of induced velocity (from doublet distribution)
 
doubledVzd
 "z" component of induced velocity (from doublet distribution)
 
doubledVVVV
 undisturbed velocity
 
doubledCpp
 pressure coefficient
 
doubledCxi
 induced drag coeffcient (from strip)
 
doubledCzi
 strip lift coeffcient
 
doubledVv2
 square of total velocity on the panel
 
doubledMach
 lacal panel Mach number
 
doubledSss
 panels areas
 
doubledSs_rzut
 projection areas of panels on plane xy
 
doubledSs_cpr
 strip area
 
doubledSs_cpr0
 strip wetted area
 
doubledZzz
 
doubledObr
 
doubledCpb
 
doubledCpr
 normal force coefficient acting on the strip
 
doubledCmr
 twisting moment coefficient acting on the strip
 
doubledCay
 strip chord
 
doubledCzr
 "z" force coefficient acting on the strip
 
doubledCyr
 "y" force coefficient acting on the strip
 
doubledCxr
 "z" force coefficient acting on the strip
 
Date and time of read file
char File_DAT_date [100]
 date and time of mesh with wake file
 
char File_INP_date [100]
 date and time of mesh file
 
char File_TXT_date [100]
 date and time of results file
 

Results - objects and functions

doublepdWyniki [23]
 results array - 22 variables x number of panels
 
int iNwyn
 current number of rows of pdWyniki array
 
int iMwyn
 current number of columns of pdWyniki array (<=22)
 
char TXTfile [256]
 pathname of [.txt] file
 
int ReadWyn (char *FileName)
 reads results array from pathname FileName
 
void SupWyn (void)
 computes data for sides centers
 
void DeleteWyn (void)
 erases results objects
 
int WriteWyn (char *FileName)
 writes results array to pathname FileName
 

Detailed Description

main class for PANUKL input and output files manipulation

Definition at line 64 of file panukl_struct.h.

Constructor & Destructor Documentation

◆ GRID_ARRAYS()

GRID_ARRAYS::GRID_ARRAYS ( void )

default constructor

Definition at line 29 of file panukl_struct.cpp.

30 {
33 for( int i=0; i<23; i++ )pdWyniki[i] = 0;
34 fVer = VERSION;
35 }
double dCa
mean aerodynamic chord (MAC)
int iMaxWakesNumber
maximum of numbers of wake strips
float fVer
version number of data file [.inp] format: from data file on input, defined in VERSION on output
int iMaxWakePanelNumber
maximum number of panels in wake strip
double * pdWyniki[23]
results array - 22 variables x number of panels
#define VERSION
VERSION of the data file [.inp] format currently is equal to 4.00
#define MaxWakesNumber
limit of numbers of wake strips
#define MaxWakePanelNumber
limit of numbers of panels in wake strip

◆ ~GRID_ARRAYS()

GRID_ARRAYS::~GRID_ARRAYS ( void )

destructor

Definition at line 37 of file panukl_struct.cpp.

38 {
39
40 DELETE_TAB( dX );
41 DELETE_TAB( dXw );
43
46 DELETE_TAB( iKw );
47
51
52 DELETE_TAB( dXp );
53 DELETE_TAB( dYp );
54 DELETE_TAB( dZp );
55 DELETE_TAB( dQx );
56 DELETE_TAB( dQy );
57 DELETE_TAB( dQz );
59
61 DELETE_TAB( dX0 );
62 DELETE_TAB( dY0 );
63 DELETE_TAB( dZ0 );
64 DELETE_TAB( dAlf1 );
65 DELETE_TAB( dAlf2 );
66 DELETE_TAB( dAlf3 );
67 DELETE_TAB( dBet1 );
68 DELETE_TAB( dBet2 );
69 DELETE_TAB( dBet3 );
70 DELETE_TAB( dGam1 );
71 DELETE_TAB( dGam2 );
72 DELETE_TAB( dGam3 );
73
74 DELETE_TAB( dAi );
76 DELETE_TAB( dRh );
78
87
98
99 DELETE_TAB( dZzz );
100 DELETE_TAB( dObr );
101 DELETE_TAB( dCpb );
102 }
double * dSs_cpr0
strip wetted area
double * dRhs
right hand side vector input - result on output (Nww2)
double * dCzi
strip lift coeffcient
double * dCay
strip chord
double * dSig
source (singularity) value
int * iNnww
array containing upper surface panels neighbouring with the wake iNnww[i,j] i - strip number j=1...
double * dCyr
"y" force coefficient acting on the strip
double * dQz
tangential undisturbed velocity - z coordinate
double * dCpp
pressure coefficient
int * iNeigh
neighbours numbers array (Nww2,8)
double * dX
main grid (+ wake for Panukl) X[i,j,k], i=panel number, j=corner number, k=coordinate number
double * dCpr
normal force coefficient acting on the strip
double * dXw
wake grid (Xw[i,j,k])
double * dMach
lacal panel Mach number
double * dVv2
square of total velocity on the panel
double * dSss
panels areas
double * dCzr
"z" force coefficient acting on the strip
double * dVyd
"y" component of induced velocity (from doublet distribution)
int * iKw
info about side body wake neighbours iKw[i,j] i - side body-wake neighbour number,...
int * iNkw
numbers of panels in Xkw (wake grid)
double * dAi
coefficient array (N x Nww)
double * dCxi
induced drag coeffcient (from strip)
int * iNpas
number of panels in the wake strip [liczw]
double * dVzd
"z" component of induced velocity (from doublet distribution)
double * dQy
tangential undisturbed velocity - y coordinate
double * dXkw
side body-wake neighbours (panels)
double * dSs_rzut
projection areas of panels on plane xy
double * dVxd
"x" component of induced velocity (from doublet distribution)
double * dRh
working area (N)
int * iIpas
wake panels numbers in the strip [liczw, MaxWakePanelNumber]
double * dVVVV
undisturbed velocity
double * dCxr
"z" force coefficient acting on the strip
double * dQx
tangential undisturbed velocity - x coordinate
int * IPIV
pivot table
double * dCmr
twisting moment coefficient acting on the strip
double * dSs_cpr
strip area
#define DELETE_TAB(OBJ)
Macro for safe deleteing the array and sets the pointer to zero.
Definition memfun.h:97

Member Function Documentation

◆ Array2Panels()

void GRID_ARRAYS::Array2Panels ( void )

converts array (double X[i,j,k]) to panels (std::vector<PANEL>)

Definition at line 176 of file panukl_struct.cpp.

177{
178 Panels.clear();
179 PANEL Panel;
180 for( int i=0; i<iMaxPanelNumber; i++ )
181 {
182 Panel.P1.x = dX[ i ];
183 Panel.P1.y = dX[ iMaxPanelNumber*4 + i ];
184 Panel.P1.z = dX[ iMaxPanelNumber*8 + i ];
185
186 Panel.P2.x = dX[ iMaxPanelNumber + i ];
187 Panel.P2.y = dX[ iMaxPanelNumber*4 + iMaxPanelNumber + i ];
188 Panel.P2.z = dX[ iMaxPanelNumber*8 + iMaxPanelNumber + i ];
189
190 Panel.P3.x = dX[ iMaxPanelNumber*2 + i ];
191 Panel.P3.y = dX[ iMaxPanelNumber*4 + iMaxPanelNumber*2 + i ];
192 Panel.P3.z = dX[ iMaxPanelNumber*8 + iMaxPanelNumber*2 + i ];
193
194 Panel.P4.x = dX[ iMaxPanelNumber*3 + i ];
195 Panel.P4.y = dX[ iMaxPanelNumber*4 + iMaxPanelNumber*3 + i ];
196 Panel.P4.z = dX[ iMaxPanelNumber*8 + iMaxPanelNumber*3 + i ];
197
198 Panels.push_back( Panel );
199 }
200}
int iMaxPanelNumber
number of body (airplane) panels
std::vector< PANEL > Panels
panels array
A class for manipulating the rectangular panel.
Definition panel.h:35
VECTOR_3D P1
the coordinates of the 1st corner of the panel
Definition panel.h:56
double x
x coordinate
Definition vector3d.h:38

Referenced by ReadIN1().

◆ Corner2Points()

void GRID_ARRAYS::Corner2Points ( int * iD,
VECTOR_3D * P )

assigns panel corner P to node number iD

Definition at line 127 of file panukl_struct.cpp.

128{
129 for(int j=0; j<(int)Points.size(); j++ )
130 {
131 if( Points[j] == *P )
132 {
133 *iD = j;
134 return;
135 }
136 }
137
138 Points.push_back( *P );
139 *iD = Points.size()-1;
140}
std::vector< VECTOR_3D > Points
nodes array

Referenced by Panels2Points().

◆ DeleteDAT()

void GRID_ARRAYS::DeleteDAT ( void )

Definition at line 516 of file panukl_struct.cpp.

517{
518 DELETE_TAB( dX );
520 DELETE_TAB( iNnww );
521 DELETE_TAB( iIpas );
522}

◆ DeleteDATw()

void GRID_ARRAYS::DeleteDATw ( void )

Definition at line 615 of file panukl_struct.cpp.

616{
617 DELETE_TAB( dX );
619 DELETE_TAB( dXw );
620
622 DELETE_TAB( iIpas );
623 DELETE_TAB( iNpas );
624}

◆ DeleteINP()

void GRID_ARRAYS::DeleteINP ( void )

Definition at line 116 of file panukl_struct.cpp.

117{
118 DELETE_TAB( dX );
120 DELETE_TAB( dXkw );
121 DELETE_TAB( iNkw );
122 DELETE_TAB( iKw );
123 Points.clear();
124 Panels.clear();
125}

◆ DeleteWyn()

void GRID_ARRAYS::DeleteWyn ( void )

erases results objects

Definition at line 951 of file panukl_struct.cpp.

952{
953 for( int i=0; i<23; i++ ) DELETE_TAB( pdWyniki[i] );
954 iNwyn = 0;
955 iMwyn = 0;
956}
int iNwyn
current number of rows of pdWyniki array
int iMwyn
current number of columns of pdWyniki array (<=22)

Referenced by ReadWyn().

◆ InitCommon()

void GRID_ARRAYS::InitCommon ( void )

initialization of commonly used arrays

Definition at line 967 of file panukl_struct.cpp.

968{
969 NEW_TAB( dQx, double, iN );
970 NEW_TAB( dQy, double, iN );
971 NEW_TAB( dQz, double, iN );
972 NEW_TAB( dSig, double, iN );
973
974 NEW_TAB( dSss, double, iNww2 );
975 NEW_TAB( dX0, double, iNww2 );
976 NEW_TAB( dY0, double, iNww2 );
977 NEW_TAB( dZ0, double, iNww2 );
978 NEW_TAB( dAlf1, double, iNww2 );
979 NEW_TAB( dAlf2, double, iNww2 );
980 NEW_TAB( dAlf3, double, iNww2 );
981 NEW_TAB( dBet1, double, iNww2 );
982 NEW_TAB( dBet2, double, iNww2 );
983 NEW_TAB( dBet3, double, iNww2 );
984 NEW_TAB( dGam1, double, iNww2 );
985 NEW_TAB( dGam2, double, iNww2 );
986 NEW_TAB( dGam3, double, iNww2 );
987
988 NEW_TAB( dRhs, double, iNww2 );
989}
int iN
= iMaxPanelNumber;
int iNww2
= iNww + iLiczw; # airplane + wake (up) + wake (down 1 panel/strip)
#define NEW_TAB(Var, Typ, Len)
Macro for initializing array with zeros.
Definition memfun.h:71

Referenced by InitForPanukl(), and InitForPress().

◆ InitForPanukl()

void GRID_ARRAYS::InitForPanukl ( void )

initialization of arrays used by PANUKL (main program)

Definition at line 991 of file panukl_struct.cpp.

992{
993 InitCommon();
994
995 NEW_TAB( dXp, double, iN );
996 NEW_TAB( dYp, double, iN );
997 NEW_TAB( dZp, double, iN );
998
999 NEW_TAB( dAi, double, iN*iNww );
1000 NEW_TAB( dRh, double, iN );
1001 NEW_TAB( IPIV, int, iN );
1002}
void InitCommon(void)
initialization of commonly used arrays
int iNww
= iN + iLiczp; # airplane + wake (up)

Referenced by ReadDAT().

◆ InitForPress()

void GRID_ARRAYS::InitForPress ( void )

initialization of arrays used by Press program

Definition at line 1004 of file panukl_struct.cpp.

1005{
1006 InitCommon();
1007 NEW_TAB( dVVVV, double, iN );
1008 NEW_TAB( dVxd, double, iN );
1009 NEW_TAB( dVyd, double, iN );
1010 NEW_TAB( dVzd, double, iN );
1011 NEW_TAB( dSs_rzut, double, iN );
1012 NEW_TAB( dCpp, double, iN );
1013 NEW_TAB( dVv2, double, iN );
1014 NEW_TAB( dMach, double, iN );
1015
1016 NEW_TAB( dCxi, double, iLiczw );
1017 NEW_TAB( dCzi, double, iLiczw );
1018 NEW_TAB( dCpr, double, iLiczw );
1019 NEW_TAB( dSs_cpr0, double, iLiczw );
1020 NEW_TAB( dSs_cpr, double, iLiczw );
1021 NEW_TAB( dCmr, double, iLiczw );
1022 NEW_TAB( dCay, double, iLiczw );
1023 NEW_TAB( dCzr, double, iLiczw );
1024 NEW_TAB( dCyr, double, iLiczw );
1025 NEW_TAB( dCxr, double, iLiczw );
1026
1027 NEW_TAB( dZzz, double, iN*4*3 );
1028 NEW_TAB( dObr, double, iN*4 );
1029 NEW_TAB( dCpb, double, iN*4 );
1030}
int iLiczw
number of wake strips

Referenced by ReadDAT().

◆ InitRob()

void GRID_ARRAYS::InitRob ( void )

initialization of scratch arrays

Definition at line 958 of file panukl_struct.cpp.

959{
961
962 NEW_TAB( iNnww, int, iMaxWakesNumber * 3 );
965}

Referenced by ReadDATw().

◆ Panels2Array()

void GRID_ARRAYS::Panels2Array ( void )

converts panels (std::vector<PANEL>) to array (double X[i,j,k])

Definition at line 154 of file panukl_struct.cpp.

155{
156 for( int i=0; i<iMaxPanelNumber; i++ )
157 {
158 dX[ i ] = Panels[i].P1.x;
159 dX[ iMaxPanelNumber*4 + i ] = Panels[i].P1.y;
160 dX[ iMaxPanelNumber*8 + i ] = Panels[i].P1.z;
161
162 dX[ iMaxPanelNumber + i ] = Panels[i].P2.x;
163 dX[ iMaxPanelNumber*4 + iMaxPanelNumber + i ] = Panels[i].P2.y;
164 dX[ iMaxPanelNumber*8 + iMaxPanelNumber + i ] = Panels[i].P2.z;
165
166 dX[ iMaxPanelNumber*2 + i ] = Panels[i].P3.x;
167 dX[ iMaxPanelNumber*4 + iMaxPanelNumber*2 + i ] = Panels[i].P3.y;
168 dX[ iMaxPanelNumber*8 + iMaxPanelNumber*2 + i ] = Panels[i].P3.z;
169
170 dX[ iMaxPanelNumber*3 + i ] = Panels[i].P4.x;
171 dX[ iMaxPanelNumber*4 + iMaxPanelNumber*3 + i ] = Panels[i].P4.y;
172 dX[ iMaxPanelNumber*8 + iMaxPanelNumber*3 + i ] = Panels[i].P4.z;
173 }
174}

Referenced by ReadIN2().

◆ Panels2Points()

void GRID_ARRAYS::Panels2Points ( void )

converts panels (std::vector<PANEL>) to nodes (std::vector<VECTOR_3D>)

Definition at line 142 of file panukl_struct.cpp.

143{
144 Points.clear();
145 for(int i=0; i<iN; i++)
146 {
147 Corner2Points( &Panels[i].IdP1, &Panels[i].P1 );
148 Corner2Points( &Panels[i].IdP2, &Panels[i].P2 );
149 Corner2Points( &Panels[i].IdP3, &Panels[i].P3 );
150 Corner2Points( &Panels[i].IdP4, &Panels[i].P4 );
151 }
152}
void Corner2Points(int *iD, VECTOR_3D *P)
assigns panel corner P to node number iD

Referenced by ReadIN1().

◆ Points2Panels()

void GRID_ARRAYS::Points2Panels ( void )

converts nodes (std::vector<VECTOR_3D>) to panels (std::vector<PANEL>)

Definition at line 202 of file panukl_struct.cpp.

203{
204 for( int i=0; i<iN; i++ )
205 {
206 Panels[i].P1 = Points[ Panels[i].IdP1 ];
207 Panels[i].P2 = Points[ Panels[i].IdP2 ];
208 Panels[i].P3 = Points[ Panels[i].IdP3 ];
209 Panels[i].P4 = Points[ Panels[i].IdP4 ];
210 }
211}

Referenced by ReadIN2().

◆ ReadDAT()

int GRID_ARRAYS::ReadDAT ( char * FileName,
int iProg )

reads [.dat] file from pathname FileName - body and wake panels stored in dX array
iProg: 1 initialization for Panukl program, 2 initialization for Press program

Definition at line 524 of file panukl_struct.cpp.

525{
526 FILE *File;
527 File = fopen( FileName, "r" );
528 if( File == NULL )
529 {
530 fprintf( stderr, "[.DAT] file open error (%s)\n", FileName );
531 return (-1);
532 }
533
534 DeleteDAT();
535
537
538 char cRob[256];
539 ReadStr( File, cRob );
540 if( !strncmp( cRob, "ver", 3 ) )
541 {
542 char cc[10];
543 sscanf( cRob," %s %f %d", cc, &fVer, &iSym );
544 fscanf( File, " %d %d %d %lf %lf %lf %lf %lf",
546 }
547 else
548 {
549 sscanf( cRob, " %d %d %d %lf %lf %lf %lf %lf",
551 iSym = 99;
552 }
553
555
556 iNw = iN + iLiczw; // samolot + slad (gora) (1 panel/pasmo)
557 iNw2 = iNw + iLiczw; // samolot + slad (gora+dol) (1 panel/pasmo)
558 iNww = iN + iLiczp; // samolot + slad (gora)
559 iNww2 = iNww + iLiczw; // j.w. + dol sladu (1 panel/pasmo)
560
561 NEW_TAB( dX, double, iNww2 * 4 * 3 );
562 NEW_TAB( iNeigh, int, iNww2 * 8 );
563
564 int iRob;
565 for( int i=0; i<iN; i++ )
566 {
567 fscanf( File, "%d", &iRob );
568 for( int j=0; j<4; j++ )
569 for( int k=0; k<3; k++ )
570 fscanf( File, "%lf", &dX[ iNww2*4*k + iNww2*j + i ] );
571 }
572
573 ReadPar( File, "%d", &iLiczp );
574 NEW_TAB( iNnww, int, iLiczw * 5 );
576
577 for( int i=iN; i<iN+iLiczp; i++ )
578 {
579 fscanf( File, "%d", &iRob );
580 for( int j=0; j<4; j++ )
581 for( int k=0; k<3; k++ )
582 fscanf( File, "%lf", &dX[ iNww2*4*k + iNww2*j + i ] );
583 }
584
585 for( int i=0; i<iN; i++ )
586 {
587 fscanf( File, "%d", &iRob );
588 for( int j=0; j<8; j++ ) fscanf( File, "%d", &iNeigh[ iNww2*j + i ] );
589 }
590
591 for( int i=0; i<iLiczw; i++ )
592 {
593 fscanf( File, "%d", &iRob );
594 fscanf( File, "%d", &iNnww[ i ]);
595 fscanf( File, "%d", &iNnww[ iLiczw + i ]);
596 fscanf( File, "%d", &iNnww[ iLiczw*2 + i ]);
597 for( int j=0; j<iNnww[iLiczw*2+i]+1; j++ )
598 fscanf( File, "%d", &iIpas[ iLiczw*j + i ] );
599 }
600
601 ReadObjs( File );
602
603 fclose( File );
604
605 if( iProg == 1 )
607 else if( iProg == 2 )
608 InitForPress();
609
610 dWsp_sk = 1.;
611
612 return(0);
613}
double dZca25
z coordinate of reference point for moment calculation (usually 0.25 MAC)
int iLiczp
number of wake panels
int ReadObjs(FILE *f)
Reads objects.
double dSS
reference area
char File_DAT_date[100]
date and time of mesh with wake file
double dXca25
x coordinate of reference point for moment calculation (usually 0.25 MAC)
double dWsp_sk
scale factor (default: 1)
void InitForPress(void)
initialization of arrays used by Press program
double dBs
wingspan
int iSym
symmetry flag
int iNw
= iN + iLiczw; # airplane + wake (up) (1 panel/strip)
int iNw2
= iNw + iLiczw; # airplane + wake (up+down) (1 panel/strip)
void InitForPanukl(void)
initialization of arrays used by PANUKL (main program)
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 const char * filename_date(const char *name)
Returns pointer to the string that contains the date of last file modification/creation.
Definition iofun.cpp:399
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

◆ ReadDATw()

int GRID_ARRAYS::ReadDATw ( char * FileName)

reads [.dat] file from pathname FileName - body and wake panels stored in separated arrays (for visualization)

Definition at line 626 of file panukl_struct.cpp.

627{
628 FILE *File;
629 File = fopen( FileName, "r" );
630 if( File == NULL )
631 {
632 fprintf( stderr, "[.DAT] file open error (%s)\n", FileName );
633 return (-1);
634 }
635
636 DeleteDATw();
637
639
640 char cRob[256];
641 ReadStr( File, cRob );
642 if( !strncmp( cRob, "ver", 3 ) )
643 {
644 char cc[10];
645 sscanf( cRob," %s %f %d", cc, &fVer, &iSym );
646 fscanf( File, " %d %d %d %lf %lf %lf %lf %lf",
648 }
649 else
650 sscanf( cRob, " %d %d %d %lf %lf %lf %lf %lf",
652
654
655 NEW_TAB( dX, double, iMaxPanelNumber * 4 * 3 );
656 NEW_TAB( iNeigh, int, iMaxPanelNumber * 8 );
657
658 int iRob;
659 for( int i=0; i<iMaxPanelNumber; i++ )
660 {
661 fscanf( File, "%d", &iRob );
662 for( int j=0; j<4; j++ )
663 for( int k=0; k<3; k++ )
664 fscanf( File, "%lf", &dX[ iMaxPanelNumber*4*k + iMaxPanelNumber*j + i ] );
665 }
666
667 ReadPar( File, "%d", &iLiczp );
668 InitRob();
669
671 for( int i=0; i<iLiczp; i++ )
672 {
673 fscanf( File, "%d", &iRob );
674 for( int j=0; j<4; j++ )
675 for( int k=0; k<3; k++ )
676 fscanf( File, "%lf", &dXw[ iMaxWP*4*k + iMaxWP*j + i ] );
677 }
678
679 for( int i=0; i<iMaxPanelNumber; i++ )
680 {
681 fscanf( File, "%d", &iRob );
682 for( int j=0; j<8; j++ ) fscanf( File, "%d", &iNeigh[ iMaxPanelNumber*j + i ] );
683 }
684
685 for( int i=0; i<iLiczw; i++ )
686 {
687 fscanf( File, "%d", &iRob );
688 fscanf( File, "%d", &iNnww[ i ]);
689 fscanf( File, "%d", &iNnww[ iMaxWakesNumber + i ]);
690 fscanf( File, "%d", &iNpas[ i ]);
691 for( int j=0; j<iNpas[i]+1; j++ )
692 fscanf( File, "%d", &iIpas[ iMaxWakesNumber*j + i ] );
693 }
694
695 ReadObjs( File );
696
697 fclose( File );
698
699 dWsp_sk = 1.;
700
701 return(0);
702}
void InitRob(void)
initialization of scratch arrays

◆ ReadIN1()

int GRID_ARRAYS::ReadIN1 ( FILE * File)

reads [.inp] data from stream FILE - data written as panels

Definition at line 278 of file panukl_struct.cpp.

279{
280 fscanf( File, " %d %lf %lf %lf %lf %lf %lf",
282
283 NEW_TAB( dX, double, iMaxPanelNumber * 4 * 3 );
284 NEW_TAB( iNeigh, int, iMaxPanelNumber * 8 );
285
286 int iRob;
287 for( int i=0; i<iMaxPanelNumber; i++ )
288 {
289 fscanf( File, "%d", &iRob );
290 for( int j=0; j<4; j++ )
291 for( int k=0; k<3; k++ )
292 fscanf( File, "%lf", &dX[ iMaxPanelNumber*4*k + iMaxPanelNumber*j + i ] );
293 }
294
295 Array2Panels();
297
298 return(0);
299}
void Panels2Points(void)
converts panels (std::vector<PANEL>) to nodes (std::vector<VECTOR_3D>)
void Array2Panels(void)
converts array (double X[i,j,k]) to panels (std::vector<PANEL>)

Referenced by ReadINP().

◆ ReadIN2()

int GRID_ARRAYS::ReadIN2 ( FILE * File)

reads [.inp] data from stream FILE - data written as nodes

Definition at line 301 of file panukl_struct.cpp.

302{
303 int iMaxPoints;
304 fscanf( File, " %d %d %lf %lf %lf %lf %lf %lf",
306
307 NEW_TAB( dX, double, iMaxPanelNumber * 4 * 3 );
308 NEW_TAB( iNeigh, int, iMaxPanelNumber * 8 );
310
311 int iRob;
313 Points.clear();
314 for( int i=0; i<iMaxPoints; i++ )
315 {
316 fscanf (File,"%d ",&iRob);
317 fscanf (File, "%lf %lf %lf", &Point.x, &Point.y, &Point.z );
318 Points.push_back( Point );
319 }
320
321 PANEL Panel;
322 for( int i=0; i<iMaxPanelNumber; i++ )
323 {
324 fscanf (File,"%d ",&iRob);
325 fscanf (File, "%d %d %d %d", &Panel.IdP1, &Panel.IdP2, &Panel.IdP3, &Panel.IdP4 );
326 Panels.push_back( Panel );
327 }
328
330 Panels2Array();
331
332 return(0);
333}
void Points2Panels(void)
converts nodes (std::vector<VECTOR_3D>) to panels (std::vector<PANEL>)
void Panels2Array(void)
converts panels (std::vector<PANEL>) to array (double X[i,j,k])
Vector 3D class - vector manipulation.
Definition vector3d.h:34

Referenced by ReadINP().

◆ ReadINP()

int GRID_ARRAYS::ReadINP ( char * FileName)

reads [.inp] file from pathname FileName

Definition at line 213 of file panukl_struct.cpp.

214{
215 FILE *File;
216 File = fopen( FileName, "r" );
217 if( File == NULL )
218 {
219 fprintf( stderr, "[.INP] file open error (%s)\n", FileName );
220 return (-1);
221 }
222
223 DeleteINP();
224
226
227 char cRob[256], cc[10];
228 int iReturn;
229 ReadStr( File, cRob );
230 if( !strncmp( cRob, "PANELS", 6 ) )
231 {
232 fscanf( File," %s %f %d", cc, &fVer, &iSym );
233 iReturn = ReadIN1( File );
234 }
235 else if ( !strncmp( cRob, "POINTS", 6 ) )
236 {
237 fscanf( File," %s %f %d", cc, &fVer, &iSym );
238 iReturn = ReadIN2( File );
239 }
240 else if ( !strncmp( cRob, "ver", 3 ) )
241 {
242 sscanf( cRob," %s %f %d", cc, &fVer, &iSym );
243 iReturn = ReadIN1( File );
244 }
245 else
246 {
247 rewind( File );
248 iSym = 99;
249 iReturn = ReadIN1( File );
250 }
251
253 ReadPar( File, "%d", &iMaxBodyNeighbours_rob );
257 NEW_TAB( iKw, int, iMaxBodyNeighbours*3 );
258
259 for( int i=0; i<3; i++ ) iKw[i] = 0;
260
261 for( int k=0; k<iMaxBodyNeighbours_rob; k++ )
262 {
263 for( int i=0; i<3; i++ ) fscanf( File, "%d", &iKw[ iMaxBodyNeighbours*i + k ] );
264 for( int i=0; i<iKw[ k ]; i++ )
265 {
266 for( int j=0; j<3; j++ ) fscanf( File, "%lf", &dXkw[ iMaxWakePanelNumber*3*k + iMaxWakePanelNumber*j + i ] );
267 fscanf( File, "%d", &iNkw[ iMaxWakePanelNumber*k + i ] );
268 }
269 }
270
271 ReadObjs( File );
272
273 fclose( File );
274
275 return iReturn;
276}
int ReadIN1(FILE *File)
reads [.inp] data from stream FILE - data written as panels
char File_INP_date[100]
date and time of mesh file
int iMaxBodyNeighbours
number of side body-wake neighbours
int ReadIN2(FILE *File)
reads [.inp] data from stream FILE - data written as nodes

◆ ReadObjs() [1/3]

int GRID_ARRAYS::ReadObjs ( FILE * f)

Reads objects.

Definition at line 434 of file panukl_struct.cpp.

435{
436 Objs.clear();
437 return ReadObjs( File, Objs, 0, fVer );
438}
std::vector< MS2_OBJ > Objs
Objects (MS2_OBJ) vector.

Referenced by ReadDAT(), ReadDATw(), ReadINP(), and ReadObjs().

◆ ReadObjs() [2/3]

static int GRID_ARRAYS::ReadObjs ( FILE * f,
std::vector< MS2_OBJ > & Objs,
int N1 = 0,
float fVer = VERSION )
static

Reads objects from stream (FILE) f, with offset by N1 panels.

Parameters
f- pointer to stream - file must be opened before
Objs- vector of MS2_OBJ objects
N1- offset by N1 panels - object panels in range <n1+N1, n2+N1>
fVer- [.inp] data format version

◆ ReadObjs() [3/3]

static int GRID_ARRAYS::ReadObjs ( std::ifstream & f,
std::vector< MS2_OBJ > & Objs,
int N1 = 0,
float fVer = VERSION )
static

Reads objects from stream (ifstream object) f, with offset by N1 panels.

Parameters
f- stream object reference - file must be opened before
Objs- vector of MS2_OBJ objects
N1- offset by N1 panels - object panels in range <n1+N1, n2+N1>
fVer- [.inp] data format version

◆ ReadWyn()

int GRID_ARRAYS::ReadWyn ( char * FileName)

reads results array from pathname FileName

Definition at line 765 of file panukl_struct.cpp.

766{
767 DeleteWyn();
768
769 FILE *f = fopen( FileName, "r" );
770 if( f == NULL )return( -1 );
771
774
775 ReadComm( f );
776 int N, NN = 0;
777 do
778 {
779 N = 0;
780 ReadPar( f, "%d", &N );
781 if( N ) NN = N;
782 }
783 while( N > 0 );
784
785 for( int i=0; i<23; i++ ) pdWyniki[i] = new double[NN];
786 rewind( f );
787// fseek( f, 0L, SEEK_SET );
788 ReadComm( f );
789 char cRob[1024];
790 int iM = 0;
791 for( int i=0; i<NN; i++ )
792 {
793 ReadStr( f, cRob );
794 string ccc = cRob;
795
796 istringstream iss(ccc,istringstream::in);
797 iss.clear();
798 iss >> N;
799 for( int j=0; j<23; j++ )
800 {
801 if( iss.good() ) iM = j+1;
802 iss >> pdWyniki[j][i];
803 }
804
805 /*
806 fscanf( f, "%d", &N );
807 for( int j=0; j<23; j++ )
808 fscanf( f, "%lf", &pdWyniki[j][i] );
809 */
810 }
811 fclose( f );
812
813 iNwyn = NN;
814 iMwyn = iM;
815
816 fprintf( stderr, "mwyn = %d nwyn = %d\n", iMwyn, iNwyn );
817
818 return( 0 );
819}
char TXTfile[256]
pathname of [.txt] file
void DeleteWyn(void)
erases results objects
char File_TXT_date[100]
date and time of results file
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

◆ SupWyn()

void GRID_ARRAYS::SupWyn ( void )

computes data for sides centers

Definition at line 821 of file panukl_struct.cpp.

822{
823 int k,jj,n1,n2,n3;
824 double x,y,z;
825 VECTOR_3D v;
826
827 for( int i=0; i<iN; i++ )
828 {
829 for( int j=0; j<4; j++ )
830 {
831 k = 0; x = dX[ iMaxPanelNumber*4*k + iMaxPanelNumber*j + i ];
832 k = 1; y = dX[ iMaxPanelNumber*4*k + iMaxPanelNumber*j + i ];
833 k = 2; z = dX[ iMaxPanelNumber*4*k + iMaxPanelNumber*j + i ];
834
835 v.x = x-pdWyniki[10][i];
836 v.y = y-pdWyniki[11][i];
837 v.z = z-pdWyniki[12][i];
838 double dRob = v.Len();
839
840 double dSum=1./dRob;
841 pdWyniki[14+j][i]=pdWyniki[9][i]/dRob;
842
843 jj = 1;
844 n1 = 2*j - 1;
845 if( n1 < 0 )n1 = 7;
846 n2 = 2*j;
847 n3 = 2*j + 1;
848
849 k = iNeigh[ iMaxPanelNumber*n1 + i ]-1;
850 if( k >= 0 && k < iMaxPanelNumber )
851 {
852 v.x = x-pdWyniki[10][k];
853 v.y = y-pdWyniki[11][k];
854 v.z = z-pdWyniki[12][k];
855 dRob = v.Len();
856 dSum += 1./dRob;
857 pdWyniki[14+j][i]+=pdWyniki[9][k]/dRob;
858 jj=jj+1;
859 }
860
861 k = iNeigh[ iMaxPanelNumber*n2 + i ]-1;
862 if( k >= 0 && k < iMaxPanelNumber )
863 {
864 v.x = x-pdWyniki[10][k];
865 v.y = y-pdWyniki[11][k];
866 v.z = z-pdWyniki[12][k];
867 dRob = v.Len();
868 dSum += 1./dRob;
869 pdWyniki[14+j][i]+=pdWyniki[9][k]/dRob;
870 jj=jj+1;
871 }
872
873 k = iNeigh[ iMaxPanelNumber*n3 + i ]-1;
874 if( k >= 0 && k < iMaxPanelNumber )
875 {
876 v.x = x-pdWyniki[10][k];
877 v.y = y-pdWyniki[11][k];
878 v.z = z-pdWyniki[12][k];
879 dRob = v.Len();
880 dSum += 1./dRob;
881 pdWyniki[14+j][i]+=pdWyniki[9][k]/dRob;
882 jj=jj+1;
883 }
884
885 pdWyniki[14+j][i] /= dSum;
886 //pdWyniki[14+j][i] /= jj;
887 }
888
889 for( int j=0; j<4; j++ )
890 {
891 k = 0; x = 0.5 * dX[ iMaxPanelNumber*4*k + iMaxPanelNumber*j + i ];
892 k = 1; y = 0.5 * dX[ iMaxPanelNumber*4*k + iMaxPanelNumber*j + i ];
893 k = 2; z = 0.5 * dX[ iMaxPanelNumber*4*k + iMaxPanelNumber*j + i ];
894
895 int j1=(j+1)%4;
896 k = 0; x += 0.5 * dX[ iMaxPanelNumber*4*k + iMaxPanelNumber*j1 + i ];
897 k = 1; y += 0.5 * dX[ iMaxPanelNumber*4*k + iMaxPanelNumber*j1 + i ];
898 k = 2; z += 0.5 * dX[ iMaxPanelNumber*4*k + iMaxPanelNumber*j1 + i ];
899
900 v.x = x-pdWyniki[10][i];
901 v.y = y-pdWyniki[11][i];
902 v.z = z-pdWyniki[12][i];
903 double dRob = v.Len();
904
905 double dSum=1./dRob;
906 pdWyniki[18+j][i]=pdWyniki[9][i]/dRob;
907
908 k = iNeigh[ iMaxPanelNumber*(2*j+1) + i ]-1;
909 if( k >= 0 && k < iMaxPanelNumber )
910 {
911 v.x = x-pdWyniki[10][k];
912 v.y = y-pdWyniki[11][k];
913 v.z = z-pdWyniki[12][k];
914 dRob = v.Len();
915 dSum += 1./dRob;
916 pdWyniki[18+j][i]+=pdWyniki[9][k]/dRob;
917 }
918
919 pdWyniki[18+j][i] /= dSum;
920 }
921 }
922
923 iMwyn = 22;
924
925 //tg_filename_setext( TXTfile, ".tx0" );
926 //WriteWyn( TXTfile );
927}

◆ WriteDAT()

int GRID_ARRAYS::WriteDAT ( char * FileName)

writes [.dat] file to pathname FileName

Definition at line 704 of file panukl_struct.cpp.

705{
706 FILE *File;
707 File = fopen( FileName, "w" );
708 if( File == NULL )
709 {
710 fprintf( stderr, "[.DAT] file open error (%s)\n", FileName );
711 return (-1);
712 }
713
714 fprintf( File, "ver %f %d\n", fVer, iSym );
715
716 fprintf( File, " %5d %5d %5d %10.4f %10.4f %10.4f %10.4f %10.4f\n",
718
719 for( int i=0; i<iMaxPanelNumber; i++ )
720 {
721 fprintf( File, " %4d", i+1 );
722 for( int j=0; j<4; j++ )
723 for( int k=0; k<3; k++ )
724 fprintf( File, " %12.7f", dX[ iMaxPanelNumber*4*k + iMaxPanelNumber*j + i ] );
725 fprintf( File, "\n" );
726 }
727
728 fprintf( File, " %d\n", iLiczp );
729
731 for( int i=0; i<iLiczp; i++ )
732 {
733 fprintf( File, " %4d", i+iMaxPanelNumber+1 );
734 for( int j=0; j<4; j++ )
735 for( int k=0; k<3; k++ )
736 fprintf( File, " %12.7f", dXw[ iRob*4*k + iRob*j + i ] );
737 fprintf( File, "\n" );
738 }
739
740 for( int i=0; i<iMaxPanelNumber; i++ )
741 {
742 fprintf( File, " %5d", i+1 );
743 for( int j=0; j<8; j++ ) fprintf( File, " %5d", iNeigh[ iMaxPanelNumber*j + i ] );
744 fprintf( File, "\n" );
745 }
746
747 for( int i=0; i<iLiczw; i++ )
748 {
749 fprintf( File, " %5d", i+1 );
750 fprintf( File, " %5d", iNnww[ i ]);
751 fprintf( File, " %5d", iNnww[ iMaxWakesNumber + i ]);
752 fprintf( File, " %5d", iNpas[ i ]);
753 for( int j=0; j<iNpas[i]+1; j++ )
754 fprintf( File, " %5d", iIpas[ iMaxWakesNumber*j + i ] );
755 fprintf( File, "\n" );
756 }
757
758 WriteObjs( File );
759
760 fclose( File );
761
762 return(0);
763}
void WriteObjs(FILE *f)
Writes objects.

◆ WriteInpFromPanels()

int GRID_ARRAYS::WriteInpFromPanels ( char * FileName,
int iScale = 0 )

writes [.inp] file to pathname FileName - data stored in panels

Definition at line 335 of file panukl_struct.cpp.

336{
337 FILE *File;
338 File = fopen( FileName, "w" );
339 if( File == NULL )
340 {
341 fprintf( stderr, "[.INP] file open error (%s)\n", FileName );
342 return (-1);
343 }
344
345 fprintf( File, "PANELS\n");
346 fprintf( File, "ver %5.2f %d\n", fVer, iSym );
347
348 double dScale = iScale ? 1. : dWsp_sk;
349
350 fprintf( File, " %5d %10.4f %10.4f %10.4f %10.4f %10.4f %10.4f\n",
352
353 PANEL rob;
354 for( int i=0; i<(int)Panels.size(); i++ )
355 {
356 fprintf (File,"%5d ",i+1);
357 rob.PutTo( Panels[i].P1*dWsp_sk, Panels[i].P2*dWsp_sk, Panels[i].P3*dWsp_sk, Panels[i].P4*dWsp_sk );
358 rob.Vout(File);
359 fprintf (File,"\n");
360 }
361
362 fprintf( File, "%d\n", iMaxBodyNeighbours );
363
364 for( int k=0; k<iMaxBodyNeighbours; k++ )
365 {
366 for( int i=0; i<3; i++ ) fprintf( File, "%d ", iKw[ iMaxBodyNeighbours*i + k ] );
367 fprintf( File, "\n" );
368 for( int i=0; i<iKw[ k ]; i++ )
369 {
370 for( int j=0; j<3; j++ ) fprintf( File, "%12.7f ", dXkw[ iMaxWakePanelNumber*3*k + iMaxWakePanelNumber*j + i ]*dWsp_sk );
371 fprintf( File, "%d\n", iNkw[ iMaxWakePanelNumber*k + i ] );
372 }
373 }
374
375 WriteObjs( File );
376 fclose( File );
377
378 return 0;
379}

◆ WriteInpFromPoints()

int GRID_ARRAYS::WriteInpFromPoints ( char * FileName,
int iScale = 0 )

writes [.inp] file to pathname FileName - data stored in nodes

Definition at line 381 of file panukl_struct.cpp.

382{
383 FILE *File;
384 File = fopen( FileName, "w" );
385 if( File == NULL )
386 {
387 fprintf( stderr, "[.INP] file open error (%s)\n", FileName );
388 return (-1);
389 }
390
391 fprintf( File, "POINTS\n");
392 fprintf( File, "ver %5.2f %d\n", fVer, iSym );
393
394 double dScale = iScale ? 1. : dWsp_sk;
395
396 fprintf( File, " %5d %5d %10.4f %10.4f %10.4f %10.4f %10.4f %10.4f\n",
397 iMaxPanelNumber, (int)Points.size(), dSS, dCa, dBs, dXca25, dZca25, dScale );
398
400 for( int i=0; i<(int)Points.size(); i++ )
401 {
402 fprintf (File,"%5d ",i+1);
403 rob = Points[i]*dWsp_sk;
404 vout( File, rob );
405 fprintf (File,"\n");
406 }
407
408 for( int i=0; i<(int)Panels.size(); i++ )
409 {
410 fprintf (File,"%5d ",i+1);
411 Panels[i].Iout(File);
412 fprintf (File,"\n");
413 }
414
415 fprintf( File, "%d\n", iMaxBodyNeighbours );
416
417 for( int k=0; k<iMaxBodyNeighbours; k++ )
418 {
419 for( int i=0; i<3; i++ ) fprintf( File, "%d ", iKw[ iMaxBodyNeighbours*i + k ] );
420 fprintf( File, "\n" );
421 for( int i=0; i<iKw[ k ]; i++ )
422 {
423 for( int j=0; j<3; j++ ) fprintf( File, "%12.7f ", dXkw[ iMaxWakePanelNumber*3*k + iMaxWakePanelNumber*j + i ]*dWsp_sk );
424 fprintf( File, "%d\n", iNkw[ iMaxWakePanelNumber*k + i ] );
425 }
426 }
427
428 WriteObjs( File );
429 fclose( File );
430
431 return 0;
432}

◆ WriteObjs() [1/2]

void GRID_ARRAYS::WriteObjs ( FILE * f)

Writes objects.

Definition at line 493 of file panukl_struct.cpp.

494{
495 WriteObjs( File, Objs );
496}

Referenced by WriteDAT(), WriteInpFromPanels(), WriteInpFromPoints(), and WriteObjs().

◆ WriteObjs() [2/2]

void GRID_ARRAYS::WriteObjs ( FILE * f,
std::vector< MS2_OBJ > & Objs )
static

Writes objects to stream (FILE) f.

Parameters
f- pointer to stream - file must be opened before
Objs- vector of MS2_OBJ objects

Definition at line 498 of file panukl_struct.cpp.

499{
500#ifdef x86_64
501 #ifdef Linux
502 fprintf( File, " %5lu\n", Objs.size() );
503 #else
504 fprintf( File, " %5llu\n", Objs.size() );
505 #endif
506#else
507 fprintf( File, " %5d\n", Objs.size() );
508#endif
509 for( int i=0; i<(int)Objs.size(); i++ )
510 fprintf( File, "%5d %5d %5d %5d %5d %5d %5d %5d %5d %s\n",
511 Objs[i].n1, Objs[i].n2, Objs[i].ID, Objs[i].iType,
512 Objs[i].SurfType, Objs[i].RibNr, Objs[i].iClosingRib,
513 Objs[i].DivNo, Objs[i].DivType, Objs[i].Name.c_str() );
514}

◆ WriteWyn()

int GRID_ARRAYS::WriteWyn ( char * FileName)

writes results array to pathname FileName

Definition at line 929 of file panukl_struct.cpp.

930{
931 FILE *f = fopen( FileName, "w" );
932 if( f == NULL )
933 {
934 fprintf(stderr, "Open problem %s: %s\n", FileName, strerror(errno) );
935 return( -1 );
936 }
937
938 fprintf(f, "No doublet source vxd vyd vzd qx qy qz v^2 cp x y z Ma cp1 cp2 cp3 cp4 cpw1 cpw2 cpw3 cpw4 ss\n");
939 for( int i=0; i<iN; i++ )
940 {
941 fprintf( f, " %5d", i+1 );
942 for( int j=0; j<23; j++ )
943 fprintf( f, " %16.8g", pdWyniki[j][i] );
944 fprintf( f, "\n" );
945 }
946 fclose( f );
947
948 return( 0 );
949}

Member Data Documentation

◆ dAi

double* GRID_ARRAYS::dAi

coefficient array (N x Nww)

Definition at line 126 of file panukl_struct.h.

Referenced by InitForPanukl(), and ~GRID_ARRAYS().

◆ dAlf1

double* GRID_ARRAYS::dAlf1

Definition at line 146 of file panukl_struct.h.

◆ dAlf2

double* GRID_ARRAYS::dAlf2

Definition at line 147 of file panukl_struct.h.

◆ dAlf3

double* GRID_ARRAYS::dAlf3

Definition at line 148 of file panukl_struct.h.

◆ dBet1

double* GRID_ARRAYS::dBet1

Definition at line 150 of file panukl_struct.h.

◆ dBet2

double* GRID_ARRAYS::dBet2

Definition at line 151 of file panukl_struct.h.

◆ dBet3

double* GRID_ARRAYS::dBet3

Definition at line 152 of file panukl_struct.h.

◆ dBs

double GRID_ARRAYS::dBs

wingspan

Definition at line 77 of file panukl_struct.h.

Referenced by ReadDAT(), ReadDATw(), ReadIN1(), ReadIN2(), WriteDAT(), WriteInpFromPanels(), and WriteInpFromPoints().

◆ dCa

◆ dCay

double* GRID_ARRAYS::dCay

strip chord

Definition at line 186 of file panukl_struct.h.

Referenced by InitForPress(), and ~GRID_ARRAYS().

◆ dCmr

double* GRID_ARRAYS::dCmr

twisting moment coefficient acting on the strip

Definition at line 185 of file panukl_struct.h.

Referenced by InitForPress(), and ~GRID_ARRAYS().

◆ dCpb

double* GRID_ARRAYS::dCpb

Definition at line 183 of file panukl_struct.h.

◆ dCpp

double* GRID_ARRAYS::dCpp

pressure coefficient

Definition at line 170 of file panukl_struct.h.

Referenced by InitForPress(), and ~GRID_ARRAYS().

◆ dCpr

double* GRID_ARRAYS::dCpr

normal force coefficient acting on the strip

Definition at line 184 of file panukl_struct.h.

Referenced by InitForPress(), and ~GRID_ARRAYS().

◆ dCxi

double* GRID_ARRAYS::dCxi

induced drag coeffcient (from strip)

Definition at line 171 of file panukl_struct.h.

Referenced by InitForPress(), and ~GRID_ARRAYS().

◆ dCxr

double* GRID_ARRAYS::dCxr

"z" force coefficient acting on the strip

Definition at line 189 of file panukl_struct.h.

Referenced by InitForPress(), and ~GRID_ARRAYS().

◆ dCyr

double* GRID_ARRAYS::dCyr

"y" force coefficient acting on the strip

Definition at line 188 of file panukl_struct.h.

Referenced by InitForPress(), and ~GRID_ARRAYS().

◆ dCzi

double* GRID_ARRAYS::dCzi

strip lift coeffcient

Definition at line 172 of file panukl_struct.h.

Referenced by InitForPress(), and ~GRID_ARRAYS().

◆ dCzr

double* GRID_ARRAYS::dCzr

"z" force coefficient acting on the strip

Definition at line 187 of file panukl_struct.h.

Referenced by InitForPress(), and ~GRID_ARRAYS().

◆ dGam1

double* GRID_ARRAYS::dGam1

Definition at line 154 of file panukl_struct.h.

◆ dGam2

double* GRID_ARRAYS::dGam2

Definition at line 155 of file panukl_struct.h.

◆ dGam3

double* GRID_ARRAYS::dGam3

Definition at line 156 of file panukl_struct.h.

◆ dMach

double* GRID_ARRAYS::dMach

lacal panel Mach number

Definition at line 174 of file panukl_struct.h.

Referenced by InitForPress(), and ~GRID_ARRAYS().

◆ dObr

double* GRID_ARRAYS::dObr

Definition at line 182 of file panukl_struct.h.

◆ dQx

double* GRID_ARRAYS::dQx

tangential undisturbed velocity - x coordinate

Definition at line 160 of file panukl_struct.h.

Referenced by InitCommon(), and ~GRID_ARRAYS().

◆ dQy

double* GRID_ARRAYS::dQy

tangential undisturbed velocity - y coordinate

Definition at line 161 of file panukl_struct.h.

Referenced by InitCommon(), and ~GRID_ARRAYS().

◆ dQz

double* GRID_ARRAYS::dQz

tangential undisturbed velocity - z coordinate

Definition at line 162 of file panukl_struct.h.

Referenced by InitCommon(), and ~GRID_ARRAYS().

◆ dRh

double* GRID_ARRAYS::dRh

working area (N)

Definition at line 128 of file panukl_struct.h.

Referenced by InitForPanukl(), and ~GRID_ARRAYS().

◆ dRhs

double* GRID_ARRAYS::dRhs

right hand side vector input - result on output (Nww2)

Definition at line 127 of file panukl_struct.h.

Referenced by InitCommon(), and ~GRID_ARRAYS().

◆ dSig

double* GRID_ARRAYS::dSig

source (singularity) value

Definition at line 163 of file panukl_struct.h.

Referenced by InitCommon(), and ~GRID_ARRAYS().

◆ dSS

double GRID_ARRAYS::dSS

reference area

Definition at line 75 of file panukl_struct.h.

Referenced by ReadDAT(), ReadDATw(), ReadIN1(), ReadIN2(), WriteDAT(), WriteInpFromPanels(), and WriteInpFromPoints().

◆ dSs_cpr

double* GRID_ARRAYS::dSs_cpr

strip area

Definition at line 178 of file panukl_struct.h.

Referenced by InitForPress(), and ~GRID_ARRAYS().

◆ dSs_cpr0

double* GRID_ARRAYS::dSs_cpr0

strip wetted area

Definition at line 179 of file panukl_struct.h.

Referenced by InitForPress(), and ~GRID_ARRAYS().

◆ dSs_rzut

double* GRID_ARRAYS::dSs_rzut

projection areas of panels on plane xy

Definition at line 177 of file panukl_struct.h.

Referenced by InitForPress(), and ~GRID_ARRAYS().

◆ dSss

double* GRID_ARRAYS::dSss

panels areas

Definition at line 176 of file panukl_struct.h.

Referenced by InitCommon(), and ~GRID_ARRAYS().

◆ dVv2

double* GRID_ARRAYS::dVv2

square of total velocity on the panel

Definition at line 173 of file panukl_struct.h.

Referenced by InitForPress(), and ~GRID_ARRAYS().

◆ dVVVV

double* GRID_ARRAYS::dVVVV

undisturbed velocity

Definition at line 169 of file panukl_struct.h.

Referenced by InitForPress(), and ~GRID_ARRAYS().

◆ dVxd

double* GRID_ARRAYS::dVxd

"x" component of induced velocity (from doublet distribution)

Definition at line 165 of file panukl_struct.h.

Referenced by InitForPress(), and ~GRID_ARRAYS().

◆ dVyd

double* GRID_ARRAYS::dVyd

"y" component of induced velocity (from doublet distribution)

Definition at line 166 of file panukl_struct.h.

Referenced by InitForPress(), and ~GRID_ARRAYS().

◆ dVzd

double* GRID_ARRAYS::dVzd

"z" component of induced velocity (from doublet distribution)

Definition at line 167 of file panukl_struct.h.

Referenced by InitForPress(), and ~GRID_ARRAYS().

◆ dWsp_sk

double GRID_ARRAYS::dWsp_sk

scale factor (default: 1)

Definition at line 72 of file panukl_struct.h.

Referenced by ReadDAT(), ReadDATw(), ReadIN1(), ReadIN2(), WriteInpFromPanels(), and WriteInpFromPoints().

◆ dX

double* GRID_ARRAYS::dX

main grid (+ wake for Panukl) X[i,j,k], i=panel number, j=corner number, k=coordinate number

Definition at line 90 of file panukl_struct.h.

Referenced by Array2Panels(), Panels2Array(), ReadDAT(), ReadDATw(), ReadIN1(), ReadIN2(), SupWyn(), WriteDAT(), and ~GRID_ARRAYS().

◆ dX0

double* GRID_ARRAYS::dX0

Definition at line 140 of file panukl_struct.h.

◆ dXca25

double GRID_ARRAYS::dXca25

x coordinate of reference point for moment calculation (usually 0.25 MAC)

Definition at line 78 of file panukl_struct.h.

Referenced by ReadDAT(), ReadDATw(), ReadIN1(), ReadIN2(), WriteDAT(), WriteInpFromPanels(), and WriteInpFromPoints().

◆ dXkw

double* GRID_ARRAYS::dXkw

side body-wake neighbours (panels)

Definition at line 92 of file panukl_struct.h.

Referenced by ReadINP(), WriteInpFromPanels(), WriteInpFromPoints(), and ~GRID_ARRAYS().

◆ dXp

double* GRID_ARRAYS::dXp

Definition at line 134 of file panukl_struct.h.

◆ dXw

double* GRID_ARRAYS::dXw

wake grid (Xw[i,j,k])

Definition at line 91 of file panukl_struct.h.

Referenced by InitRob(), ReadDATw(), WriteDAT(), and ~GRID_ARRAYS().

◆ dY0

double* GRID_ARRAYS::dY0

Definition at line 141 of file panukl_struct.h.

◆ dYp

double* GRID_ARRAYS::dYp

Definition at line 135 of file panukl_struct.h.

◆ dZ0

double* GRID_ARRAYS::dZ0

Definition at line 142 of file panukl_struct.h.

◆ dZca25

double GRID_ARRAYS::dZca25

z coordinate of reference point for moment calculation (usually 0.25 MAC)

Definition at line 79 of file panukl_struct.h.

Referenced by ReadDAT(), ReadDATw(), ReadIN1(), ReadIN2(), WriteDAT(), WriteInpFromPanels(), and WriteInpFromPoints().

◆ dZp

double* GRID_ARRAYS::dZp

Definition at line 136 of file panukl_struct.h.

◆ dZzz

double* GRID_ARRAYS::dZzz

Definition at line 181 of file panukl_struct.h.

◆ File_DAT_date

char GRID_ARRAYS::File_DAT_date[100]

date and time of mesh with wake file

Definition at line 251 of file panukl_struct.h.

Referenced by ReadDAT(), and ReadDATw().

◆ File_INP_date

char GRID_ARRAYS::File_INP_date[100]

date and time of mesh file

Definition at line 252 of file panukl_struct.h.

Referenced by ReadINP().

◆ File_TXT_date

char GRID_ARRAYS::File_TXT_date[100]

date and time of results file

Definition at line 253 of file panukl_struct.h.

Referenced by ReadWyn().

◆ fVer

float GRID_ARRAYS::fVer

version number of data file [.inp] format: from data file on input, defined in VERSION on output

Definition at line 71 of file panukl_struct.h.

Referenced by GRID_ARRAYS(), ReadDAT(), ReadDATw(), ReadINP(), ReadObjs(), WriteDAT(), WriteInpFromPanels(), and WriteInpFromPoints().

◆ iIpas

int* GRID_ARRAYS::iIpas

wake panels numbers in the strip [liczw, MaxWakePanelNumber]

Definition at line 114 of file panukl_struct.h.

Referenced by InitRob(), ReadDAT(), ReadDATw(), WriteDAT(), and ~GRID_ARRAYS().

◆ iKw

int* GRID_ARRAYS::iKw

info about side body wake neighbours iKw[i,j]
i - side body-wake neighbour number,
j = 0 - number of panels in this neighbour strip
j = 1,2 - numbers of the first and the last object panel neighbouring with the wake

Definition at line 104 of file panukl_struct.h.

Referenced by ReadINP(), WriteInpFromPanels(), WriteInpFromPoints(), and ~GRID_ARRAYS().

◆ iLiczp

int GRID_ARRAYS::iLiczp

number of wake panels

Definition at line 100 of file panukl_struct.h.

Referenced by ReadDAT(), ReadDATw(), and WriteDAT().

◆ iLiczw

int GRID_ARRAYS::iLiczw

number of wake strips

Definition at line 101 of file panukl_struct.h.

Referenced by InitForPress(), ReadDAT(), ReadDATw(), and WriteDAT().

◆ iMaxBodyNeighbours

int GRID_ARRAYS::iMaxBodyNeighbours

number of side body-wake neighbours

Definition at line 86 of file panukl_struct.h.

Referenced by ReadINP(), WriteInpFromPanels(), and WriteInpFromPoints().

◆ iMaxPanelNumber

int GRID_ARRAYS::iMaxPanelNumber

number of body (airplane) panels

Definition at line 83 of file panukl_struct.h.

Referenced by Array2Panels(), Panels2Array(), ReadDAT(), ReadDATw(), ReadIN1(), ReadIN2(), SupWyn(), WriteDAT(), WriteInpFromPanels(), and WriteInpFromPoints().

◆ iMaxWakePanelNumber

int GRID_ARRAYS::iMaxWakePanelNumber

maximum number of panels in wake strip

Definition at line 85 of file panukl_struct.h.

Referenced by GRID_ARRAYS(), InitRob(), ReadDAT(), ReadDATw(), ReadINP(), WriteDAT(), WriteInpFromPanels(), and WriteInpFromPoints().

◆ iMaxWakesNumber

int GRID_ARRAYS::iMaxWakesNumber

maximum of numbers of wake strips

Definition at line 84 of file panukl_struct.h.

Referenced by GRID_ARRAYS(), InitRob(), ReadDATw(), and WriteDAT().

◆ iMwyn

int GRID_ARRAYS::iMwyn

current number of columns of pdWyniki array (<=22)

Definition at line 259 of file panukl_struct.h.

Referenced by DeleteWyn(), ReadWyn(), and SupWyn().

◆ iN

◆ iNeigh

int* GRID_ARRAYS::iNeigh

neighbours numbers array (Nww2,8)

Definition at line 106 of file panukl_struct.h.

Referenced by ReadDAT(), ReadDATw(), ReadIN1(), ReadIN2(), SupWyn(), WriteDAT(), and ~GRID_ARRAYS().

◆ iNkw

int* GRID_ARRAYS::iNkw

numbers of panels in Xkw (wake grid)

Definition at line 103 of file panukl_struct.h.

Referenced by ReadINP(), WriteInpFromPanels(), WriteInpFromPoints(), and ~GRID_ARRAYS().

◆ iNnww

int* GRID_ARRAYS::iNnww

array containing upper surface panels neighbouring with the wake
iNnww[i,j]
i - strip number
j=1 - upper panel number
j=2 - edge number of upper panel neighbouring with the wake
j=3 - wake panel number that is the neighbour of upper panel (j=1)

Definition at line 107 of file panukl_struct.h.

Referenced by InitRob(), ReadDAT(), ReadDATw(), WriteDAT(), and ~GRID_ARRAYS().

◆ iNp

int GRID_ARRAYS::iNp

Number of nodes;.

Definition at line 119 of file panukl_struct.h.

◆ iNpas

int* GRID_ARRAYS::iNpas

number of panels in the wake strip [liczw]

Definition at line 113 of file panukl_struct.h.

Referenced by InitRob(), ReadDATw(), WriteDAT(), and ~GRID_ARRAYS().

◆ iNw

int GRID_ARRAYS::iNw

= iN + iLiczw; # airplane + wake (up) (1 panel/strip)

Definition at line 121 of file panukl_struct.h.

Referenced by ReadDAT().

◆ iNw2

int GRID_ARRAYS::iNw2

= iNw + iLiczw; # airplane + wake (up+down) (1 panel/strip)

Definition at line 122 of file panukl_struct.h.

Referenced by ReadDAT().

◆ iNww

int GRID_ARRAYS::iNww

= iN + iLiczp; # airplane + wake (up)

Definition at line 123 of file panukl_struct.h.

Referenced by InitForPanukl(), and ReadDAT().

◆ iNww2

int GRID_ARRAYS::iNww2

= iNww + iLiczw; # airplane + wake (up) + wake (down 1 panel/strip)

Definition at line 124 of file panukl_struct.h.

Referenced by InitCommon(), and ReadDAT().

◆ iNwyn

int GRID_ARRAYS::iNwyn

current number of rows of pdWyniki array

Definition at line 258 of file panukl_struct.h.

Referenced by DeleteWyn(), and ReadWyn().

◆ IPIV

int* GRID_ARRAYS::IPIV

pivot table

Definition at line 129 of file panukl_struct.h.

Referenced by InitForPanukl(), and ~GRID_ARRAYS().

◆ iSym

int GRID_ARRAYS::iSym

symmetry flag

Definition at line 130 of file panukl_struct.h.

Referenced by ReadDAT(), ReadDATw(), ReadINP(), WriteDAT(), WriteInpFromPanels(), and WriteInpFromPoints().

◆ Objs

std::vector<MS2_OBJ> GRID_ARRAYS::Objs

Objects (MS2_OBJ) vector.

Definition at line 96 of file panukl_struct.h.

Referenced by ReadObjs(), WriteObjs(), and WriteObjs().

◆ Panels

std::vector<PANEL> GRID_ARRAYS::Panels

◆ pdWyniki

double* GRID_ARRAYS::pdWyniki[23]

results array - 22 variables x number of panels

Definition at line 257 of file panukl_struct.h.

Referenced by DeleteWyn(), GRID_ARRAYS(), ReadWyn(), SupWyn(), and WriteWyn().

◆ Points

std::vector<VECTOR_3D> GRID_ARRAYS::Points

nodes array

Definition at line 95 of file panukl_struct.h.

Referenced by Corner2Points(), Panels2Points(), Points2Panels(), ReadIN2(), and WriteInpFromPoints().

◆ TXTfile

char GRID_ARRAYS::TXTfile[256]

pathname of [.txt] file

Definition at line 261 of file panukl_struct.h.

Referenced by ReadWyn().


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