RCube
Rcube Rest Server calculates sail routes based on Grib files and sailing boat polar files
Loading...
Searching...
No Matches
r3util.c File Reference
#include <float.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <sys/stat.h>
#include <dirent.h>
#include <unistd.h>
#include <time.h>
#include <math.h>
#include <locale.h>
#include "glibwrapper.h"
#include "r3types.h"
#include "inline.h"
Include dependency graph for r3util.c:

Go to the source code of this file.

Macros

#define MAX_N_SHIP_TYPE   2
 compilation: gcc -c r3util.c
 

Functions

char * fSailName (int val, char *str, size_t maxLen)
 return the name of the sail
 
char * newFileNameSuffix (const char *fileName, const char *suffix, char *newFileName, size_t maxLen)
 replace former suffix (after last dot) by suffix example : "pol/bibi.toto.csv" with suffix "sailpol" will give: "pol/bibi.toto.sailpol"
 
bool isEmpty (const char *str)
 return true if str is empty
 
char * formatThousandSep (char *buffer, size_t maxLen, long value)
 format big number with thousand sep.
 
bool hasSlash (const char *name)
 true if name terminates with slash
 
bool mostRecentFile (const char *directory, const char *pattern0, const char *pattern1, char *name, size_t maxLen)
 select most recent file in "directory" that contains "pattern0" and "pattern1" in name return true if found with name of selected file
 
bool isNumber (const char *name)
 true if name contains a number
 
double getCoord (const char *str, double minLimit, double maxLimit)
 translate str in double for latitude longitude
 
char * buildRootName (const char *fileName, char *rootName, size_t maxLen)
 Build root name if not already a root name.
 
char * epochToStr (time_t t, bool seconds, char *str, size_t maxLen)
 convert epoch time to string with or without seconds
 
double offsetLocalUTC (void)
 return offset Local UTC in seconds
 
char * gribDateTimeToStr (long date, long time, char *str, size_t maxLen)
 return str representing grib date
 
struct tm gribDateToTm (long intDate, double nHours)
 return tm struct equivalent to date hours found in grib (UTC time) struct tm gribDateToTm (long intDate, double nHours) { struct tm tm0 = {0}; tm0.tm_year = (intDate / 10000) - 1900; tm0.tm_mon = ((intDate % 10000) / 100) - 1; tm0.tm_mday = intDate % 100; tm0.tm_isdst = -1;
const int totalMinutes = (int)(nHours * 60); tm0.tm_min += totalMinutes; // adjust tm0 struct (manage day, mon year overflow) mktime (&tm0);
return tm0; }
 
static bool bissextile (int year)
 retrurn true if year is bissextile

 
static bool getYMDHM (long dataDate, double nHours, int *yyyy, int *mm, int *dd, int *hh, int *min)
 return year, month (1..12), day, hour, minutes from Grib dataDate and hours
 
char * otherNewDate (long dataDate, double nHours, char *res, size_t maxLen)
 return date and time using ISO notation after adding myTime (hours) to the Date
 
char * newDate (long intDate, double nHours, char *res, size_t maxLen)
 return date and time using ISO notation after adding myTime (hours) to the Date
 
char * newDateWeekDay (long intDate, double nHours, char *res, size_t maxLen)
 return date and time using week day after adding myTime (hours) to the Date
 
char * newDateWeekDayVerbose (long intDate, double nHours, char *res, size_t maxLen)
 return date and time using week day after adding myTime (hours) to the Date
 
time_t gribDateTimeToEpoch (long date, long hhmm)
 convert long date/time from GRIB to time_t (UTC, via timegm)
 
double getDepartureTimeInHour (struct tm *startUtc)
 calculate difference in hours between departure time in UTC and time 0
 
char * durationToStr (double duration, char *res, size_t maxLen)
 convert hours in string with days, hours, minutes
 
char * latToStr (double lat, int type, char *str, size_t maxLen)
 convert lat to str according to type
 
char * lonToStr (double lon, int type, char *str, size_t maxLen)
 convert lon to str according to type
 
bool readIsSea (const char *fileName)
 read issea file and fill table tIsSea
 
static bool isInPolygon (double lat, double lon, const MyPolygon *po)
 fill str with polygon information
 
static bool isInForbidArea (double lat, double lon)
 return true if p is in forbid area
 
void updateIsSeaWithForbiddenAreas (void)
 complement according to forbidden areas
 
