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

Parameters file for Panukl program (computation of velocity potential distribution) More...

#include <panukl_par.h>

Inheritance diagram for PAR_FILE:
IOFUN

Public Member Functions

void Clean ()
 cleans local variables

 
int ReadPAR (char *FileName)
 reads parameters file
 
int WritePAR (char *Filename)
 writes parameters file
 

Public Attributes

char DAT_file [256]
 input file - mesh + wake data file [.DAT]
 
char PAN_file [256]
 output file - doublet distribution file [.PAN]
 
char ACD_file [256]
 optional input file - propellers data configuration file [.ACD]
 
double dAlfa
 angle of attack [deg]
 
double dBeta
 sideslip angle [deg]
 
double dMach
 Mach number.
 
double dP
 roll rate [rad/s]
 
double dQ
 pitch rate [rad/s]
 
double dR
 yaw rate [rad/s]
 
int iProc
 type of linear system solver (1-LAPACK OPTIMIZED, 0-NOT OPTIMIZED)
 
int iACD
 flag of using the propellers data configuration file (0-no file, 1-file present)
 
char PAR_file [256]
 current parameters file [.PAR]
 

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 Panukl program (computation of velocity potential distribution)

Definition at line 27 of file panukl_par.h.

Constructor & Destructor Documentation

◆ PAR_FILE()

PAR_FILE::PAR_FILE ( void )

Definition at line 22 of file panukl_par.cpp.

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

◆ ~PAR_FILE()

PAR_FILE::~PAR_FILE ( void )

Definition at line 24 of file panukl_par.cpp.

24{}

Member Function Documentation

◆ Clean()

void PAR_FILE::Clean ( void )

cleans local variables

Definition at line 26 of file panukl_par.cpp.

27{
28 memset( DAT_file, 0, 256 );
29 memset( PAN_file, 0, 256 );
30 memset( ACD_file, 0, 256 );
31
32 dAlfa = 0.0;
33 dBeta = 0.0;
34 dP = dQ = dR = 0.0;
35 iProc = 0;
36 dMach = 0.0;
37 iACD = 0;
38}
int iProc
type of linear system solver (1-LAPACK OPTIMIZED, 0-NOT OPTIMIZED)
Definition panukl_par.h:41
double dAlfa
angle of attack [deg]
Definition panukl_par.h:35
int iACD
flag of using the propellers data configuration file (0-no file, 1-file present)
Definition panukl_par.h:42
char ACD_file[256]
optional input file - propellers data configuration file [.ACD]
Definition panukl_par.h:33
double dBeta
sideslip angle [deg]
Definition panukl_par.h:36
double dMach
Mach number.
Definition panukl_par.h:37
char DAT_file[256]
input file - mesh + wake data file [.DAT]
Definition panukl_par.h:31
double dP
roll rate [rad/s]
Definition panukl_par.h:38
double dQ
pitch rate [rad/s]
Definition panukl_par.h:39
double dR
yaw rate [rad/s]
Definition panukl_par.h:40
char PAN_file[256]
output file - doublet distribution file [.PAN]
Definition panukl_par.h:32

◆ ReadPAR()

int PAR_FILE::ReadPAR ( char * FileName)

reads parameters file

Definition at line 40 of file panukl_par.cpp.

41{
42 FILE *File;
43 File = fopen( FileName, "r" );
44 if( File == NULL )
45 {
46 fprintf( stderr, "[.PAR] file open error to reading (%s)\n", FileName );
47 return (-1);
48 }
49
50 ReadComm( File );
51 ReadStr( File, DAT_file );
52 ReadStr( File, PAN_file );
53 ReadPar( File, "%lf", &dAlfa );
54 ReadPar( File, "%lf", &dBeta );
55 ReadPar( File, "%lf", &dP );
56 ReadPar( File, "%lf", &dQ );
57 ReadPar( File, "%lf", &dR );
58 ReadPar( File, "%d", &iProc );
59 if(ReadPar( File, "%lf", &dMach )==EOF)dMach=0.;
60 if(ReadPar( File, "%d", &iACD )==EOF)iACD=0;
61 if(iACD)ReadStr( File, ACD_file );
62
63 fclose( File );
64
68
69 strcpy( PAR_file, FileName );
70
71 return (0);
72}
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
char PAR_file[256]
current parameters file [.PAR]
Definition panukl_par.h:43

