@@ -143,7 +143,7 @@ const float SolarConstant = 434.f; // previous value, source unknown
143143
144144// pointer to current solar/location info thing. Set by slinit() / slselect().
145145// Used by slday(), sldec, slsurfhr, slha, sldircos, slaniso
146- LOCAL SLLOCDAT * slloccur;
146+ static SLLOCDAT* slloccur = nullptr ;
147147
148148/* ----------------------- LOCAL FUNCTION DECLARATIONS ---------------------*/
149149
@@ -385,15 +385,14 @@ float slVProfAng( // vertical profile angle
385385 return profAng;
386386} // slVProfAng
387387// ======================================================================
388- SLLOCDAT *FC
389- slinit (/* Allocate, init, and select a SLLOCAT structure */
388+ void slinit (/* Allocate, init, and select a SLLOCAT structure */
390389
391- float rlat, // latitude, +=N, radians
392- float rlong, // longitude, +=W (non-standard), radians
393- float tzn, // time zone (hrs west of GMT. EST=5, PST=8, etc. )
394- float siteElev) // site elevation (ft above sea level).
395- // Used only with global/direct functions (eg dirsimx.c, gshift.c)
396- // SO passing 0 is generally harmless.
390+ float rlat, // latitude, +=N, radians
391+ float rlong, // longitude, +=W (non-standard), radians
392+ float tzn, // time zone (hrs west of GMT. EST=5, PST=8, etc. )
393+ float siteElev) // site elevation (ft above sea level).
394+ // Used only with global/direct functions (eg dirsimx.c, gshift.c)
395+ // SO passing 0 is generally harmless.
397396
398397/* Returns pointer to SLLOCDAT structure initialized for specified location.
399398 This location is now also the current location for subsequent
@@ -411,30 +410,20 @@ slinit(/* Allocate, init, and select a SLLOCAT structure */
411410 pSlr->tzn = tzn; /* time zone, hours west of GMT */
412411 pSlr->siteElev = siteElev; /* site elevation, ft */
413412 pSlr->pressureRatio = (float )exp (-0.0001184 * 0.3048 * siteElev);
414- /* site pressure ratio: nominal ratio of surface pressure to sea level pressure.
415- Formula appears in Perez code (dirsim.c) and is documented in SERI Consensus
416- Summary (full reference above), p. 17.
417- NOTE: needs reconciliation with psychro1.c:psyAltitude. 8-9-90 */
418- return slselect (
419- pSlr); // make current: ptr for other slpak fcns. ret ptr, for later slselects and slfree
413+ // site pressure ratio: nominal ratio of surface pressure to sea level pressure.
414+ // Formula appears in Perez code (dirsim.c) and is documented in SERI Consensus
415+ // Summary (full reference above), p. 17.
416+ // NOTE: needs reconciliation with psychro1.c:psyAltitude. 8-9-90
417+
418+ slfree ();
419+ slloccur = pSlr; // make current: ptr for other slpak fcns
420420} // slinit
421421// ======================================================================
422- SLLOCDAT *FC slselect (/* Sets current solar/location data to that given by arg */
423-
424- SLLOCDAT *pSlr) /* pointer returned by an earlier slinit call */
425-
426- /* returns pSlr as convenience (new feature 8-9-90) */
422+ void FC slfree () // Free a SLLOCDAT structure
427423{
428- return ( slloccur = pSlr) ; /* set file-global for slpak fcns to use */
429- } /* slselect */
424+ delete slloccur; // free heap storage occupied by object
425+ slloccur = nullptr ;
430426
431- // ======================================================================
432- void FC slfree ( // Free a SLLOCDAT structure
433-
434- SLLOCDAT **ppSlr) // ptr to ptr. nop if ptr is NULL; ptr is set NULL: redundant calls ok.
435- {
436- delete *ppSlr; // free heap storage occupied by object
437- *ppSlr = NULL ; // erase no-longer-valid pointer
438427} // slfree
439428
440429// ======================================================================
0 commit comments