static void forbidZoneAdd (char *line, int n)
 read forbid zone format [[lat, lon], [lat, lon] ...] ...
 
bool readParam (const char *fileName, bool initDisp)
 read parameter file and build par struct
 
static void fprintfNoNull (FILE *f, const char *fmt, const char *param)
 
static void fprintfNoZero (FILE *f, const char *fmt, int param)
 
bool writeParam (const char *fileName, bool header, bool password, bool yaml)
 write parameter file from struct par header or not, password or not yaml style or not
 
double fPenalty (int shipIndex, int type, double tws, double energy, double *cStamina, bool fullPack)
 for virtual Regatta.
 
double fPointLoss (int shipIndex, int type, double tws, bool fullPack)
 for virtual Regatta.
 
double fTimeToRecupOnePoint (double tws)
 for virtual Regatta.
 
char * paramToStrJson (Par *par, char *out, size_t maxLen)
 Return JSON formatted subset of parameters into 'out'.
 
int nearestPort (double lat, double lon, const char *fileName, char *res, size_t maxLen)
 return id and name of nearest port found in file fileName from lat, lon.
 
double monotonic (void)
 return seconds with decimals
 
char * readTextFile (const char *fileName, char *errMessage, size_t maxLen)
 read all text file in buffer.
 
bool readMarkCSVToJson (const char *fileName, char *out, size_t maxLen)
 read CSV file marks (Virtual Regatta) if check then polarCheck
 
void normalizeSpaces (char *s)
 replace multiple spaces by just one
 

Variables

struct { 
 
