本文整理汇总了C++中report_writeErrorMsg函数的典型用法代码示例。如果您正苦于以下问题:C++ report_writeErrorMsg函数的具体用法?C++ report_writeErrorMsg怎么用?C++ report_writeErrorMsg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了report_writeErrorMsg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: divider_validate
void divider_validate(int j)
//
// Input: j = node index
// Output: none
// Purpose: validates a flow divider's properties.
//
{
int i, k;
// --- check that diverted link is attached to divider
k = Node[j].subIndex;
i = Divider[k].link;
if ( i < 0 || ( Link[i].node1 != j && Link[i].node2 != j) )
{
report_writeErrorMsg(ERR_DIVIDER_LINK, Node[j].ID);
}
// --- validate parameters supplied for weir-type divider
if ( Divider[k].type == WEIR_DIVIDER )
{
if ( Divider[k].dhMax <= 0.0 || Divider[k].cWeir <= 0.0 )
report_writeErrorMsg(ERR_WEIR_DIVIDER, Node[j].ID);
else
{
// --- find flow when weir is full
Divider[k].qMax = Divider[k].cWeir * pow(Divider[k].dhMax, 1.5)
/ UCF(FLOW);
if ( Divider[k].qMin > Divider[k].qMax )
report_writeErrorMsg(ERR_WEIR_DIVIDER, Node[j].ID);
}
}
}
示例2: gwater_validateAquifer
void gwater_validateAquifer(Project* project, int j)
//
// Input: j = aquifer index
// Output: none
// Purpose: validates groundwater aquifer properties .
//
{
int p;
if ( project->Aquifer[j].porosity <= 0.0
|| project->Aquifer[j].fieldCapacity >= project->Aquifer[j].porosity
|| project->Aquifer[j].wiltingPoint >= project->Aquifer[j].fieldCapacity
|| project->Aquifer[j].conductivity <= 0.0
|| project->Aquifer[j].conductSlope < 0.0
|| project->Aquifer[j].tensionSlope < 0.0
|| project->Aquifer[j].upperEvapFrac < 0.0
|| project->Aquifer[j].lowerEvapDepth < 0.0
|| project->Aquifer[j].waterTableElev < project->Aquifer[j].bottomElev
|| project->Aquifer[j].upperMoisture > project->Aquifer[j].porosity
|| project->Aquifer[j].upperMoisture < project->Aquifer[j].wiltingPoint )
report_writeErrorMsg(project,ERR_AQUIFER_PARAMS, project->Aquifer[j].ID);
p = project->Aquifer[j].upperEvapPat;
if ( p >= 0 && project->Pattern[p].type != MONTHLY_PATTERN )
{
report_writeErrorMsg(project,ERR_AQUIFER_PARAMS, project->Aquifer[j].ID);
}
}
示例3: readTD3200FileLine
void readTD3200FileLine(int* y, int* m)
//
// Input: none
// Output: y = year
// m = month
// Purpose: reads year & month from line of TD-3200 climate file.
//
{
char recdType[4] = "";
char year[5] = "";
char month[3] = "";
int len;
// --- check for minimum number of characters
len = (int)strlen(FileLine);
if ( len < 30 )
{
report_writeErrorMsg(ERR_CLIMATE_FILE_READ, Fclimate.name);
return;
}
// --- check for proper type of record
sstrncpy(recdType, FileLine, 3);
if ( strcmp(recdType, "DLY") != 0 )
{
report_writeErrorMsg(ERR_CLIMATE_FILE_READ, Fclimate.name);
return;
}
// --- get record's date
sstrncpy(year, &FileLine[17], 4);
sstrncpy(month, &FileLine[21], 2);
*y = atoi(year);
*m = atoi(month);
}
示例4: validateGeneralLayout
void validateGeneralLayout(Project* project)
//
// Input: none
// Output: nonw
// Purpose: validates general conveyance system layout.
//
{
int i, j;
int outletCount = 0;
// --- use node inflow attribute to count inflow connections
for ( i=0; i<project->Nobjects[NODE]; i++ ) project->Node[i].inflow = 0.0;
// --- examine each link
for ( j = 0; j < project->Nobjects[LINK]; j++ )
{
// --- update inflow link count of downstream node
i = project->Link[j].node1;
if ( project->Node[i].type != OUTFALL ) i = project->Link[j].node2;
project->Node[i].inflow += 1.0;
// --- if link is dummy link or ideal pump then it must
// be the only link exiting the upstream node
if ( (project->Link[j].type == CONDUIT && project->Link[j].xsect.type == DUMMY) ||
(project->Link[j].type == PUMP &&
project->Pump[project->Link[j].subIndex].type == IDEAL_PUMP) )
{
i = project->Link[j].node1;
if ( project->Link[j].direction < 0 ) i = project->Link[j].node2;
if ( project->Node[i].degree > 1 )
{
report_writeErrorMsg(project,ERR_DUMMY_LINK, project->Node[i].ID);
}
}
}
// --- check each node to see if it qualifies as an outlet node
// (meaning that degree = 0)
for ( i = 0; i < project->Nobjects[NODE]; i++ )
{
// --- if node is of type Outfall, check that it has only 1
// connecting link (which can either be an outflow or inflow link)
if ( project->Node[i].type == OUTFALL )
{
if ( project->Node[i].degree + (int)project->Node[i].inflow > 1 )
{
report_writeErrorMsg(project,ERR_OUTFALL, project->Node[i].ID);
}
else outletCount++;
}
}
if ( outletCount == 0 ) report_writeErrorMsg(project,ERR_NO_OUTLETS, "");
// --- reset node inflows back to zero
for ( i = 0; i < project->Nobjects[NODE]; i++ )
{
if ( project->Node[i].inflow == 0.0 ) project->Node[i].degree = -project->Node[i].degree;
project->Node[i].inflow = 0.0;
}
}
示例5: project_readInput
void project_readInput()
//
// Input: none
// Output: none
// Purpose: retrieves project data from input file.
//
{
// --- create hash tables for fast retrieval of objects by ID names
createHashTables();
// --- count number of objects in input file and create them
input_countObjects();
createObjects();
// --- read project data from input file
input_readData();
if ( ErrorCode ) return;
// --- establish starting & ending date/time
StartDateTime = StartDate + StartTime;
EndDateTime = EndDate + EndTime;
ReportStart = ReportStartDate + ReportStartTime;
ReportStart = MAX(ReportStart, StartDateTime);
// --- check for valid starting & ending date/times
if ( EndDateTime <= StartDateTime )
{
report_writeErrorMsg(ERR_START_DATE, "");
}
else if ( EndDateTime <= ReportStart )
{
report_writeErrorMsg(ERR_REPORT_DATE, "");
}
else
{
//// Following code segment was modified for release 5.1.009. //// //(5.1.009)
////
// --- compute total duration of simulation in seconds
TotalDuration = floor((EndDateTime - StartDateTime) * SECperDAY);
// --- reporting step must be <= total duration
if ( (double)ReportStep > TotalDuration )
{
ReportStep = (int)(TotalDuration);
}
// --- reporting step can't be < routing step
if ( (double)ReportStep < RouteStep )
{
report_writeErrorMsg(ERR_REPORT_STEP, "");
}
// --- convert total duration to milliseconds
TotalDuration *= 1000.0;
}
////
}
示例6: validateRdii
void validateRdii()
//
// Input: none
// Output: none
// Purpose: validates UH and RDII inflow object data.
//
{
int i, // node index
j, // UH group index
k, // individual UH index
m; // month index
float rsum; // sum of UH r-values
// --- check each unit hydrograph for consistency
for (j=0; j<Nobjects[UNITHYD]; j++)
{
for (m=0; m<12; m++)
{
rsum = 0.0;
for (k=0; k<3; k++)
{
// --- if no base time then UH doesn't exist
if ( UnitHyd[j].tBase[m][k] == 0 ) continue;
// --- can't have negative UH parameters
if ( UnitHyd[j].tPeak[m][k] < 0.0 )
{
report_writeErrorMsg(ERR_UNITHYD_TIMES, UnitHyd[j].ID);
}
// --- can't have negative UH response ratio
if ( UnitHyd[j].r[m][k] < 0.0 )
{
report_writeErrorMsg(ERR_UNITHYD_RATIOS, UnitHyd[j].ID);
}
else rsum += UnitHyd[j].r[m][k];
}
if ( rsum > 1.01 )
{
report_writeErrorMsg(ERR_UNITHYD_RATIOS, UnitHyd[j].ID);
}
}
}
// --- check each node's RDII inflow object
for (i=0; i<Nobjects[NODE]; i++)
{
if ( Node[i].rdiiInflow )
{
// --- check that sewer area is non-negative
if ( Node[i].rdiiInflow->area < 0.0 )
{
report_writeErrorMsg(ERR_RDII_AREA, Node[i].ID);
}
}
}
}
示例7: gage_validate
void gage_validate(int j)
//
// Input: j = rain gage index
// Output: none
// Purpose: checks for valid rain gage parameters
//
// NOTE: assumes that any time series used by a rain gage has been
// previously validated.
//
{
int i, k;
int gageInterval;
// --- for gage with time series data:
if ( Gage[j].dataSource == RAIN_TSERIES )
{
// --- check gage's recording interval against that of time series
k = Gage[j].tSeries;
if ( Tseries[k].refersTo >= 0 )
{
report_writeErrorMsg(ERR_RAIN_GAGE_TSERIES, Gage[j].ID);
}
gageInterval = (int)(floor(Tseries[k].dxMin*SECperDAY + 0.5));
if ( gageInterval > 0 && Gage[j].rainInterval > gageInterval )
{
report_writeErrorMsg(ERR_RAIN_GAGE_INTERVAL, Gage[j].ID);
}
if ( Gage[j].rainInterval < gageInterval )
{
report_writeWarningMsg(WARN09, Gage[j].ID);
}
if ( Gage[j].rainInterval < WetStep )
{
report_writeWarningMsg(WARN01, Gage[j].ID);
WetStep = Gage[j].rainInterval;
}
// --- see if gage uses same time series as another gage
for (i=0; i<j; i++)
{
if ( Gage[i].dataSource == RAIN_TSERIES && Gage[i].tSeries == k )
{
Gage[j].coGage = i;
// --- check that both gages record same type of data
if ( Gage[j].rainType != Gage[i].rainType )
{
report_writeErrorMsg(ERR_RAIN_GAGE_FORMAT, Gage[j].ID);
}
return;
}
}
}
}
示例8: runoff_initFile
void runoff_initFile(void)
//
// Input: none
// Output: none
// Purpose: initializes a Runoff Interface file for saving results.
//
{
int nSubcatch;
int nPollut;
int flowUnits;
char fileStamp[] = "SWMM5-RUNOFF";
char fStamp[] = "SWMM5-RUNOFF";
MaxSteps = 0;
if ( Frunoff.mode == SAVE_FILE )
{
// --- write file stamp, # subcatchments & # pollutants to file
nSubcatch = Nobjects[SUBCATCH];
nPollut = Nobjects[POLLUT];
flowUnits = FlowUnits;
fwrite(fileStamp, sizeof(char), strlen(fileStamp), Frunoff.file);
fwrite(&nSubcatch, sizeof(int), 1, Frunoff.file);
fwrite(&nPollut, sizeof(int), 1, Frunoff.file);
fwrite(&flowUnits, sizeof(int), 1, Frunoff.file);
MaxStepsPos = ftell(Frunoff.file);
fwrite(&MaxSteps, sizeof(int), 1, Frunoff.file);
}
if ( Frunoff.mode == USE_FILE )
{
// --- check that interface file contains proper header records
fread(fStamp, sizeof(char), strlen(fileStamp), Frunoff.file);
if ( strcmp(fStamp, fileStamp) != 0 )
{
report_writeErrorMsg(ERR_RUNOFF_FILE_FORMAT, "");
return;
}
nSubcatch = -1;
nPollut = -1;
flowUnits = -1;
fread(&nSubcatch, sizeof(int), 1, Frunoff.file);
fread(&nPollut, sizeof(int), 1, Frunoff.file);
fread(&flowUnits, sizeof(int), 1, Frunoff.file);
fread(&MaxSteps, sizeof(int), 1, Frunoff.file);
if ( nSubcatch != Nobjects[SUBCATCH]
|| nPollut != Nobjects[POLLUT]
|| flowUnits != FlowUnits
|| MaxSteps <= 0 )
{
report_writeErrorMsg(ERR_RUNOFF_FILE_FORMAT, "");
}
}
}
示例9: openHotstartFile1
int openHotstartFile1()
//
// Input: none
// Output: none
// Purpose: opens a previously saved hotstart file.
//
{
int nNodes;
int nLinks;
int nPollut;
int flowUnits;
char fileStamp[] = "SWMM5-HOTSTART";
char fStamp[] = "SWMM5-HOTSTART";
// --- try to open the file
if ( Fhotstart1.mode != USE_FILE ) return TRUE;
if ( (Fhotstart1.file = fopen(Fhotstart1.name, "r+b")) == NULL)
{
report_writeErrorMsg(ERR_HOTSTART_FILE_OPEN, Fhotstart1.name);
return FALSE;
}
// --- check that file contains proper header records
fread(fStamp, sizeof(char), strlen(fileStamp), Fhotstart1.file);
if ( strcmp(fStamp, fileStamp) != 0 )
{
report_writeErrorMsg(ERR_HOTSTART_FILE_FORMAT, "");
return FALSE;
}
nNodes = -1;
nLinks = -1;
nPollut = -1;
flowUnits = -1;
fread(&nNodes, sizeof(int), 1, Fhotstart1.file);
fread(&nLinks, sizeof(int), 1, Fhotstart1.file);
fread(&nPollut, sizeof(int), 1, Fhotstart1.file);
fread(&flowUnits, sizeof(int), 1, Fhotstart1.file);
if ( nNodes != Nobjects[NODE]
|| nLinks != Nobjects[LINK]
|| nPollut != Nobjects[POLLUT]
|| flowUnits != FlowUnits )
{
report_writeErrorMsg(ERR_HOTSTART_FILE_FORMAT, "");
return FALSE;
}
// --- read contents of the file and close it
readHotstartFile();
fclose(Fhotstart1.file);
if ( ErrorCode ) return FALSE;
else return TRUE;
}
示例10: project_readInput
void project_readInput()
//
// Input: none
// Output: none
// Purpose: retrieves project data from input file.
//
{
// --- create hash tables for fast retrieval of objects by ID names
createHashTables();
// --- count number of objects in input file and create them
input_countObjects();
createObjects();
// --- read project data from input file
input_readData();
if ( ErrorCode ) return;
// --- establish starting & ending date/time
StartDateTime = StartDate + StartTime;
EndDateTime = EndDate + EndTime;
ReportStart = ReportStartDate + ReportStartTime;
ReportStart = MAX(ReportStart, StartDateTime);
// --- check for valid starting & ending date/times
if ( EndDateTime <= StartDateTime )
{
report_writeErrorMsg(ERR_START_DATE, "");
}
else if ( EndDateTime <= ReportStart )
{
report_writeErrorMsg(ERR_REPORT_DATE, "");
}
else
{
// --- compute total duration of simulation in milliseconds
// (add on 1 msec to account for any roundoff)
TotalDuration = (EndDateTime - StartDateTime) * MSECperDAY;
TotalDuration += 1.0;
// --- reporting step must be <= total duration
if ( (double)ReportStep > TotalDuration/1000.0 )
{
ReportStep = (int)(TotalDuration/1000.0);
}
if ( (float)ReportStep < RouteStep )
{
report_writeErrorMsg(ERR_REPORT_STEP, "");
}
}
}
示例11: runoff_open
int runoff_open()
//
// Input: none
// Output: returns the global error code
// Purpose: opens the runoff analyzer.
//
{
IsRaining = FALSE;
HasRunoff = FALSE;
HasSnow = FALSE;
Nsteps = 0;
// --- open the Ordinary Differential Equation solver
// to solve up to 3 ode's.
if ( !odesolve_open(3) ) report_writeErrorMsg(ERR_ODE_SOLVER, "");
// --- allocate memory for pollutant washoff loads
WashoffQual = NULL;
WashoffLoad = NULL;
if ( Nobjects[POLLUT] > 0 )
{
WashoffQual = (double *) calloc(Nobjects[POLLUT], sizeof(double));
if ( !WashoffQual ) report_writeErrorMsg(ERR_MEMORY, "");
WashoffLoad = (double *) calloc(Nobjects[POLLUT], sizeof(double));
if ( !WashoffLoad ) report_writeErrorMsg(ERR_MEMORY, "");
}
// --- see if a runoff interface file should be opened
switch ( Frunoff.mode )
{
case USE_FILE:
if ( (Frunoff.file = fopen(Frunoff.name, "r+b")) == NULL)
report_writeErrorMsg(ERR_RUNOFF_FILE_OPEN, Frunoff.name);
else runoff_initFile();
break;
case SAVE_FILE:
if ( (Frunoff.file = fopen(Frunoff.name, "w+b")) == NULL)
report_writeErrorMsg(ERR_RUNOFF_FILE_OPEN, Frunoff.name);
else runoff_initFile();
break;
}
// --- see if a climate file should be opened
if ( Frunoff.mode != USE_FILE && Fclimate.mode == USE_FILE )
{
climate_openFile();
}
return ErrorCode;
}
示例12: climate_validate
void climate_validate()
//
// Input: none
// Output: none
// Purpose: validates climatological variables
//
{
int i; //(5.1.007)
double a, z, pa;
// --- check if climate data comes from external data file //(5.1.007)
if ( Wind.type == FILE_WIND || Evap.type == FILE_EVAP ||
Evap.type == TEMPERATURE_EVAP )
{
if ( Fclimate.mode == NO_FILE )
{
report_writeErrorMsg(ERR_NO_CLIMATE_FILE, "");
}
}
// --- open the climate data file //(5.1.007)
if ( Fclimate.mode == USE_FILE ) climate_openFile(); //(5.1.007)
// --- snow melt parameters tipm & rnm must be fractions
if ( Snow.tipm < 0.0 ||
Snow.tipm > 1.0 ||
Snow.rnm < 0.0 ||
Snow.rnm > 1.0 ) report_writeErrorMsg(ERR_SNOWMELT_PARAMS, "");
// --- latitude should be between -90 & 90 degrees
a = Temp.anglat;
if ( a <= -89.99 ||
a >= 89.99 ) report_writeErrorMsg(ERR_SNOWMELT_PARAMS, "");
else Temp.tanAnglat = tan(a * PI / 180.0);
// --- compute psychrometric constant
z = Temp.elev / 1000.0;
if ( z <= 0.0 ) pa = 29.9;
else pa = 29.9 - 1.02*z + 0.0032*pow(z, 2.4); // atmos. pressure
Temp.gamma = 0.000359 * pa;
// --- convert units of monthly temperature & evap adjustments //(5.1.007)
for (i = 0; i < 12; i++)
{
if (UnitSystem == SI) Adjust.temp[i] *= 9.0/5.0;
Adjust.evap[i] /= UCF(EVAPRATE);
}
}
示例13: node_validate
void node_validate(int j)
//
// Input: j = node index
// Output: none
// Purpose: validates a node's properties.
//
{
TDwfInflow* inflow;
// --- see if full depth was increased to accommodate conduit crown
if ( Node[j].fullDepth > Node[j].oldDepth && Node[j].oldDepth > 0.0 )
{
report_writeWarningMsg(WARN02, Node[j].ID);
}
// --- check that initial depth does not exceed max. depth
if ( Node[j].initDepth > Node[j].fullDepth + Node[j].surDepth )
report_writeErrorMsg(ERR_NODE_DEPTH, Node[j].ID);
if ( Node[j].type == DIVIDER ) divider_validate(j);
// --- initialize dry weather inflows
inflow = Node[j].dwfInflow;
while (inflow)
{
inflow_initDwfInflow(inflow);
inflow = inflow->next;
}
}
示例14: routing_open
int routing_open()
//
// Input: none
// Output: returns an error code
// Purpose: initializes the routing analyzer.
//
{
// --- open treatment system
if ( !treatmnt_open() ) return ErrorCode;
// --- topologically sort the links
SortedLinks = NULL;
if ( Nobjects[LINK] > 0 )
{
SortedLinks = (int *) calloc(Nobjects[LINK], sizeof(int));
if ( !SortedLinks )
{
report_writeErrorMsg(ERR_MEMORY, "");
return ErrorCode;
}
toposort_sortLinks(SortedLinks);
if ( ErrorCode ) return ErrorCode;
}
// --- open any routing interface files
iface_openRoutingFiles();
return ErrorCode;
}
示例15: iface_openRoutingFiles
void iface_openRoutingFiles()
//
// Input: none
// Output: none
// Purpose: opens routing interface files.
//
{
// --- initialize shared variables
NumIfacePolluts = 0;
IfacePolluts = NULL;
NumIfaceNodes = 0;
IfaceNodes = NULL;
OldIfaceValues = NULL;
NewIfaceValues = NULL;
// --- check that inflows & outflows files are not the same
if ( Foutflows.mode != NO_FILE && Finflows.mode != NO_FILE )
{
if ( strcomp(Foutflows.name, Finflows.name) )
{
report_writeErrorMsg(ERR_ROUTING_FILE_NAMES, "");
return;
}
}
// --- open the file for reading or writing
if ( Foutflows.mode == SAVE_FILE ) openFileForOutput();
if ( Finflows.mode == USE_FILE ) openFileForInput();
}