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

Parameters file for Connect program - grid connection. More...

#include <panukl_con.h>

Inheritance diagram for CON_FILE:
IOFUN

Public Member Functions

void Clean (void)
 cleans local variables
 
int ReadCON (char *FileName)
 reads parameters [.con] file
 
int WriteCON (char *Filename)
 writes parameters [.con] file
 

Public Attributes

char DAT_file_1 [256]
 1st data (mesh+wake) file [.DAT] - input
 
char DAT_file_2 [256]
 2nd data (mesh+wake) file [.DAT] - input
 
char DAT_file [256]
 connected data (mesh+wake) file [.DAT] - output
 
double dTrans1 [3]
 translation of the 1st grid (3 coordinates)
 
double dTrans2 [3]
 translation of the 2nd grid (3 coordinates)
 
double dRot1 [3]
 rotation of the 1st grid (3 angles) [deg]
 
double dRot2 [3]
 rotation of the 2nd grid (3 angles) [deg]
 
double dOrig1 [3]
 origin of rotation of the 1st grid (3 coordinates)
 
double dOrig2 [3]
 origin of rotation of the 2nd grid (3 coordinates)

 
int iRotFlag1
 1st grid rotation origin option (0 user defined, 1 (0,0,0), 2 1/4 of MAC)
 
int iRotFlag2
 2nd grid rotation origin option (0 user defined, 1 (0,0,0), 2 1/4 of MAC)
 
double dSref
 reference area defined by user
 
double dBref
 reference wingspan defined by user
 
double dMACref
 mean aerodynamic chord by user
 
double dX25ref
 X coordinate of reference origin for moment calculation defined by user.
 
double dZ25ref
 Z coordinate of reference origin for moment calculation defined by user.
 
int iFlagRef
 reference values option (0 user defined, 1 master, 2 slave)
 
char CON_file [256]
 name of current [.con] file
 

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 Connect program - grid connection.

Definition at line 27 of file panukl_con.h.

Constructor & Destructor Documentation

◆ CON_FILE()

CON_FILE::CON_FILE ( void )

Definition at line 22 of file panukl_con.cpp.

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

◆ ~CON_FILE()

CON_FILE::~CON_FILE ( void )

Definition at line 24 of file panukl_con.cpp.

24{}

Member Function Documentation

◆ Clean()

void CON_FILE::Clean ( void )

cleans local variables

Definition at line 26 of file panukl_con.cpp.

27{
28 memset( DAT_file_1, 0, 256 );
29 memset( DAT_file_2, 0, 256 );
30 memset( DAT_file, 0, 256 );
31 memset( CON_file, 0, 256 );
32
33 for( int i=0; i<3; i++ )
34 {
35 dTrans1[i] = 0.;
36 dTrans2[i] = 0.;
37 dRot1[i] = 0.;
38 dRot2[i] = 0.;
39 dOrig1[i] = 0.;
40 dOrig2[i] = 0.;
41 }
42
43 iRotFlag1 = 0;
44 iRotFlag2 = 0;
45
46 dSref = 0.;
47 dBref = 0.;
48 dMACref = 0.;
49 dX25ref = 0.;
50 dZ25ref = 0.;
51 iFlagRef = 0;
52}
double dZ25ref
Z coordinate of reference origin for moment calculation defined by user.
Definition panukl_con.h:49
int iRotFlag2
2nd grid rotation origin option (0 user defined, 1 (0,0,0), 2 1/4 of MAC)
Definition panukl_con.h:43
double dRot2[3]
rotation of the 2nd grid (3 angles) [deg]
Definition panukl_con.h:39
double dSref
reference area defined by user
Definition panukl_con.h:45
char DAT_file_1[256]
1st data (mesh+wake) file [.DAT] - input
Definition panukl_con.h:31
double dRot1[3]
rotation of the 1st grid (3 angles) [deg]
Definition panukl_con.h:38
char DAT_file[256]
connected data (mesh+wake) file [.DAT] - output
Definition panukl_con.h:34
char DAT_file_2[256]
2nd data (mesh+wake) file [.DAT] - input
Definition panukl_con.h:32
char CON_file[256]
name of current [.con] file
Definition panukl_con.h:52
double dTrans1[3]
translation of the 1st grid (3 coordinates)
Definition panukl_con.h:36
double dOrig1[3]
origin of rotation of the 1st grid (3 coordinates)
Definition panukl_con.h:40
double dX25ref
X coordinate of reference origin for moment calculation defined by user.
Definition panukl_con.h:48
double dBref
reference wingspan defined by user
Definition panukl_con.h:46
int iRotFlag1
1st grid rotation origin option (0 user defined, 1 (0,0,0), 2 1/4 of MAC)
Definition panukl_con.h:42
int iFlagRef
reference values option (0 user defined, 1 master, 2 slave)
Definition panukl_con.h:50
double dMACref
mean aerodynamic chord by user
Definition panukl_con.h:47
double dOrig2[3]
origin of rotation of the 2nd grid (3 coordinates)
Definition panukl_con.h:41
double dTrans2[3]
translation of the 2nd grid (3 coordinates)
Definition panukl_con.h:37

◆ ReadCON()

int CON_FILE::ReadCON ( char * FileName)

reads parameters [.con] file

Definition at line 54 of file panukl_con.cpp.