   char   name [MAX_SIZE_NAME
 
   double   cShip 
 
   double   tMin [3] 
 
   double   tMax [3] 
 
shipParam [MAX_N_SHIP_TYPE
 
MyPolygon forbidZones [MAX_N_FORBID_ZONE]
 forbid ones is a set of polygons
 
const struct MeteoElmt meteoTab [N_METEO_ADMIN] = {{7, "Weather service US"}, {78, "DWD Germany"}, {85, "Meteo France"}, {98,"ECMWF European"}}
 dictionnary of meteo services
 
const size_t sailNameSize = 7
 sail attributes
 
const char * sailName [] = {"C0", "HG", "Jib", "LG", "LJ", "Spi", "SS"}
 
const char * colorStr [] = {"green", "purple", "gray", "blue", "yellow", "orange", "red"}
 
WayPointList wayPoints
 list of wayPoint
 
CompetitorsList competitors
 list of competitors
 
PolMat polMat
 polar matrix description
 
PolMat sailPolMat
 polar matrix for sails
 
PolMat wavePolMat
 polar matrix for waves
 
Par par
 parameter
 
char * tIsSea = NULL
 table describing if sea or earth
 
Zone zone
 geographic zone covered by grib file
 
Zone currentZone
 

Macro Definition Documentation

◆ MAX_N_SHIP_TYPE

#define MAX_N_SHIP_TYPE   2

compilation: gcc -c r3util.c

Definition at line 2 of file r3util.c.

Function Documentation

◆ bissextile()

static bool bissextile ( int  year)
inlinestatic

retrurn true if year is bissextile

Definition at line 323 of file r3util.c.

Referenced by getYMDHM().

Here is the caller graph for this function:

◆ buildRootName()

char * buildRootName ( const char *  fileName,
char *  rootName,
size_t  maxLen 
)

Build root name if not already a root name.

Combines the working directory with the file name if it is not absolute. Stores the result in rootName and ensures it does not exceed maxLen.

Parameters
fileNameThe name of the file (absolute or relative).
rootNameThe buffer to store the resulting root name.
maxLenThe maximum length of the buffer rootName.
Returns
A pointer to rootName, or NULL on error.

abolute path POSIX : begin with '/'

Definition at line 230 of file r3util.c.

References hasSlash(), par, WORKING_DIR, and Par::workingDir.

Referenced by checkParamAndUpdate(), gribToStrJson(), launchAction(), polToStrJson(), readParam(), updateCurrentGrib(), and updateWindGrib().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ durationToStr()

char * durationToStr ( double  duration,
char *  res,
size_t  maxLen 
)

convert hours in string with days, hours, minutes

Definition at line 429 of file r3util.c.

Referenced by routeToStr().

Here is the caller graph for this function:

◆ epochToStr()

char * epochToStr ( time_t  t,
bool  seconds,
char *  str,
size_t  maxLen 
)

convert epoch time to string with or without seconds

functions defined in r3util.c

Definition at line 247 of file r3util.c.

Referenced by optionManage().

Here is the caller graph for this function:

◆ forbidZoneAdd()

static void forbidZoneAdd ( char *  line,
int  n 
)
static

read forbid zone format [[lat, lon], [lat, lon] ...] ...

Definition at line 548 of file r3util.c.

References forbidZones, getCoord(), Point::lat, Point::lon, MAX_LAT, MAX_LON, MAX_SIZE_FORBID_ZONE, MIN_LAT, MIN_LON, MyPolygon::n, and MyPolygon::points.

Referenced by readParam().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ formatThousandSep()

char * formatThousandSep ( char *  buffer,
size_t  maxLen,
long  value 
)

format big number with thousand sep.

Example 1000000 formated as 1 000 000

Definition at line 104 of file r3util.c.

References MAX_SIZE_LINE.

Referenced by testToJson().

Here is the caller graph for this function:

◆ fPenalty()

double fPenalty ( int  shipIndex,
int  type,
double  tws,
double  energy,
double *  cStamina,
bool  fullPack 
)

for virtual Regatta.

return penalty in seconds for manoeuvre type. Depend on tws and energy. Give also sTamina coefficient

Definition at line 984 of file r3util.c.

References cShip, fTws(), G_PI, shipParam, tMax, and tMin.

Here is the call graph for this function:

◆ fPointLoss()

double fPointLoss ( int  shipIndex,
int  type,
double  tws,
bool  fullPack 
)

for virtual Regatta.

return point loss with manoeuvre types. Depends on tws and fullPack

Definition at line 1002 of file r3util.c.

References cShip, fTws(), and shipParam.

Referenced by statRoute().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fprintfNoNull()

static void fprintfNoNull ( FILE *  f,
const char *  fmt,
const char *  param 
)
static

Definition at line 815 of file r3util.c.

Referenced by writeParam().

Here is the caller graph for this function:

◆ fprintfNoZero()

static void fprintfNoZero ( FILE *  f,
const char *  fmt,
int  param 
)
static

Definition at line 819 of file r3util.c.

Referenced by writeParam().

Here is the caller graph for this function:

◆ fSailName()

char * fSailName ( int  val,
char *  str,
size_t  maxLen 
)

return the name of the sail

Definition at line 68 of file r3util.c.

References g_strlcpy, PolMat::name, PolMat::nSail, polMat, and PolMat::tSail.

Referenced by routeToJson(), and routeToStr().

Here is the caller graph for this function:

◆ fTimeToRecupOnePoint()

double fTimeToRecupOnePoint ( double  tws)

for virtual Regatta.

return type in second to get back one energy point

Definition at line 1014 of file r3util.c.

References fTws(), and G_PI.

Referenced by statRoute().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCoord()

double getCoord ( const char *  str,
double  minLimit,
double  maxLimit 
)

translate str in double for latitude longitude

Definition at line 179 of file r3util.c.

References CLAMP.

Referenced by forbidZoneAdd(), readMarkCSVToJson(), and readParam().

Here is the caller graph for this function:

◆ getDepartureTimeInHour()

double getDepartureTimeInHour ( struct tm *  startUtc)

calculate difference in hours between departure time in UTC and time 0

Definition at line 420 of file r3util.c.

References Zone::dataDate, Zone::dataTime, gribDateTimeToEpoch(), and zone.

Here is the call graph for this function:

◆ getYMDHM()

static bool getYMDHM ( long  dataDate,
double  nHours,
int *  yyyy,
int *  mm,
int *  dd,
int *  hh,
int *  min 
)
static

return year, month (1..12), day, hour, minutes from Grib dataDate and hours

Definition at line 328 of file r3util.c.

References bissextile().

Referenced by otherNewDate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gribDateTimeToEpoch()

time_t gribDateTimeToEpoch ( long  date,
long  hhmm 
)

convert long date/time from GRIB to time_t (UTC, via timegm)

Definition at line 408 of file r3util.c.

Referenced by checkParamAndUpdate(), getDepartureTimeInHour(), gribToStrJson(), infoCoordToJson(), optionManage(), timeIntersectGrib(), and zoneTimeDiff().

Here is the caller graph for this function:

◆ gribDateTimeToStr()

char * gribDateTimeToStr ( long  date,
long  time,
char *  str,
size_t  maxLen 
)

return str representing grib date

Definition at line 276 of file r3util.c.

Referenced by initContext(), and optionManage().

Here is the caller graph for this function:

◆ gribDateToTm()

struct tm gribDateToTm ( long  intDate,
double  nHours 
)

return tm struct equivalent to date hours found in grib (UTC time) struct tm gribDateToTm (long intDate, double nHours) { struct tm tm0 = {0}; tm0.tm_year = (intDate / 10000) - 1900; tm0.tm_mon = ((intDate % 10000) / 100) - 1; tm0.tm_mday = intDate % 100; tm0.tm_isdst = -1;
const int totalMinutes = (int)(nHours * 60); tm0.tm_min += totalMinutes; // adjust tm0 struct (manage day, mon year overflow) mktime (&tm0);
return tm0; }

Definition at line 299 of file r3util.c.

Referenced by newDate(), newDateWeekDay(), and newDateWeekDayVerbose().

Here is the caller graph for this function:

◆ hasSlash()

bool hasSlash ( const char *  name)

true if name terminates with slash

Definition at line 130 of file r3util.c.

References name.

Referenced by buildRootName(), checkParamAndUpdate(), initContext(), launchAction(), and mostRecentFile().

Here is the caller graph for this function:

◆ isEmpty()

bool isEmpty ( const char *  str)

return true if str is empty

Definition at line 94 of file r3util.c.

References g_ascii_isspace().

Here is the call graph for this function:

◆ isInForbidArea()

static bool isInForbidArea ( double  lat,
double  lon 
)
static

return true if p is in forbid area

Definition at line 526 of file r3util.c.

References forbidZones, isInPolygon(), Par::nForbidZone, and par.

Referenced by updateIsSeaWithForbiddenAreas().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isInPolygon()

static bool isInPolygon ( double  lat,
double  lon,
const MyPolygon po 
)
static

fill str with polygon information

return true if p is in polygon po Ray casting algorithm

Definition at line 512 of file r3util.c.

References Point::lat, Point::lon, MyPolygon::n, and MyPolygon::points.

Referenced by isInForbidArea().

Here is the caller graph for this function:

◆ isNumber()

bool isNumber ( const char *  name)

true if name contains a number

Definition at line 174 of file r3util.c.

References name.

Referenced by strtodNew().

Here is the caller graph for this function:

◆ latToStr()

char * latToStr ( double  lat,
int  type,
char *  str,
size_t  maxLen 
)

convert lat to str according to type

Definition at line 440 of file r3util.c.

References BASIC, DD, DM, DMS, and g_strlcpy.

Referenced by gribToStr(), isoDescToStr(), logReport(), routeToStr(), and writeParam().

Here is the caller graph for this function:

◆ lonToStr()

char * lonToStr ( double  lon,
int  type,
char *  str,
size_t  maxLen 
)

convert lon to str according to type

Definition at line 462 of file r3util.c.

References BASIC, DD, DM, DMS, and g_strlcpy.

Referenced by gribToStr(), isoDescToStr(), logReport(), routeToStr(), and writeParam().

Here is the caller graph for this function:

◆ monotonic()

double monotonic ( void  )

return seconds with decimals

Definition at line 1099 of file r3util.c.

Referenced by handleClient(), main(), and optionManage().

Here is the caller graph for this function:

◆ mostRecentFile()

bool mostRecentFile ( const char *  directory,
const char *  pattern0,
const char *  pattern1,
char *  name,
size_t  maxLen 
)

select most recent file in "directory" that contains "pattern0" and "pattern1" in name return true if found with name of selected file

Definition at line 138 of file r3util.c.

References hasSlash(), MAX_SIZE_DIR_NAME, MAX_SIZE_FILE_NAME, and name.

Referenced by checkParamAndUpdate(), initContext(), and launchAction().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nearestPort()

int nearestPort ( double  lat,
double  lon,
const char *  fileName,
char *  res,
size_t  maxLen 
)

return id and name of nearest port found in file fileName from lat, lon.

return empty string if not found

Definition at line 1063 of file r3util.c.

References g_strlcpy, g_strstrip(), MAX_SIZE_LINE, MAX_SIZE_NAME, and orthoDist().

Referenced by nearestPortToStrJson().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ newDate()

char * newDate ( long  intDate,
double  nHours,
char *  res,
size_t  maxLen 
)

return date and time using ISO notation after adding myTime (hours) to the Date

Definition at line 386 of file r3util.c.

References gribDateToTm().

Referenced by allCompetitors(), exportRouteToGpx(), gribToStr(), gribToStrJson(), logReport(), optionManage(), and routeToStr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ newDateWeekDay()

char * newDateWeekDay ( long  intDate,
double  nHours,
char *  res,
size_t  maxLen 
)

return date and time using week day after adding myTime (hours) to the Date

Definition at line 394 of file r3util.c.

References gribDateToTm().

Here is the call graph for this function:

◆ newDateWeekDayVerbose()

char * newDateWeekDayVerbose ( long  intDate,
double  nHours,
char *  res,
size_t  maxLen 
)

return date and time using week day after adding myTime (hours) to the Date

Definition at line 401 of file r3util.c.

References gribDateToTm().

Here is the call graph for this function:

◆ newFileNameSuffix()

char * newFileNameSuffix ( const char *  fileName,
const char *  suffix,
char *  newFileName,
size_t  maxLen 
)

replace former suffix (after last dot) by suffix example : "pol/bibi.toto.csv" with suffix "sailpol" will give: "pol/bibi.toto.sailpol"

Definition at line 78 of file r3util.c.

References g_strlcpy.

Referenced by readPolar().

Here is the caller graph for this function:

◆ normalizeSpaces()

void normalizeSpaces ( char *  s)

replace multiple spaces by just one

Definition at line 1196 of file r3util.c.

Referenced by launchAction().

Here is the caller graph for this function:

◆ offsetLocalUTC()

double offsetLocalUTC ( void  )

return offset Local UTC in seconds

Definition at line 263 of file r3util.c.

Referenced by optionManage().

Here is the caller graph for this function:

◆ otherNewDate()

char * otherNewDate ( long  dataDate,
double  nHours,
char *  res,
size_t  maxLen 
)

return date and time using ISO notation after adding myTime (hours) to the Date

Definition at line 376 of file r3util.c.

References getYMDHM().

Here is the call graph for this function:

◆ paramToStrJson()

char * paramToStrJson ( Par par,
char *  out,
size_t  maxLen 
)

Return JSON formatted subset of parameters into 'out'.

Returns out on success, NULL on error or truncation.

Definition at line 1023 of file r3util.c.

References Par::currentGribFileName, g_path_get_basename(), Par::gribFileName, Par::isSeaFileName, Zone::latMax, Zone::latMin, Zone::lonLeft, Zone::lonRight, par, Par::polarFileName, Par::wavePolFileName, Par::workingDir, and zone.

Referenced by launchAction().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readIsSea()

bool readIsSea ( const char *  fileName)

read issea file and fill table tIsSea

Definition at line 484 of file r3util.c.

References SIZE_T_IS_SEA, and tIsSea.

Referenced by initContext().

Here is the caller graph for this function:

◆ readMarkCSVToJson()

bool readMarkCSVToJson ( const char *  fileName,
char *  out,
size_t  maxLen 
)

read CSV file marks (Virtual Regatta) if check then polarCheck

Definition at line 1144 of file r3util.c.

References g_strfreev(), g_strsplit(), g_strstrip(), getCoord(), MAX_LAT, MAX_LON, MAX_SIZE_TEXT, MAX_SIZE_TEXT_FILE, MIN_LAT, MIN_LON, and name.

Referenced by launchAction().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readParam()

bool readParam ( const char *  fileName,
bool  initDisp 
)

read parameter file and build par struct

Definition at line 573 of file r3util.c.

References Par::aisDisp, Par::allwaysSea, Par::authent, buildRootName(), CLAMP, Par::cliHelpFileName, Par::closestDisp, Par::cogStep, Competitor::colorIndex, competitors, Par::constCurrentD, Par::constCurrentS, Par::constWave, Par::constWindTwd, Par::constWindTws, Par::curlSys, Par::currentDisp, Par::currentGribFileName, Par::dashboardUTC, Par::dashboardVR, Par::dayEfficiency, Par::description, Par::dispDms, Par::dumpIFileName, Par::dumpRFileName, Pp::father, Par::feedbackFileName, Par::focalDisp, forbidZoneAdd(), g_strstrip(), getCoord(), Par::googleApiKey, Par::gribFileName, Par::gribResolution, Par::gribTimeMax, Par::gribTimeStep, Par::gridDisp, Par::helpFileName, Pp::id, Par::imapMailBox, Par::imapScript, Par::imapServer, Par::imapToSeen, Par::imapUserName, Par::indicatorDisp, Par::infoDisp, Par::isSeaFileName, Par::jFactor, Par::kFactor, Pp::lat, WayPoint::lat, Competitor::lat, Par::logFileName, Pp::lon, WayPoint::lon, Competitor::lon, Par::mailPw, Par::marksFileName, MAX_LAT, MAX_LON, MAX_N_COMPETITORS, MAX_N_FORBID_ZONE, MAX_N_SECTORS, MAX_N_SHP_FILES, MAX_N_WAY_POINT, MAX_SIZE_LINE, MAX_SIZE_NAME, MAX_SIZE_TEXT, Par::maxPoiVisible, Par::maxWind, Par::midFileName, MIN, MIN_LAT, MIN_LON, Par::mostRecentGrib, Par::motorSpeed, WayPointList::n, CompetitorsList::n, N_MAX_NMEA_PORTS, Competitor::name, Par::nForbidZone, Par::nightEfficiency, Par::nmea, Par::nNmea, Par::nSectors, Par::nShpFiles, Par::opt, par, Par::parInfoFileName, Par::pDest, Par::pDestName, Par::penalty0, Par::penalty1, Par::penalty2, Par::poiFileName, Par::polarFileName, Par::pOr, Par::pOrName, Par::portFileName, Par::portName, Par::python, Par::rangeCog, CompetitorsList::runIndex, Par::showColors, Par::shpFileName, Par::shpPointsDisp, Par::smtpScript, Par::smtpServer, Par::smtpTo, Par::smtpUserName, Par::special, Par::speed, Par::speedDisp, Par::staminaVR, Par::startTimeInHours, Par::stepIsocDisp, Par::storeMailPw, Par::style, CompetitorsList::t, WayPointList::t, Par::techno, Par::threshold, Par::tidesFileName, WayPointList::totLoxoDist, WayPointList::totOrthoDist, Par::traceFileName, Par::tStep, Par::waveDisp, Par::wavePolFileName, wayPoints, Par::web, Par::webkit, Par::windDisp, Par::windyApiKey, Par::withCurrent, Par::withWaves, Par::workingDir, Par::wpGpxFileName, and Par::xWind.

Referenced by initContext().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readTextFile()

char * readTextFile ( const char *  fileName,
char *  errMessage,
size_t  maxLen 
)

read all text file in buffer.

Allocate memory

Definition at line 1106 of file r3util.c.

Referenced by launchAction(), and readPolarJson().

Here is the caller graph for this function:

◆ updateIsSeaWithForbiddenAreas()

void updateIsSeaWithForbiddenAreas ( void  )

complement according to forbidden areas

Definition at line 534 of file r3util.c.

References isInForbidArea(), Par::nForbidZone, par, SIZE_T_IS_SEA, and tIsSea.

Referenced by initContext().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeParam()

bool writeParam ( const char *  fileName,
bool  header,
bool  password,
bool  yaml 
)

write parameter file from struct par header or not, password or not yaml style or not

Definition at line 826 of file r3util.c.

References Par::aisDisp, Par::allwaysSea, Par::authent, Par::cliHelpFileName, Par::closestDisp, Par::cogStep, Competitor::colorIndex, competitors, Par::constCurrentD, Par::constCurrentS, Par::constWave, Par::constWindTwd, Par::constWindTws, Par::curlSys, Par::currentDisp, Par::currentGribFileName, Par::dashboardUTC, Par::dashboardVR, Par::dayEfficiency, Par::description, Par::dispDms, Par::dumpIFileName, Par::dumpRFileName, Par::feedbackFileName, Par::focalDisp, forbidZones, fprintfNoNull(), fprintfNoZero(), Par::googleApiKey, Par::gribFileName, Par::gribResolution, Par::gribTimeMax, Par::gribTimeStep, Par::gridDisp, Par::helpFileName, Par::imapMailBox, Par::imapScript, Par::imapServer, Par::imapToSeen, Par::imapUserName, Par::indicatorDisp, Par::infoDisp, Par::isSeaFileName, Par::jFactor, Par::kFactor, Pp::lat, WayPoint::lat, Competitor::lat, latToStr(), Par::logFileName, Pp::lon, WayPoint::lon, Competitor::lon, lonToStr(), Par::mailPw, Par::marksFileName, MAX_SIZE_NAME, Par::maxPoiVisible, Par::maxWind, Par::midFileName, Par::mostRecentGrib, Par::motorSpeed, MyPolygon::n, WayPointList::n, CompetitorsList::n, Competitor::name, Par::nForbidZone, Par::nightEfficiency, Par::nmea, Par::nNmea, Par::nSectors, Par::nShpFiles, Par::opt, par, Par::parInfoFileName, Par::pDest, Par::pDestName, Par::penalty0, Par::penalty1, Par::penalty2, Par::poiFileName, Par::polarFileName, Par::pOr, Par::pOrName, Par::portFileName, Par::portName, Par::python, Par::rangeCog, Par::showColors, Par::shpFileName, Par::shpPointsDisp, Par::smtpScript, Par::smtpServer, Par::smtpTo, Par::smtpUserName, Par::special, Par::speed, Par::speedDisp, Par::staminaVR, Par::startTimeInHours, Par::stepIsocDisp, Par::style, CompetitorsList::t, WayPointList::t, Par::techno, Par::threshold, Par::tidesFileName, Par::traceFileName, Par::tStep, Par::waveDisp, Par::wavePolFileName, wayPoints, Par::web, Par::webkit, Par::windDisp, Par::windyApiKey, Par::withCurrent, Par::withWaves, Par::workingDir, Par::wpGpxFileName, and Par::xWind.

Referenced by launchAction().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ colorStr

const char* colorStr[] = {"green", "purple", "gray", "blue", "yellow", "orange", "red"}

Definition at line 40 of file r3util.c.

◆ competitors

CompetitorsList competitors

list of competitors

for competitors

Definition at line 46 of file r3util.c.

Referenced by allCompetitors(), checkParamAndUpdate(), launchAction(), readParam(), routeToJson(), routeToStr(), routing(), routingLaunch(), and writeParam().

◆ cShip

double cShip

Definition at line 23 of file r3util.c.

Referenced by fPenalty(), and fPointLoss().

◆ currentZone

◆ forbidZones

forbid ones is a set of polygons

forbid zones

Definition at line 32 of file r3util.c.

Referenced by forbidToJson(), forbidZoneAdd(), isInForbidArea(), and writeParam().

◆ meteoTab

const struct MeteoElmt meteoTab[N_METEO_ADMIN] = {{7, "Weather service US"}, {78, "DWD Germany"}, {85, "Meteo France"}, {98,"ECMWF European"}}

dictionnary of meteo services

Meteo service.

Definition at line 35 of file r3util.c.

Referenced by gribToStr(), and gribToStrJson().

◆ name

◆ par

◆ polMat

PolMat polMat

polar matrix description

polar description

Definition at line 49 of file r3util.c.

Referenced by addSail(), buildNextIsochrone(), checkParamAndUpdate(), findListPol(), findSailPol(), fSailName(), goalP(), initContext(), optionManage(), readPolarJson(), and simpleGoalP().

◆ sailName

const char* sailName[] = {"C0", "HG", "Jib", "LG", "LJ", "Spi", "SS"}

Definition at line 39 of file r3util.c.

Referenced by findSailPol(), and readPolar().

◆ sailNameSize

const size_t sailNameSize = 7

sail attributes

Definition at line 38 of file r3util.c.

Referenced by readPolar().

◆ sailPolMat

PolMat sailPolMat

◆ [struct]

struct { ... } shipParam[MAX_N_SHIP_TYPE]
Initial value:
= {
{"Imoca", 1.2, {300, 300, 420}, {660, 660, 600}},
{"Normal", 1.0, {300, 300, 336}, {660, 660, 480}}
}

Referenced by fPenalty(), and fPointLoss().

◆ tIsSea

char* tIsSea = NULL

◆ tMax

double tMax[3]

Definition at line 25 of file r3util.c.

Referenced by fPenalty(), and infoCoordToJson().

◆ tMin

double tMin[3]

Definition at line 24 of file r3util.c.

Referenced by fPenalty().

◆ wavePolMat

PolMat wavePolMat

polar matrix for waves

Definition at line 55 of file r3util.c.

Referenced by buildNextIsochrone(), checkParamAndUpdate(), goalP(), initContext(), optionManage(), and simpleGoalP().

◆ wayPoints

WayPointList wayPoints

list of wayPoint

Definition at line 43 of file r3util.c.

Referenced by checkParamAndUpdate(), logReport(), readParam(), routingLaunch(), and writeParam().

◆ zone