|
RCube
Rcube Rest Server calculates sail routes based on Grib files and sailing boat polar files
|
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <stdbool.h>#include <locale.h>#include <math.h>#include <ctype.h>#include <sys/stat.h>#include "glibwrapper.h"#include "r3types.h"#include "inline.h"#include "r3util.h"
Go to the source code of this file.
Functions | |
| static bool | strtodNew (const char *str, double *v) |
| compilation: gcc -c polar.c | |
| static bool | polarCheck (PolMat *mat, char *report, size_t maxLen) |
| Check polar and return false and a report if something to say. | |
| static bool | readPolarCsv (const char *fileName, PolMat *mat, char *errMessage, size_t maxLen) |
| read polar file and fill poLMat matrix if check then polarCheck | |
| void | bestVmg (double tws, PolMat *mat, double *vmgAngle, double *vmgSpeed) |
| return VMG: angle and speed at TWS: pres | |
| void | bestVmgBack (double tws, PolMat *mat, double *vmgAngle, double *vmgSpeed) |
| return VMG back: angle and speed at TWS: vent arriere | |
| char * | polToStr (const PolMat *mat, char *str, size_t maxLen) |
| write polar information in string | |
| static bool | addSail (PolMat *polMat, int id, char *name, double max) |
| add a new sail in PoMat object | |
| void | wipeSpace (char *str) |
| wipe all spaces within str | |
| static char * | findSailPol (char *str, PolMat *polMat, PolMat *sailPolMat, char *message, size_t maxLen) |
| update polMat and sailPolMat with new sail found in Json str | |
| static char * | findListPol (bool isTws, int maxN, char *str, const char *startWith, PolMat *polMat, PolMat *sailPolMat, char *message, size_t maxLen) |
| update polMat and sailPolMat this tws ans twa lists found in Json str | |
| static bool | readPolarJson (const char *fileName, PolMat *polMat, PolMat *sailPolMat, char *errMessage, size_t maxLen) |
| read polar in json format (eg. | |
| bool | readPolar (const char *fileName, PolMat *mat, PolMat *sailPolMat, char *errMessage, size_t maxLen) |
| Launch readPolarCsv or readPolarJson according to type. | |
| char * | polToStrJson (bool report, const char *fileName, const char *objName, char *out, size_t maxLen) |
| write polar information in string Json format | |
|
static |
add a new sail in PoMat object
Definition at line 215 of file polar.c.
References PolMat::id, PolMat::max, MAX_N_SAIL, MAX_SIZE_NAME, PolMat::maxAll, PolMat::name, name, PolMat::nSail, polMat, and PolMat::tSail.
Referenced by findSailPol().

| void bestVmg | ( | double | tws, |
| PolMat * | mat, | ||
| double * | vmgAngle, | ||
| double * | vmgSpeed | ||
| ) |
return VMG: angle and speed at TWS: pres
Definition at line 163 of file polar.c.
References DEG_TO_RAD, findPolar(), PolMat::nLine, and PolMat::t.

| void bestVmgBack | ( | double | tws, |
| PolMat * | mat, | ||
| double * | vmgAngle, | ||
| double * | vmgSpeed | ||
| ) |
return VMG back: angle and speed at TWS: vent arriere
Definition at line 178 of file polar.c.
References DEG_TO_RAD, findPolar(), PolMat::nLine, and PolMat::t.

|
static |
update polMat and sailPolMat this tws ans twa lists found in Json str
Definition at line 301 of file polar.c.
References PolMat::nCol, PolMat::nLine, polMat, sailPolMat, and PolMat::t.
Referenced by readPolarJson().

|
static |
update polMat and sailPolMat with new sail found in Json str
Definition at line 237 of file polar.c.
References addSail(), PolMat::nCol, PolMat::nLine, polMat, sailName, sailPolMat, and PolMat::t.
Referenced by readPolarJson().


|
static |
Check polar and return false and a report if something to say.
Definition at line 39 of file polar.c.
References g_strlcat, MAX_SIZE_LINE, PolMat::nCol, PolMat::nLine, and PolMat::t.
Referenced by polToStrJson().

| char * polToStr | ( | const PolMat * | mat, |
| char * | str, | ||
| size_t | maxLen | ||
| ) |
write polar information in string
Definition at line 193 of file polar.c.
References g_strlcat, MAX_SIZE_LINE, PolMat::maxAll, PolMat::nCol, PolMat::nLine, PolMat::nSail, and PolMat::t.
Referenced by optionManage().

| char * polToStrJson | ( | bool | report, |
| const char * | fileName, | ||
| const char * | objName, | ||
| char * | out, | ||
| size_t | maxLen | ||
| ) |
write polar information in string Json format
Definition at line 419 of file polar.c.
References buildRootName(), PolMat::fromJson, g_strlcat, PolMat::jsonHeader, MAX_SIZE_FILE_NAME, MAX_SIZE_LINE, MAX_SIZE_TEXT, PolMat::maxAll, PolMat::name, PolMat::nCol, PolMat::nLine, PolMat::nSail, polarCheck(), readPolar(), PolMat::t, and PolMat::tSail.
Referenced by launchAction().


| bool readPolar | ( | const char * | fileName, |
| PolMat * | mat, | ||
| PolMat * | sailPolMat, | ||
| char * | errMessage, | ||
| size_t | maxLen | ||
| ) |
Launch readPolarCsv or readPolarJson according to type.
Definition at line 388 of file polar.c.
References g_str_has_suffix(), MAX_SIZE_LINE, MAX_SIZE_NAME, PolMat::maxAll, PolMat::name, newFileNameSuffix(), PolMat::nSail, readPolarCsv(), readPolarJson(), sailName, sailNameSize, sailPolMat, and PolMat::tSail.
Referenced by checkParamAndUpdate(), initContext(), and polToStrJson().


|
static |
read polar file and fill poLMat matrix if check then polarCheck
Definition at line 110 of file polar.c.
References CSV_SEP_POLAR, PolMat::jsonHeader, MAX_N_POL_MAT_COLS, MAX_N_POL_MAT_LINES, MAX_SIZE_TEXT, PolMat::maxAll, PolMat::nCol, PolMat::nLine, strtodNew(), and PolMat::t.
Referenced by readPolar().


|
static |
read polar in json format (eg.
VirtualRegatta) with several sails
Definition at line 337 of file polar.c.
References findListPol(), findSailPol(), PolMat::fromJson, PolMat::jsonHeader, MAX_N_POL_MAT_COLS, MAX_N_POL_MAT_LINES, polMat, readTextFile(), sailPolMat, and wipeSpace().
Referenced by readPolar().


|
static |
compilation: gcc -c polar.c
str to double accepting both . or , as decimal separator
Definition at line 17 of file polar.c.
References isNumber().
Referenced by readPolarCsv().


| void wipeSpace | ( | char * | str | ) |
wipe all spaces within str
Definition at line 227 of file polar.c.
Referenced by readPolarJson().
