Skip to content

Commit 4d59b1b

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 0c46824 commit 4d59b1b

14 files changed

+51
-51
lines changed

src/DemandExpressionHandling.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ bool CDemandOptimizer::ConvertToExpressionTerm(const string s, expressionTerm* t
336336
//----------------------------------------------------------------------
337337
else if (s[0]=='!') //decision variable e.g., !Q234, !I32, or !D.Matts_Brewery
338338
{
339-
if ((s[1] == 'Q') || (s[1] == 'h') || (s[1]=='I')) //Subbasin-indexed
339+
if ((s[1] == 'Q') || (s[1] == 'h') || (s[1]=='I')) //Subbasin-indexed
340340
{
341341
int p=GetIndexFromDVString(s);
342342
if (p == DOESNT_EXIST) {
@@ -707,7 +707,7 @@ bool CDemandOptimizer::ConvertToExpressionTerm(const string s, expressionTerm* t
707707
//----------------------------------------------------------------------
708708
else if (GetControlVariable(s,index) != RAV_BLANK_DATA) // control variable
709709
{
710-
710+
711711
term->type=TERM_CONTROL;
712712
term->value=GetControlVariable(s,index);// initially zero
713713
term->DV_ind=index;
@@ -760,7 +760,7 @@ expressionStruct *CDemandOptimizer::ParseExpression(const char **s,
760760
{
761761
strlen=to_string(s[i]).length();
762762
type[i]=EXP;
763-
if ((s[i][0]=='+') || ((strlen==1) && (s[i][0]=='-')) || (s[i][0]=='*') || (s[i][0]=='/') || (s[i][0]=='=') || (s[i][0]=='<') || (s[i][0]=='>')){
763+
if ((s[i][0]=='+') || ((strlen==1) && (s[i][0]=='-')) || (s[i][0]=='*') || (s[i][0]=='/') || (s[i][0]=='=') || (s[i][0]=='<') || (s[i][0]=='>')){
764764
type[i] = EXP_OP;
765765
if ((i > 1) && (type[i - 1] == EXP_OP)) {
766766
ExitGracefully("ParseExpression: cannot have consecutive math operators in an expression.",BAD_DATA_WARN);
@@ -1277,7 +1277,7 @@ double CDemandOptimizer::EvaluateTerm(expressionTerm **pTerms,const int k, const
12771277
int p=pT->p_index;
12781278
return _pModel->GetSubBasin(p)->GetAvgStateVar(i);
12791279
}
1280-
else if (pT->type == TERM_CONST)
1280+
else if (pT->type == TERM_CONST)
12811281
{
12821282
return pT->value;
12831283
}

src/DemandOptimization.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,14 @@ int CDemandOptimizer::GetDemandIndexFromName(const string demand_tag) const
135135
//////////////////////////////////////////////////////////////////
136136
/// \brief gets demand from index
137137
//
138-
CDemand* CDemandOptimizer::GetWaterDemand(const int d)
138+
CDemand* CDemandOptimizer::GetWaterDemand(const int d)
139139
{
140140
return _pDemands[d];
141141
}
142142
//////////////////////////////////////////////////////////////////
143143
/// \brief gets number of enabled water demands
144144
//
145-
int CDemandOptimizer::GetNumWaterDemands() const
145+
int CDemandOptimizer::GetNumWaterDemands() const
146146
{
147147
return _nDemands;
148148
}
@@ -420,7 +420,7 @@ bool CDemandOptimizer::VariableNameExists(const string &name) const
420420
for (int i = 0; i < _nUserConstants; i++) {
421421
if (_aUserConstNames[i]==name){return true;}
422422
}
423-
423+
424424
if (GetUnitConversion(name)!=RAV_BLANK_DATA){return true;}
425425

426426
return false;
@@ -771,7 +771,7 @@ void CDemandOptimizer::InitializePostRVMRead(CModel* pModel, const optStruct& Op
771771
{
772772
// ASSUMES ALL EXPRESSIONS IN GOAL/CONSTRAINT ARE EITHER == or >/<, NEVER MIXED.
773773
if (_pGoals[j]->is_goal) {
774-
if (_pGoals[j]->pOperRegimes[0]->pExpression->compare == COMPARE_IS_EQUAL)
774+
if (_pGoals[j]->pOperRegimes[0]->pExpression->compare == COMPARE_IS_EQUAL)
775775
{
776776
_pGoals[j]->slack_ind1=_nSlackVars;
777777
pDV = new decision_var("SL+" + to_string(j), p, DV_SLACK,_nSlackVars);
@@ -790,7 +790,7 @@ void CDemandOptimizer::InitializePostRVMRead(CModel* pModel, const optStruct& Op
790790
AddDecisionVar(pDV);
791791
_nSlackVars++;
792792
}
793-
else
793+
else
794794
{
795795
_pGoals[j]->slack_ind1=_nSlackVars;
796796
pDV = new decision_var("SL+"+ to_string(j), p, DV_SLACK,_nSlackVars);
@@ -1782,7 +1782,7 @@ void CDemandOptimizer::SolveDemandProblem(CModel *pModel, const optStruct &Optio
17821782
retval = lp_lib::add_constraintex(pLinProg,3,row_val,col_ind,ROWTYPE_LE,RHS);
17831783
ExitGracefullyIf(retval==0,"SolveDemandProblem::Error adding stage discharge constraint F",RUNTIME_ERR);
17841784
IncrementAndSetRowName(pLinProg,rowcount,"reserv_Q_F"+to_string(pSB->GetID()));
1785-
1785+
17861786
}
17871787
else /* if (aDisableSDCurve[p])*/ //keep same rows - make inert equations
17881788
{
@@ -1798,7 +1798,7 @@ void CDemandOptimizer::SolveDemandProblem(CModel *pModel, const optStruct &Optio
17981798
IncrementAndSetRowName(pLinProg,rowcount,"reserv_Q_E"+to_string(pSB->GetID()));
17991799
retval = lp_lib::add_constraintex(pLinProg,1,row_val,col_ind,ROWTYPE_LE,RHS);
18001800
IncrementAndSetRowName(pLinProg,rowcount,"reserv_Q_F"+to_string(pSB->GetID()));
1801-
1801+
18021802
s+=2; //to ensure EnvMin counter is working
18031803
}
18041804
res_count++;
@@ -1887,7 +1887,7 @@ void CDemandOptimizer::SolveDemandProblem(CModel *pModel, const optStruct &Optio
18871887

18881888
// ----------------------------------------------------------------
18891889
// ITERATIVELY SOLVE OPTIMIZATION PROBLEM WITH LP_SOLVE
1890-
// ----------------------------------------------------------------
1890+
// ----------------------------------------------------------------
18911891
const int NUM_ITERATIONS=5;
18921892

18931893
int ctyp;
@@ -1953,7 +1953,7 @@ void CDemandOptimizer::SolveDemandProblem(CModel *pModel, const optStruct &Optio
19531953
{
19541954
_aSolverRowNames [j]=to_string(lp_lib::get_row_name(pLinProg,j+1));
19551955
_aSolverResiduals[j]=constr[j]-lp_lib::get_rh(pLinProg,j+1); // LHS-RHS for each goal/constraint
1956-
1956+
19571957
ctyp=lp_lib::get_constr_type(pLinProg,j+1);
19581958
if (ctyp==LE){upperswap(_aSolverResiduals[j],0.0); }
19591959
if (ctyp==GE){lowerswap(_aSolverResiduals[j],0.0); _aSolverResiduals[j]*=-1; }
@@ -2211,8 +2211,8 @@ void CDemandOptimizer::WriteMinorOutput(const optStruct &Options,const time_stru
22112211

22122212
_GOALSAT<<tt.model_time <<","<<usedate<<","<<usehour;
22132213

2214-
//first slack terms are due to environmental flow constraints (_nEnviroFlowGoals)
2215-
2214+
//first slack terms are due to environmental flow constraints (_nEnviroFlowGoals)
2215+
22162216
int s=_nEnviroFlowGoals; //this is first index of user-specified slack variable
22172217

22182218
for (int i = 0; i < _nGoals; i++)

src/Diagnostics.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ string CDiagnostic::GetName() const
5757
case(DIAG_RSR): {return "DIAG_RSR";}
5858
case(DIAG_R2): {return "DIAG_R2";}
5959
case(DIAG_LOG_NASH): {return "DIAG_LOG_NASH";}
60-
case(DIAG_KLING_GUPTA): {return "DIAG_KLING_GUPTA";}
60+
case(DIAG_KLING_GUPTA): {return "DIAG_KLING_GUPTA";}
6161
case(DIAG_KGE_PRIME): {return "DIAG_KGE_PRIME";}
6262
case(DIAG_DAILY_KGE): {return "DIAG_DAILY_KGE";}
6363
case(DIAG_NASH_SUTCLIFFE_DER):{return "DIAG_NASH_SUTCLIFFE_DER"; }

src/EnergyTransport.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ void CEnthalpyModel::Initialize(const optStruct& Options)
531531
A=_pModel->GetSubBasin(p)->GetReferenceXSectArea();
532532
tr=L*A/Q/SEC_PER_DAY;
533533
if (tr<0.33*Options.timestep){_aMinResTime [p]=tr;}
534-
else {_aMinResTime [p]=0.333*Options.timestep; }
534+
else {_aMinResTime [p]=0.333*Options.timestep; }
535535
}
536536

537537
// initialize stream temperatures if init_stream_temp is given
@@ -834,7 +834,7 @@ double CEnthalpyModel::GetEnergyLossesFromReach(const int p,double &Q_sens,doubl
834834
Q_sens +=dA*hstar *(temp_air-Tbar_km); //[m2]*[MJ/m2/d/K]*[K]=[MJ/d]
835835
Q_cond +=dA*kbed *(temp_bed-Tbar_km);
836836
Q_lw_out +=dA*klin *(0.75*temp_lin-(Tbar_km+ZERO_CELSIUS)); //linearized - works except at T~0
837-
Q_lateral+=dA*qlat *dbar/Ax*HCP_WATER*(temp_lat-Tbar_km);
837+
Q_lateral+=dA*qlat *dbar/Ax*HCP_WATER*(temp_lat-Tbar_km);
838838

839839
temp_average+=dA/As*Tbar_km;
840840
if (As == 0.0) {temp_average=0.0;}

src/EnergyTransport.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class CEnthalpyModel :public CConstituentModel
7373

7474
//Manipulators (inherited from CConstitModel)
7575
void Initialize (const optStruct& Options);
76-
76+
7777
void PrepareForInCatchmentRouting(const int p);
7878
void PrepareForRouting (const int p);
7979
double ApplyInCatchmentRouting (const int p,

src/FrozenLake.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ void CmvFrozenLake::GetParticipatingParamList(string *aP , class_type *aPC , in
6666
}
6767
else if (_type == LFREEZE_THERMAL)
6868
{
69-
69+
7070
}
7171
else
7272
{
@@ -105,7 +105,7 @@ void CmvFrozenLake::GetRatesOfChange( const double *state_vars,
105105
const time_struct &tt,
106106
double *rates) const
107107
{
108-
if ((pHRU->GetHRUType()!=HRU_LAKE) &&
108+
if ((pHRU->GetHRUType()!=HRU_LAKE) &&
109109
(pHRU->GetHRUType()!=HRU_WETLAND)){return;}//Lakes and wetlands only (includes reservoirs)
110110

111111
double ice_thick=state_vars[iFrom[0]];

src/MassRouting.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,14 +221,14 @@ void CConstituentModel::PrepareForRouting(const int p) {
221221
void CConstituentModel::PrepareForInCatchmentRouting(const int p) {
222222
//does nothing - interesting in child classes
223223
}
224-
void CConstituentModel::InCatchmentRoute(const int p, double &Mlat_new, const optStruct &Options)
224+
void CConstituentModel::InCatchmentRoute(const int p, double &Mlat_new, const optStruct &Options)
225225
{
226226
PrepareForInCatchmentRouting(p);
227227

228228
const double * aUnitHydro =_pModel->GetSubBasin(p)->GetUnitHydrograph();
229229
const double * aQlatHist =_pModel->GetSubBasin(p)->GetLatHistory();
230230
Mlat_new=ApplyInCatchmentRouting(p,aUnitHydro,aQlatHist,_aMlatHist[p],_nMlatHist[p], Options.timestep);
231-
231+
232232
_aMlocLast[p] = _aMlocal[p];
233233
_aMlocal [p] = Mlat_new;
234234
}
@@ -266,7 +266,7 @@ void CConstituentModel::RouteMass(const int p, // SB index
266266
//==============================================================
267267
const double * aRouteHydro=_pModel->GetSubBasin(p)->GetRoutingHydrograph();
268268
const double * aQinHist =_pModel->GetSubBasin(p)->GetInflowHistory();
269-
269+
270270
int nSegments =_pModel->GetSubBasin(p)->GetNumSegments();
271271
double seg_fraction=1.0/(double)(nSegments);
272272

@@ -284,7 +284,7 @@ void CConstituentModel::RouteMass(const int p, // SB index
284284
else {
285285
ExitGracefully("Unrecognized or unsupported constiuent routing method (:Routing command must be ROUTE_NONE, ROUTE_PLUG_FLOW, or ROUTE_DIFFUSIVE_WAVE to support transport)",STUB);
286286
}
287-
287+
288288
//all fluxes from catchment are routed directly to basin outlet (unless handled in convolution routing as source term)
289289
if ((!_lateral_via_convol) || (_pModel->GetSubBasin(p)->IsHeadwater())){
290290
aMout_new[nSegments-1]+=Mlat_new;
@@ -436,7 +436,7 @@ void CConstituentModel::UpdateMassOutflows( const int p,
436436
if (!_lateral_via_convol){//elsewise, in get net reach losses
437437
dM+=0.5*(Mlat_new+_aMlat_last[p])*dt;
438438
}
439-
439+
440440
_channel_storage[p]+=dM;//[mg] or [MJ]
441441

442442
//Update rivulet storage

src/ParseInput.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ bool ParseInputFiles (CModel *&pModel,
108108
}
109109
ExitGracefully("Cannot find or read .rvi file",BAD_DATA);return false;
110110
}
111-
if (!Options.create_rvp_template) {//otherwise, jump right to parse rvp, where template is created
111+
if (!Options.create_rvp_template) {//otherwise, jump right to parse rvp, where template is created
112112
if (!ParseNetCDFRunInfoFile(pModel, Options, runname_overridden,runmode_overridden)){
113113
ExitGracefully("Cannot find or read NetCDF runinfo file", BAD_DATA); return false;
114114
}
@@ -3533,12 +3533,12 @@ bool ParseMainInputFile (CModel *&pModel,
35333533
} //end while (!end_of_file)
35343534
INPUT.close();
35353535

3536-
// Add TOTAL_SWE state variable if any snow is simulated
3536+
// Add TOTAL_SWE state variable if any snow is simulated
35373537
if (pModel->GetStateVarIndex(SNOW) != -1) {
35383538
tmpS[0] = TOTAL_SWE; tmpLev[0]=0; tmpN=1;
35393539
pModel->AddStateVariables(tmpS,tmpLev,tmpN);
35403540
}
3541-
3541+
35423542

35433543
//===============================================================================================
35443544
//Check input quality

src/ParseManagementFile.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ bool ParseManagementFile(CModel *&pModel,const optStruct &Options)
5656

5757
CDemand *pDemand=NULL;
5858
int demand_ind=0;
59-
long demandSBID;
59+
long demandSBID;
6060
int demand_ID;
6161
string demand_name;
6262

6363
ifstream INPUT2; //For Secondary input
6464
CParser *pMainParser=NULL; //for storage of main parser while reading secondary files
65-
//ifstream INPUT3; //For tertiary input
66-
//CParser *pSecondaryParser=NULL; //for storage of secondary parser while reading tertiary files
65+
//ifstream INPUT3; //For tertiary input
66+
//CParser *pSecondaryParser=NULL; //for storage of secondary parser while reading tertiary files
6767

6868
ifstream RVM;
6969
RVM.open(Options.rvm_filename.c_str(),ios::binary);
@@ -176,8 +176,8 @@ bool ParseManagementFile(CModel *&pModel,const optStruct &Options)
176176
else if(!strcmp(s[0],":DemandExpression")) { code=62; }
177177
//else if(!strcmp(s[0],":AnnualLicense")) { code=63; }
178178
else if(!strcmp(s[0],":ReservoirWaterDemand")) { code=64; }
179-
else if(!strcmp(s[0],":EndReservoirWaterDemand")) { code=65; }
180-
else if(!strcmp(s[0],":IsUnrestricted")) { code=66; }
179+
else if(!strcmp(s[0],":EndReservoirWaterDemand")) { code=65; }
180+
else if(!strcmp(s[0],":IsUnrestricted")) { code=66; }
181181

182182
else if(!strcmp(s[0],":UserTimeSeries")) { code=70; }
183183

@@ -209,14 +209,14 @@ bool ParseManagementFile(CModel *&pModel,const optStruct &Options)
209209
//if ((pMainParser != NULL) && (pSecondaryParser != NULL)){
210210
// ExitGracefully("ParseEnsembleFile::nested :RedirectToFile commands are not allowed to be nested more than two levels (e.g., rvm file to rvm file to rvm file to rvm file)",BAD_DATA);
211211
//}
212-
//if (pMainParser != NULL) {
212+
//if (pMainParser != NULL) {
213213
// pSecondaryParser=pp
214214
// pp=new CParser(INPUT3,filename,line);//open new parser
215-
//} //from already redirected .rvm file
216-
//else {
217-
// pMainParser=pp;
215+
//} //from already redirected .rvm file
216+
//else {
217+
// pMainParser=pp;
218218
// pp=new CParser(INPUT2,filename,line);//open new parser
219-
//} //from base .rvm file
219+
//} //from base .rvm file
220220
//
221221

222222
if (pMainParser != NULL) {
@@ -1077,7 +1077,7 @@ bool ParseManagementFile(CModel *&pModel,const optStruct &Options)
10771077
break;
10781078
}
10791079
case (61): //--------------------------------------------
1080-
{/*:DemandLookupTable
1080+
{/*:DemandLookupTable
10811081
N
10821082
{Q_i D_i} x N
10831083
:EndDemandLookupTable
@@ -1266,4 +1266,4 @@ bool ParseManagementFile(CModel *&pModel,const optStruct &Options)
12661266
pp=NULL;
12671267

12681268
return true;
1269-
}
1269+
}

src/PartitionPrecip.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ void CmvPrecipitation::GetRatesOfChange(const double *state_vars,
280280
rates[qSnLiqToDep]+=state_vars[iSnLiq]/Options.timestep;
281281
}
282282
}
283-
else if (pHRU->GetHRUType() == HRU_WATER)
283+
else if (pHRU->GetHRUType() == HRU_WATER)
284284
{
285285
rates[qSW] =snowthru + rainthru; //all water goes to surface water
286286
}

0 commit comments

Comments
 (0)