◆ WritePAR()

int PAR_FILE::WritePAR ( char * Filename)

writes parameters file

Definition at line 74 of file panukl_par.cpp.

75{
76 FILE *File;
77 File = fopen( FileName, "w" );
78 if( File == NULL )
79 {
80 fprintf( stderr, "[.PAR] file open error to writing (%s)\n", FileName );
81 return (-1);
82 }
83
84 fprintf( File, "# Panukl main program configuration file\n");
85 fprintf( File, "%s # input data file (grid with wake)\n", DAT_file );
86 fprintf( File, "%s # output file (input for Press program)\n", PAN_file );
87 fprintf( File, "%6.2f # alfa - angle of attack [deg]\n", dAlfa );
88 fprintf( File, "%6.2f # beta - sideslip angle [deg]\n", dBeta );
89 fprintf( File, "%6.2f # P - roll rate [rad/s]\n", dP );
90 fprintf( File, "%6.2f # Q - pitch rate [rad/s]\n", dQ );
91 fprintf( File, "%6.2f # R - yaw rate [rad/s]\n", dR );
92 fprintf( File, "%3d # type of linear system solver (1-LAPACK OPTIMIZED, 0-NOT OPTIMIZED)\n", iProc );
93 fprintf( File, "%6.3f # Mach number\n", dMach );
94 fprintf( File, "%3d # ACD file flag\n", iACD );
95 if(iACD)fprintf( File, "%s # propeller data configuration file (input)\n", ACD_file );
96
97
98 fclose( File );
99
100 return (0);
101}

Member Data Documentation

◆ ACD_file

char PAR_FILE::ACD_file[256]

optional input file - propellers data configuration file [.ACD]

Definition at line 33 of file panukl_par.h.

Referenced by Clean(), ReadPAR(), and WritePAR().

◆ dAlfa

double PAR_FILE::dAlfa

angle of attack [deg]

Definition at line 35 of file panukl_par.h.

Referenced by Clean(), ReadPAR(), and WritePAR().

◆ DAT_file

char PAR_FILE::DAT_file[256]

input file - mesh + wake data file [.DAT]

Definition at line 31 of file panukl_par.h.

Referenced by Clean(), ReadPAR(), and WritePAR().

◆ dBeta

double PAR_FILE::dBeta

sideslip angle [deg]

Definition at line 36 of file panukl_par.h.

Referenced by Clean(), ReadPAR(), and WritePAR().

◆ dMach

double PAR_FILE::dMach

Mach number.

Definition at line 37 of file panukl_par.h.

Referenced by Clean(), ReadPAR(), and WritePAR().

◆ dP

double PAR_FILE::dP

roll rate [rad/s]

Definition at line 38 of file panukl_par.h.

Referenced by Clean(), ReadPAR(), and WritePAR().

◆ dQ

double PAR_FILE::dQ

pitch rate [rad/s]

Definition at line 39 of file panukl_par.h.

Referenced by Clean(), ReadPAR(), and WritePAR().

◆ dR

double PAR_FILE::dR

yaw rate [rad/s]

Definition at line 40 of file panukl_par.h.

Referenced by Clean(), ReadPAR(), and WritePAR().

◆ iACD

int PAR_FILE::iACD

flag of using the propellers data configuration file (0-no file, 1-file present)

Definition at line 42 of file panukl_par.h.

Referenced by Clean(), ReadPAR(), and WritePAR().

◆ iProc

int PAR_FILE::iProc

type of linear system solver (1-LAPACK OPTIMIZED, 0-NOT OPTIMIZED)

Definition at line 41 of file panukl_par.h.

Referenced by Clean(), ReadPAR(), and WritePAR().

◆ PAN_file

char PAR_FILE::PAN_file[256]

output file - doublet distribution file [.PAN]

Definition at line 32 of file panukl_par.h.

Referenced by Clean(), ReadPAR(), and WritePAR().

◆ PAR_file

char PAR_FILE::PAR_file[256]

current parameters file [.PAR]

Definition at line 43 of file panukl_par.h.

Referenced by ReadPAR().


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