20#include "panukl_con.h"
22CON_FILE::CON_FILE(
void ){
Clean(); }
24CON_FILE::~CON_FILE(
void ){}
33 for(
int i=0; i<3; i++ )
57 File =
fopen( FileName,
"r" );
60 fprintf( stderr,
"[.CON] file open error to reading (%s)\n", FileName );
98 File =
fopen( FileName,
"w" );
101 fprintf( stderr,
"[.CON] file open error to writing (%s)\n", FileName );
105 fprintf( File,
"# Connection program configuration file\n");
106 fprintf( File,
"%s # master input data file [.DAT]\n",
DAT_file_1 );
107 fprintf( File,
"%f %f %f # translation coordinates X Y Z (master)\n",
dTrans1[0],
dTrans1[1],
dTrans1[2] );
108 fprintf( File,
"%f %f %f # rotation angles phi theta psi (master)\n",
dRot1[0],
dRot1[1],
dRot1[2] );
109 fprintf( File,
"%3d # rotation origin option (0 user defined, 1 (0,0,0), 2 1/4 of MAC)\n",
iRotFlag1 );
110 fprintf( File,
"%f %f %f # rotation origin coordinates (master)\n",
dOrig1[0],
dOrig1[1],
dOrig1[2] );
111 fprintf( File,
"%s # slave input data file [.DAT]\n",
DAT_file_2 );
112 fprintf( File,
"%f %f %f # translation coordinates X Y Z (slave)\n",
dTrans2[0],
dTrans2[1],
dTrans2[2] );
113 fprintf( File,
"%f %f %f # rotation angles phi theta psi (slave)\n",
dRot2[0],
dRot2[1],
dRot2[2] );
114 fprintf( File,
"%3d # rotation origin option (0 user defined, 1 (0,0,0), 2 1/4 of MAC)\n",
iRotFlag2 );
115 fprintf( File,
"%f %f %f # rotation origin coordinates (slave)\n",
dOrig2[0],
dOrig2[1],
dOrig2[2] );
116 fprintf( File,
"%s # output data file [.DAT]\n",
DAT_file );
117 fprintf( File,
"%3d # reference values option (0 user defined, 1 master, 2 slave)\n",
iFlagRef );
118 fprintf( File,
"%f %f %f %f %f # User defined reference values :S, B, MAC, X25, Z25\n",
double dZ25ref
Z coordinate of reference origin for moment calculation defined by user.
int iRotFlag2
2nd grid rotation origin option (0 user defined, 1 (0,0,0), 2 1/4 of MAC)
double dRot2[3]
rotation of the 2nd grid (3 angles) [deg]
void Clean(void)
cleans local variables
double dSref
reference area defined by user
char DAT_file_1[256]
1st data (mesh+wake) file [.DAT] - input
double dRot1[3]
rotation of the 1st grid (3 angles) [deg]
int ReadCON(char *FileName)
reads parameters [.con] file
char DAT_file[256]
connected data (mesh+wake) file [.DAT] - output
char DAT_file_2[256]
2nd data (mesh+wake) file [.DAT] - input
char CON_file[256]
name of current [.con] file
double dTrans1[3]
translation of the 1st grid (3 coordinates)
double dOrig1[3]
origin of rotation of the 1st grid (3 coordinates)
double dX25ref
X coordinate of reference origin for moment calculation defined by user.
double dBref
reference wingspan defined by user
int iRotFlag1
1st grid rotation origin option (0 user defined, 1 (0,0,0), 2 1/4 of MAC)
int iFlagRef
reference values option (0 user defined, 1 master, 2 slave)
double dMACref
mean aerodynamic chord by user
double dOrig2[3]
origin of rotation of the 2nd grid (3 coordinates)
double dTrans2[3]
translation of the 2nd grid (3 coordinates)
int WriteCON(char *Filename)
writes parameters [.con] file
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 ...
static FILE * fopen(const char *filename, const char *mode)
Cross-platform function to fopen function that supports UTF-8 encoded name.
static void ClipFileName(char *string)
Clipping of the ending blanc characters of "string".
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"....
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.