55{
56 FILE *File;
57 File = fopen( FileName, "r" );
58 if( File == NULL )
59 {
60 fprintf( stderr, "[.CON] file open error to reading (%s)\n", FileName );
61 return (-1);
62 }
63
64 //ReadComm( File );
65 char cRob[256];
66
67 ReadStr( File, DAT_file_1 );
69
70 ReadVect( File, dTrans1, 3 );
71 ReadVect( File, dRot1, 3 );
72 ReadPar ( File, "%d", &iRotFlag1 );
73 ReadVect( File, dOrig1, 3 );
74
75 ReadStr( File, DAT_file_2 );
77
78 ReadVect( File, dTrans2, 3 );
79 ReadVect( File, dRot2, 3 );
80 ReadPar ( File, "%d", &iRotFlag2 );
81 ReadVect( File, dOrig2, 3 );
82
83 ReadStr( File, DAT_file );
85
86 ReadPar ( File, "%d", &iFlagRef );
87 ReadStr( File, cRob );
88 sscanf( cRob, "%lf %lf %lf %lf %lf", &dSref, &dBref, &dMACref, &dX25ref, &dZ25ref );
89
90 fclose( File );
91
92 return (0);
93}
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 ...
Definition iofun.cpp:99
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 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

◆ WriteCON()

int CON_FILE::WriteCON ( char * Filename)

writes parameters [.con] file

Definition at line 95 of file panukl_con.cpp.

96{
97 FILE *File;
98 File = fopen( FileName, "w" );
99 if( File == NULL )
100 {
101 fprintf( stderr, "[.CON] file open error to writing (%s)\n", FileName );
102 return (-1);
103 }
104
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",
120
121 fclose( File );
122
123 return (0);
124}

Member Data Documentation

◆ CON_file

char CON_FILE::CON_file[256]

name of current [.con] file

Definition at line 52 of file panukl_con.h.

Referenced by Clean().

◆ DAT_file

char CON_FILE::DAT_file[256]

connected data (mesh+wake) file [.DAT] - output

Definition at line 34 of file panukl_con.h.

Referenced by Clean(), ReadCON(), and WriteCON().

◆ DAT_file_1

char CON_FILE::DAT_file_1[256]

1st data (mesh+wake) file [.DAT] - input

Definition at line 31 of file panukl_con.h.

Referenced by Clean(), ReadCON(), and WriteCON().

◆ DAT_file_2

char CON_FILE::DAT_file_2[256]

2nd data (mesh+wake) file [.DAT] - input

Definition at line 32 of file panukl_con.h.

Referenced by Clean(), ReadCON(), and WriteCON().

◆ dBref

double CON_FILE::dBref

reference wingspan defined by user

Definition at line 46 of file panukl_con.h.

Referenced by Clean(), ReadCON(), and WriteCON().

◆ dMACref

double CON_FILE::dMACref

mean aerodynamic chord by user

Definition at line 47 of file panukl_con.h.

Referenced by Clean(), ReadCON(), and WriteCON().

◆ dOrig1

double CON_FILE::dOrig1[3]

origin of rotation of the 1st grid (3 coordinates)

Definition at line 40 of file panukl_con.h.

Referenced by Clean(), ReadCON(), and WriteCON().

◆ dOrig2

double CON_FILE::dOrig2[3]

origin of rotation of the 2nd grid (3 coordinates)

Definition at line 41 of file panukl_con.h.

Referenced by Clean(), ReadCON(), and WriteCON().

◆ dRot1

double CON_FILE::dRot1[3]

rotation of the 1st grid (3 angles) [deg]

Definition at line 38 of file panukl_con.h.

Referenced by Clean(), ReadCON(), and WriteCON().

◆ dRot2

double CON_FILE::dRot2[3]

rotation of the 2nd grid (3 angles) [deg]

Definition at line 39 of file panukl_con.h.

Referenced by Clean(), ReadCON(), and WriteCON().

◆ dSref

double CON_FILE::dSref

reference area defined by user

Definition at line 45 of file panukl_con.h.

Referenced by Clean(), ReadCON(), and WriteCON().

◆ dTrans1

double CON_FILE::dTrans1[3]

translation of the 1st grid (3 coordinates)

Definition at line 36 of file panukl_con.h.

Referenced by Clean(), ReadCON(), and WriteCON().

◆ dTrans2

double CON_FILE::dTrans2[3]

translation of the 2nd grid (3 coordinates)

Definition at line 37 of file panukl_con.h.

Referenced by Clean(), ReadCON(), and WriteCON().

◆ dX25ref

double CON_FILE::dX25ref

X coordinate of reference origin for moment calculation defined by user.

Definition at line 48 of file panukl_con.h.

Referenced by Clean(), ReadCON(), and WriteCON().

◆ dZ25ref

double CON_FILE::dZ25ref

Z coordinate of reference origin for moment calculation defined by user.

Definition at line 49 of file panukl_con.h.

Referenced by Clean(), ReadCON(), and WriteCON().

◆ iFlagRef

int CON_FILE::iFlagRef

reference values option (0 user defined, 1 master, 2 slave)

Definition at line 50 of file panukl_con.h.

Referenced by Clean(), ReadCON(), and WriteCON().

◆ iRotFlag1

int CON_FILE::iRotFlag1

1st grid rotation origin option (0 user defined, 1 (0,0,0), 2 1/4 of MAC)

Definition at line 42 of file panukl_con.h.

Referenced by Clean(), ReadCON(), and WriteCON().

◆ iRotFlag2

int CON_FILE::iRotFlag2

2nd grid rotation origin option (0 user defined, 1 (0,0,0), 2 1/4 of MAC)

Definition at line 43 of file panukl_con.h.

Referenced by Clean(), ReadCON(), and WriteCON().


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