本文整理汇总了C++中CMoptLookup函数的典型用法代码示例。如果您正苦于以下问题:C++ CMoptLookup函数的具体用法?C++ CMoptLookup怎么用?C++ CMoptLookup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CMoptLookup函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MDWetlandAreaDef
int MDWetlandAreaDef (){
int optID = MFUnset;
const char *optStr, *optName = MDVarWetlandAreaFraction;
const char *options [] = { MDNoneStr, MDInputStr, MDCalculateStr, (char *) NULL };
if ((optStr = MFOptionGet (optName)) != (char *) NULL) optID = CMoptLookup (options, optStr, true);
if ((optID == MDnone) || (_MDWetlandAreaFracID != MFUnset)) return (_MDWetlandAreaFracID);
MFDefEntering ("WetlandArea");
// printf ("Wetland Area optID =%i \n",optID);
if (_MDWetlandAreaFracID != MFUnset) return (_MDWetlandAreaFracID);
switch (optID) {
case MDinput:
if ((_MDWetlandAreaFracID = MFVarGetID (MDVarWetlandAreaFraction, "[-]", MFInput, MFState, MFBoundary)) == CMfailed)
return (CMfailed);
break;
case MDcalculate:
if ((MFModelAddFunction (_MDWetlandAreaFraction) == CMfailed)) return (CMfailed);
break;
default: MFOptionMessage (optName, optStr, options); return (CMfailed);
}
MFDefLeaving("WetlandArea");
return (_MDWetlandAreaFracID);
}
示例2: MDRiverbedShapeExponentDef
int MDRiverbedShapeExponentDef () {
int optID = MFUnset;
const char *optStr, *optName = MDOptRiverbed;
const char *options [] = { MDInputStr, "slope-independent", "slope-dependent", (char *) NULL };
if (_MDOutRiverbedShapeExponentID != MFUnset) return (_MDOutRiverbedShapeExponentID);
MFDefEntering ("Riverbed Geometry");
if ((optStr = MFOptionGet (optName)) != (char *) NULL) optID = CMoptLookup (options,optStr,true);
switch (optID) {
case MDinput:
if (((_MDOutRiverbedAvgDepthMeanID = MFVarGetID (MDVarRiverbedAvgDepthMean, "m", MFInput, MFState, MFBoundary)) == CMfailed) ||
((_MDOutRiverbedWidthMeanID = MFVarGetID (MDVarRiverbedWidthMean, "m", MFInput, MFState, MFBoundary)) == CMfailed) ||
((_MDOutRiverbedVelocityMeanID = MFVarGetID (MDVarRiverbedVelocityMean, "m/s", MFInput, MFState, MFBoundary)) == CMfailed) ||
((_MDOutRiverbedShapeExponentID = MFVarGetID (MDVarRiverbedShapeExponent, MFNoUnit, MFInput, MFState, MFBoundary)) == CMfailed))
return (CMfailed);
break;
case MDdependent:
if ((_MDInRiverbedSlopeID = MFVarGetID (MDVarRiverbedSlope, "m/km", MFInput, MFState, MFBoundary)) == CMfailed)
return (CMfailed);
case MDindependent:
if (((_MDInDischMeanID = MDDischMeanDef ()) == CMfailed) ||
((_MDOutRiverbedAvgDepthMeanID = MFVarGetID (MDVarRiverbedAvgDepthMean, "m", MFOutput, MFState, MFBoundary)) == CMfailed) ||
((_MDOutRiverbedWidthMeanID = MFVarGetID (MDVarRiverbedWidthMean, "m", MFOutput, MFState, MFBoundary)) == CMfailed) ||
((_MDOutRiverbedVelocityMeanID = MFVarGetID (MDVarRiverbedVelocityMean, "m/s", MFOutput, MFState, MFBoundary)) == CMfailed) ||
((_MDOutRiverbedShapeExponentID = MFVarGetID (MDVarRiverbedShapeExponent, MFNoUnit, MFOutput, MFState, MFBoundary)) == CMfailed) ||
(MFModelAddFunction (_MDRiverbedShapeExponent) == CMfailed)) return (CMfailed);
break;
default: MFOptionMessage (optName, optStr, options); return (CMfailed);
}
MFDefLeaving ("Riverbed Geometry");
return (_MDOutRiverbedShapeExponentID);
}
示例3: MDSmallReservoirCapacityDef
int MDSmallReservoirCapacityDef () {
int optID = MFUnset;
const char *optStr, *optName = MDVarSmallResCapacity;
const char *options [] = { MDNoneStr, MDInputStr, MDCalculateStr, (char *) NULL };
if ((optStr = MFOptionGet (optName)) != (char *) NULL) optID = CMoptLookup (options, optStr, true);
if ((optID == MDnone) || (_MDOutSmallResCapacityID != MFUnset)) return (_MDOutSmallResCapacityID);
MFDefEntering("SmallReservoirCapacity");
if ((_MDInIrrGrossDemandID = MDIrrGrossDemandDef ()) != MFUnset) {
switch (optID) {
case MDinput:
if ((_MDOutSmallResCapacityID = MFVarGetID (MDVarSmallResCapacity, "mm", MFInput, MFState, MFBoundary)) == CMfailed)
return (CMfailed);
break;
case MDcalculate:
if ((_MDInIrrGrossDemandID == CMfailed) ||
((_MDInIrrAreaID = MDIrrigatedAreaDef ())== CMfailed) ||
((_MDInRainSurfRunoffID = MFVarGetID (MDVarRainSurfRunoff, "mm", MFInput, MFFlux, MFBoundary)) == CMfailed) ||
((_MDOutRainSurfRunoffAccumulatedID = MFVarGetID ("__SurfaceROAccumulated", "mm", MFOutput, MFState, MFInitial)) == CMfailed) ||
((_MDOutIrrGrossDemandAccumulatedID = MFVarGetID ("__GrossDemandAccumulated", "mm", MFOutput, MFState, MFInitial)) == CMfailed) ||
((_MDInSmallResStorageFractionID = MFVarGetID (MDVarSmallReservoirStorageFrac, "-", MFInput,MFState,MFBoundary)) == CMfailed) ||
((_MDOutSmallResCapacityID = MFVarGetID (MDVarSmallResCapacity, "mm", MFOutput, MFState, MFInitial)) == CMfailed) ||
(MFModelAddFunction (_MDSmallReservoirCapacity) == CMfailed)) return (CMfailed);
break;
default: MFOptionMessage (optName, optStr, options); return (CMfailed);
}
}
MFDefLeaving("SmallReservoirCapacity");
return (_MDOutSmallResCapacityID);
}
示例4: MDWTempGrdWaterDef
int MDWTempGrdWaterDef () {
int optID = MDinput; // RJS 061312
const char *optStr, *optName = MDOptGrdWaterTemp; // RJS 061312
const char *options [] = { MDCalculateStr, MDInputStr, (char *) NULL }; // RJS 061312
if ((optStr = MFOptionGet (optName)) != (char *) NULL) optID = CMoptLookup (options, optStr, true); // RJS 061312
if (_MDOutWTempGrdWaterID != MFUnset) return (_MDOutWTempGrdWaterID);
MFDefEntering ("Groundwater temperature");
switch (optID) { // RJS 061312
case MDcalculate: // RJS 061312
if (((_MDInWTempSurfRunoffID = MDWTempSurfRunoffDef ()) == CMfailed) ||
((_MDInRainRechargeID = MDRainInfiltrationDef ()) == CMfailed) ||
((_MDInIrrReturnFlowID = MDIrrReturnFlowDef ()) == CMfailed) ||
((_MDOutGrdWaterID = MDBaseFlowDef ()) == CMfailed) ||
((_MDInAirTempID = MFVarGetID (MDVarAirTemperature, "degC", MFInput, MFState, MFBoundary)) == CMfailed) ||
((_MDOutWTempGrdWaterID = MFVarGetID (MDVarWTempGrdWater, "degC", MFOutput, MFState, MFInitial)) == CMfailed) ||
(MFModelAddFunction (_MDWTempGrdWater) == CMfailed)) return (CMfailed);
break; // RJS 061312
case MDinput: _MDOutWTempGrdWaterID = MFVarGetID (MDVarWTempGrdWater, "degC", MFInput, MFState, MFBoundary); break; // RJS 061312 MFInitial changed to MFBoundary in order to read in // RJS 061312
default: MFOptionMessage (optName, optStr, options); return (CMfailed); // RJS 061312
} // RJS 061312
MFDefLeaving ("Groundwater temperature");
return (_MDOutWTempGrdWaterID);
}
示例5: MDRainInterceptDef
int MDRainInterceptDef () {
int optID = MFUnset;
const char *optStr, *optName = MDVarRainInterception;
const char *options [] = { MDNoneStr, MDInputStr, MDCalculateStr, (char *) NULL };
if ((optStr = MFOptionGet (optName)) != (char *) NULL) optID = CMoptLookup (options,optStr,true);
if ((optID == MDnone) || (_MDOutInterceptID != MFUnset)) return (_MDOutInterceptID);
MFDefEntering ("Rainfed Intercept");
switch (optID) {
case MDinput: _MDOutInterceptID = MFVarGetID (MDVarRainInterception, "mm", MFInput, MFFlux, false); break;
case MDcalc:
if (((_MDInPrecipID = MDPrecipitationDef ()) == CMfailed) ||
((_MDInSPackChgID = MDSPackChgDef ()) == CMfailed) ||
((_MDInLeafAreaIndexID = MDLeafAreaIndexDef ()) == CMfailed) ||
((_MDInStemAreaIndexID = MDStemAreaIndexDef ()) == CMfailed) ||
((_MDInPetID = MDRainPotETDef ()) == CMfailed) ||
((_MDOutInterceptID = MFVarGetID (MDVarRainInterception, "mm", MFOutput, MFFlux, MFBoundary)) == CMfailed) ||
(MFModelAddFunction (_MDRainIntercept) == CMfailed)) return (CMfailed);
break;
default: MFOptionMessage (optName, optStr, options); return (CMfailed);
}
MFDefLeaving ("Rainfed Intercept");
return (_MDOutInterceptID);
}
示例6: MDReservoirDef
int MDReservoirDef () {
int optID = MFUnset;
const char *optStr, *optName = MDOptReservoirs;
const char *options [] = { MDNoneStr, MDCalculateStr, (char *) NULL };
if ((optStr = MFOptionGet (optName)) != (char *) NULL) optID = CMoptLookup (options, optStr, true);
if ((optID == MDnone) || (_MDOutResReleaseID != MFUnset)) return (_MDOutResReleaseID);
MFDefEntering ("Reservoirs");
switch (optID) {
case MDcalculate:
if (((_MDInDischMeanID = MDDischMeanDef ()) == CMfailed) ||
((_MDInDischargeID = MDDischLevel2Def ()) == CMfailed) ||
((_MDInResCapacityID = MFVarGetID (MDVarReservoirCapacity, "km3", MFInput, MFState, MFBoundary)) == CMfailed) ||
((_MDOutResStorageID = MFVarGetID (MDVarReservoirStorage, "km3", MFOutput, MFState, MFInitial)) == CMfailed) ||
((_MDOutResStorageChgID = MFVarGetID (MDVarReservoirStorageChange, "km3", MFOutput, MFState, MFBoundary)) == CMfailed) ||
((_MDOutResReleaseID = MFVarGetID (MDVarReservoirRelease, "m3/s", MFOutput, MFFlux, MFBoundary)) == CMfailed) ||
(MFModelAddFunction (_MDReservoir) == CMfailed)) return (CMfailed);
break;
default: MFOptionMessage (optName, optStr, options); return (CMfailed);
}
MFDefLeaving ("Reservoirs");
return (_MDOutResReleaseID);
}
示例7: MDRainPotETDef
int MDRainPotETDef () {
int optID = MFUnset;
const char *optStr, *optName = MDVarRainPotEvapotrans;
const char *options [] = { MDInputStr, "Hamon", "Jensen", "PsTaylor", "Pstd", "PMday", "PMdn", "SWGday", "SWGdn", "Turc", (char *) NULL };
if (_MDPotETID != MFUnset) return (_MDPotETID);
if ((optStr = MFOptionGet (optName)) != (char *) NULL) optID = CMoptLookup (options,optStr,true);
MFDefEntering ("Rainfed Potential Evapotranspiration");
switch (optID) {
case MDinput: _MDPotETID = MFVarGetID (MDVarRainPotEvapotrans, "mm", MFInput, MFFlux, false); break;
case MDHamon: _MDPotETID = MDRainPotETHamonDef (); break;
case MDJensen: _MDPotETID = MDRainPotETJensenDef (); break;
case MDPsTaylor: _MDPotETID = MDRainPotETPsTaylorDef (); break;
case MDPstd: _MDPotETID = MDRainPotETPstdDef (); break;
case MDPMday: _MDPotETID = MDRainPotETPMdayDef (); break;
case MDPMdn: _MDPotETID = MDRainPotETPMdnDef (); break;
case MDSWGday: _MDPotETID = MDRainPotETSWGdayDef (); break;
case MDSWGdn: _MDPotETID = MDRainPotETSWGdnDef (); break;
case MDTurc: _MDPotETID = MDRainPotETTurcDef (); break;
default: MFOptionMessage (optName, optStr, options); return (CMfailed);
}
MFDefLeaving ("Rainfed Potential Evapotranspiration");
return (_MDPotETID);
}
示例8: MDDischLevel3MuskingumCoeffDef
int MDDischLevel3MuskingumCoeffDef () {
int optID = MFUnset;
const char *optStr, *optName = MDOptMuskingum;
const char *options [] = { MDInputStr, "static", (char *) NULL };
if (_MDOutMuskingumC0ID != MFUnset) return (_MDOutMuskingumC0ID);
MFDefEntering ("Muskingum Coefficients");
if ((optStr = MFOptionGet (optName)) != (char *) NULL) optID = CMoptLookup (options, optStr, true);
switch (optID) {
case MDinput:
if (((_MDOutMuskingumC0ID = MFVarGetID (MDVarMuskingumC0, MFNoUnit, MFInput, MFState, MFBoundary)) == CMfailed) ||
((_MDOutMuskingumC1ID = MFVarGetID (MDVarMuskingumC1, MFNoUnit, MFInput, MFState, MFBoundary)) == CMfailed) ||
((_MDOutMuskingumC2ID = MFVarGetID (MDVarMuskingumC2, MFNoUnit, MFInput, MFState, MFBoundary)) == CMfailed))
return (CMfailed);
break;
case MDstatic:
if (((_MDInRiverbedShapeExponentID = MDRiverbedShapeExponentDef ()) == CMfailed) ||
((_MDInRiverbedWidthMeanID = MFVarGetID (MDVarRiverbedWidthMean, "m", MFInput, MFState, MFBoundary)) == CMfailed) ||
((_MDInRiverbedAvgDepthMeanID = MFVarGetID (MDVarRiverbedAvgDepthMean, "m", MFInput, MFState, MFBoundary)) == CMfailed) ||
((_MDInRiverbedVelocityMeanID = MFVarGetID (MDVarRiverbedVelocityMean, "m/s", MFInput, MFState, MFBoundary)) == CMfailed) ||
((_MDInRiverbedSlopeID = MFVarGetID (MDVarRiverbedSlope, "m/km", MFInput, MFState, MFBoundary)) == CMfailed) ||
((_MDOutMuskingumC0ID = MFVarGetID (MDVarMuskingumC0, MFNoUnit, MFOutput, MFState, MFBoundary)) == CMfailed) ||
((_MDOutMuskingumC1ID = MFVarGetID (MDVarMuskingumC1, MFNoUnit, MFOutput, MFState, MFBoundary)) == CMfailed) ||
((_MDOutMuskingumC2ID = MFVarGetID (MDVarMuskingumC2, MFNoUnit, MFOutput, MFState, MFBoundary)) == CMfailed) ||
((_MDOutCourantID = MFVarGetID ("Courant", MFNoUnit, MFOutput, MFState, MFBoundary)) == CMfailed) ||
(MFModelAddFunction (_MDDischRouteMuskingumCoeff) == CMfailed)) return (CMfailed);
break;
default: MFOptionMessage (optName, optStr, options); return (CMfailed);
}
MFDefLeaving ("Muskingum Coefficients");
return (_MDOutMuskingumC0ID);
}
示例9: MDGrossRadDef
int MDGrossRadDef () {
int optID = MFUnset;
const char *optStr, *optName = MDVarGrossRadiance;
const char *options [] = { MDInputStr, "standard", "Otto", (char *) NULL };
float par;
if (_MDOutGrossRadID != MFUnset) return (_MDOutGrossRadID);
MFDefEntering ("Gross Radiance");
if ((optStr = MFOptionGet (optName)) != (char *) NULL) optID = CMoptLookup (options, optStr, true);
switch (optID) {
case MDinput:
_MDOutGrossRadID = MFVarGetID (MDVarGrossRadiance, "MJ/m^2", MFInput, MFFlux, MFBoundary);
break;
case MDstandard:
if (((optStr = MFOptionGet (MDParGrossRadTAU)) != (char *) NULL) && (sscanf (optStr,"%f",&par) == 1))
_MDGrossRadStdTAU = par;
if (((_MDOutGrossRadID = MFVarGetID (MDVarGrossRadiance, "MJ/m^2", MFOutput, MFFlux, MFBoundary)) == CMfailed) ||
(MFModelAddFunction (_MDGrossRadianceStd) == CMfailed)) return (CMfailed);
break;
case MDOtto:
if (((_MDOutGrossRadID = MFVarGetID (MDVarGrossRadiance, "MJ/m^2", MFOutput, MFFlux, MFBoundary)) == CMfailed) ||
(MFModelAddFunction (_MDGrossRadianceOtto) == CMfailed)) return (CMfailed);
break;
default:
MFOptionMessage (optName, optStr, options);
return (CMfailed);
}
MFDefLeaving ("Gross Radiance");
return (_MDOutGrossRadID);
}
示例10: MDBaseFlowDef
int MDBaseFlowDef () {
float par;
const char *optStr;
// Test if the percolation pathway is active (if its not - PercolationBETA should not be in the Options)
if ((optStr = MFOptionGet(MDParSoilPercolationBETA)) != (char *) NULL) {
if ((_MDInSoilPercolationID = MFVarGetID (MDVarSoilPercolation, "mm", MFInput, MFFlux, MFBoundary)) == CMfailed) return (CMfailed); // SZ 10212014
}
int optID = MFUnset; // RJS 060214
const char *optName = MDVarRunoff; // RJS 060214
const char *options [] = { "spatially", MDCalculateStr, MDPnETStr, (char *) NULL }; // RJS 060214
if (_MDOutBaseFlowID != MFUnset) return (_MDOutBaseFlowID);
MFDefEntering ("Base flow");
if ((optStr = MFOptionGet (optName)) != (char *) NULL) optID = CMoptLookup (options, optStr, true); // RJS 060214
switch (optID) {
case MDspatial:
if ((_MDInGroundWatBETAID = MFVarGetID(MDParGroundWatBETA, "1/d", MFInput, MFState, MFBoundary)) == CMfailed) return (CMfailed);
case MDcalculate:
if (_MDInGroundWatBETAID == MFUnset) {
if (((optStr = MFOptionGet (MDParGroundWatBETA)) != (char *) NULL) && (sscanf (optStr,"%f",&par) == 1)) _MDGroundWatBETA = par;
}
if (((_MDInRechargeID = MDRainInfiltrationDef ()) == CMfailed) ||
((_MDInIrrGrossDemandID = MDIrrGrossDemandDef ()) == CMfailed)) return (CMfailed);
if ( _MDInIrrGrossDemandID != MFUnset) {
if (((_MDInSmallResReleaseID = MDSmallReservoirReleaseDef ()) == CMfailed) ||
((_MDInIrrAreaFracID = MDIrrigatedAreaDef ()) == CMfailed) ||
((_MDInIrrReturnFlowID = MFVarGetID (MDVarIrrReturnFlow, "mm", MFInput, MFFlux, MFBoundary)) == CMfailed) ||
((_MDOutIrrUptakeExternalID = MFVarGetID (MDVarIrrUptakeExternal, "mm", MFOutput, MFFlux, MFBoundary)) == CMfailed) ||
((_MDOutIrrUptakeGrdWaterID = MDIrrUptakeGrdWaterDef ()) == CMfailed))
return CMfailed;
}
if (((_MDOutGrdWatID = MFVarGetID (MDVarGroundWater, "mm", MFOutput, MFState, MFInitial)) == CMfailed) ||
((_MDOutGrdWatChgID = MFVarGetID (MDVarGroundWaterChange, "mm", MFOutput, MFFlux, MFBoundary)) == CMfailed) ||
((_MDOutGrdWatRechargeID = MFVarGetID (MDVarGroundWaterRecharge, "mm", MFOutput, MFFlux, MFBoundary)) == CMfailed) ||
((_MDOutGrdWatUptakeID = MFVarGetID (MDVarGroundWaterUptake, "mm", MFOutput, MFFlux, MFBoundary)) == CMfailed) ||
((_MDOutBaseFlowID = MFVarGetID (MDVarBaseFlow, "mm", MFOutput, MFFlux, MFBoundary)) == CMfailed) ||
(MFModelAddFunction (_MDBaseFlow) == CMfailed)) return (CMfailed);
break;
case MDPnET:
if (_MDInGroundWatBETAID == MFUnset) {
if (((optStr = MFOptionGet (MDParGroundWatBETA)) != (char *) NULL) && (sscanf (optStr,"%f",&par) == 1)) _MDGroundWatBETA = par;
}
if (((_MDInRechargeID = MDRainInfiltrationDef ()) == CMfailed) ||
((_MDOutGrdWatID = MFVarGetID (MDVarGroundWater, "mm", MFOutput, MFState, MFInitial)) == CMfailed) ||
((_MDOutGrdWatChgID = MFVarGetID (MDVarGroundWaterChange, "mm", MFOutput, MFFlux, MFBoundary)) == CMfailed) ||
((_MDOutGrdWatRechargeID = MFVarGetID (MDVarGroundWaterRecharge, "mm", MFOutput, MFFlux, MFBoundary)) == CMfailed) ||
((_MDOutGrdWatUptakeID = MFVarGetID (MDVarGroundWaterUptake, "mm", MFOutput, MFFlux, MFBoundary)) == CMfailed) ||
((_MDOutBaseFlowID = MFVarGetID (MDVarBaseFlow, "mm", MFOutput, MFFlux, MFBoundary)) == CMfailed) ||
(MFModelAddFunction (_MDBaseFlow2) == CMfailed)) return (CMfailed); // RJS 061312
break;
}
MFDefLeaving ("Base flow ");
return (_MDOutBaseFlowID);
}
示例11: MDWTempRiverRouteDef
int MDWTempRiverRouteDef () {
int optID = MFUnset, waterBalanceID;
const char *optStr;
const char *options [] = { "none", "calculate", (char *) NULL };
if (_MDWTempRiverRouteID != MFUnset) return (_MDWTempRiverRouteID);
MFDefEntering ("Route river temperature");
if (((optStr = MFOptionGet (MDOptReservoirs)) == (char *) NULL) ||
((optID = CMoptLookup ( options, optStr, true)) == CMfailed)) {
CMmsgPrint(CMmsgUsrError,"Reservoir Option not specified! Option none or calculate");
return CMfailed;
}
if (optID==1) {
if ((( waterBalanceID = MDWaterBalanceDef ()) == CMfailed) ||
((_MDInResStorageChangeID = MFVarGetID (MDVarReservoirStorageChange, "km3", MFInput, MFState, MFBoundary)) == CMfailed) || //RJS 071511
((_MDInResStorageID = MFVarGetID (MDVarReservoirStorage, "km3", MFInput, MFState, MFInitial)) == CMfailed) || //RJS 121311 changed from MFBoundary to MFInitial
((_MDInResCapacityID = MFVarGetID (MDVarReservoirCapacity, "km3", MFInput, MFState, MFBoundary)) == CMfailed))
return (CMfailed);
}
//input
if (((_MDInDischargeID = MDDischargeDef ()) == CMfailed) ||
(( waterBalanceID = MDWaterBalanceDef ()) == CMfailed) ||
((_MDInSolarRadID = MDSolarRadDef ()) == CMfailed) ||
((_MDInWTempRiverID = MDWTempRiverDef ()) == CMfailed) ||
((_MDInRiverWidthID = MDRiverWidthDef ()) == CMfailed) ||
((_MDInRunoffVolumeID = MDRunoffVolumeDef ()) == CMfailed) ||
((_MDInWdl_QxTID = MDThermalInputsDef ()) == CMfailed) || //RJS 072011
((_MDInDischargeIncomingID = MFVarGetID (MDVarDischarge0, "m3/s", MFInput, MFFlux, MFBoundary)) == CMfailed) ||
((_MDInWindSpeedID = MFVarGetID (MDVarWindSpeed, "m/s", MFInput, MFState, MFBoundary)) == CMfailed) ||
((_MDInAirTemperatureID = MFVarGetID (MDVarAirTemperature, "degC", MFInput, MFState, MFBoundary)) == CMfailed) ||
((_MDInCloudCoverID = MFVarGetID (MDVarCloudCover, "%", MFInput, MFState, MFBoundary)) == CMfailed) ||
((_MDInRiverStorageChgID = MFVarGetID (MDVarRiverStorageChg, "m3/s", MFInput, MFState, MFBoundary)) == CMfailed) ||
((_MDInRiverStorageID = MFVarGetID (MDVarRiverStorage, "m3", MFInput, MFState, MFInitial)) == CMfailed) ||
((_MDInSnowPackID = MFVarGetID (MDVarSnowPack, "mm", MFInput, MFState, MFBoundary)) == CMfailed) ||
((_MDInWarmingTempID = MFVarGetID (MDVarWarmingTemp, "degC", MFInput, MFState, MFBoundary)) == CMfailed) || //RJS 072011
((_MDInThermalWdlID = MFVarGetID (MDVarThermalWdl, "-", MFInput, MFState, MFBoundary)) == CMfailed) || //RJS 072011
// output
((_MDLocalIn_QxTID = MFVarGetID (MDVarBgcLocalIn_QxT, "m3*degC/d", MFOutput, MFFlux, MFBoundary)) == CMfailed) ||
((_MDRemoval_QxTID = MFVarGetID (MDVarRemoval_QxT, "m3*degC/d", MFOutput, MFFlux, MFBoundary)) == CMfailed) ||
((_MDFlux_QxTID = MFVarGetID (MDVarFlux_QxT, "m3*degC/d", MFRoute, MFFlux, MFBoundary)) == CMfailed) ||
((_MDStorage_QxTID = MFVarGetID (MDVarStorage_QxT, "m3*degC", MFOutput, MFState, MFInitial)) == CMfailed) ||
((_MDDeltaStorage_QxTID = MFVarGetID (MDVarDeltaStorage_QxT, "m3*degC/d", MFOutput, MFFlux, MFBoundary)) == CMfailed) ||
((_MDWTemp_QxTID = MFVarGetID (MDVarWTemp_QxT, "degC", MFOutput, MFState, MFBoundary)) == CMfailed) ||
((_MDWTempDeltaT_QxTID = MFVarGetID (MDVarWTempDeltaT_QxT, "degC", MFOutput, MFState, MFBoundary)) == CMfailed) ||
//output mixing
((_MDFluxMixing_QxTID = MFVarGetID (MDVarFluxMixing_QxT, "m3*degC/d", MFRoute, MFFlux, MFBoundary)) == CMfailed) ||
((_MDStorageMixing_QxTID = MFVarGetID (MDVarStorageMixing_QxT, "m3*degC", MFOutput, MFState, MFInitial)) == CMfailed) ||
((_MDDeltaStorageMixing_QxTID = MFVarGetID (MDVarDeltaStorageMixing_QxT, "m3*degC/d", MFOutput, MFFlux, MFBoundary)) == CMfailed) ||
((_MDWTempMixing_QxTID = MFVarGetID (MDVarWTempMixing_QxT, "degC", MFOutput, MFState, MFBoundary)) == CMfailed) ||
(MFModelAddFunction (_MDWTempRiverRoute) == CMfailed)) return (CMfailed);
MFDefLeaving ("Route river temperature");
return (_MDWTemp_QxTID);
}
示例12: MDRunoffDef
int MDRunoffDef () {
int optID = MFUnset;
const char *optStr, *optName = MDVarRunoff;
const char *options [] = { MDInputStr, MDCalculateStr, "corrected", MDInput2Str, (char *) NULL };
if (_MDOutRunoffID != MFUnset) return (_MDOutRunoffID);
MFDefEntering ("Runoff");
if ((optStr = MFOptionGet (optName)) != (char *) NULL) optID = CMoptLookup (options, optStr, true);
switch (optID) {
// case MDinput: _MDOutRunoffID = MFVarGetID (MDVarRunoff, "mm", MFInput, MFFlux, MFBoundary); break; // RJS commented out 061312
case MDinput: // RJS 061312
if (((_MDInBaseFlowID = MFVarGetID (MDVarBaseFlow, "mm", MFInput, MFFlux, MFBoundary)) == CMfailed) || // RJS 061312
// ((_MDInRunoffPoolReleaseID = MFVarGetID (MDVarRunoffPoolRelease, "mm", MFInput, MFFlux, MFBoundary)) == CMfailed) || // RJS 061312, commented out 082812
((_MDInTotalSurfRunoffID = MFVarGetID (MDVarTotalSurfRunoff, "mm", MFInput, MFFlux, MFBoundary)) == CMfailed) || // RJS 082812
((_MDOutPropROStormWaterID = MFVarGetID (MDVarPropROStormWater, "-", MFOutput, MFState, MFBoundary)) == CMfailed) || // RJS 100313
((_MDOutPropROSurfaceWaterID = MFVarGetID (MDVarPropROSurfaceWater, "-", MFOutput, MFState, MFBoundary)) == CMfailed) || // RJS 100313
((_MDOutPropROGroundWaterID = MFVarGetID (MDVarPropROGroundWater, "-", MFOutput, MFState, MFBoundary)) == CMfailed) ||
((_MDOutTotalSurfRunoffID = MFVarGetID (MDVarTotalSurfRunoff, "mm", MFOutput, MFFlux, MFBoundary)) == CMfailed) ||
((_MDOutRunoffID = MFVarGetID (MDVarRunoff, "mm", MFOutput, MFFlux, MFBoundary)) == CMfailed) || // RJS 061312
(MFModelAddFunction (_MDRunoffInput) == CMfailed)) return (CMfailed); // RJS 061312
break; // RJS 061312
case MDinput2:
if (((_MDInBaseFlowID = MDBaseFlowDef ()) == CMfailed) ||
((_MDInRunoffPoolReleaseID = MDSurfRunoffPoolDef ()) == CMfailed) || // RJS 042612
((_MDOutPropROStormWaterID = MFVarGetID (MDVarPropROStormWater, "-", MFOutput, MFState, MFBoundary)) == CMfailed) || // RJS 100313
((_MDOutPropROSurfaceWaterID = MFVarGetID (MDVarPropROSurfaceWater, "-", MFOutput, MFState, MFBoundary)) == CMfailed) || // RJS 100313
((_MDOutPropROGroundWaterID = MFVarGetID (MDVarPropROGroundWater, "-", MFOutput, MFState, MFBoundary)) == CMfailed) ||
((_MDOutTotalSurfRunoffID = MFVarGetID (MDVarTotalSurfRunoff, "mm", MFOutput, MFFlux, MFBoundary)) == CMfailed) ||
((_MDOutRunoffID = MFVarGetID (MDVarRunoff, "mm", MFOutput, MFFlux, MFBoundary)) == CMfailed) || // RJS 061312
(MFModelAddFunction (_MDRunoffInput2) == CMfailed)) return (CMfailed); // RJS 061312
break;
case MDcorrected:
if ((_MDInRunoffCorrID = MFVarGetID (MDVarRunoffCorretion, MFNoUnit, MFInput, MFState, MFBoundary)) == CMfailed)
return (CMfailed);
break; // RJS 082812
case MDcalculate:
if (((_MDInBaseFlowID = MDBaseFlowDef ()) == CMfailed) ||
// ((_MDInSurfRunoffID = MDSurfRunoffDef ()) == CMfailed) || //commented out RJS 042612
((_MDInRunoffPoolReleaseID = MDSurfRunoffPoolDef ()) == CMfailed) || // RJS 042612
// ((_MDInStormRunoffTotalID = MDStormRunoffDef ()) == CMfailed) || // RJS 082812
((_MDInStormRunoffTotalID = MFVarGetID (MDVarStormRunoffTotal, "mm", MFInput, MFFlux, MFBoundary)) == CMfailed) ||
((_MDOutPropROStormWaterID = MFVarGetID (MDVarPropROStormWater, "-", MFOutput, MFState, MFBoundary)) == CMfailed) || // RJS 100313
((_MDOutPropROSurfaceWaterID = MFVarGetID (MDVarPropROSurfaceWater, "-", MFOutput, MFState, MFBoundary)) == CMfailed) || // RJS 100313
((_MDOutPropROGroundWaterID = MFVarGetID (MDVarPropROGroundWater, "-", MFOutput, MFState, MFBoundary)) == CMfailed) ||
((_MDOutRunoffID = MFVarGetID (MDVarRunoff, "mm", MFOutput, MFFlux, MFBoundary)) == CMfailed) ||
((_MDOutTotalSurfRunoffID = MFVarGetID (MDVarTotalSurfRunoff, "mm", MFOutput, MFFlux, MFBoundary)) == CMfailed) ||
(MFModelAddFunction (_MDRunoff) == CMfailed)) return (CMfailed);
break;
default: MFOptionMessage (optName, optStr, options); return (CMfailed);
}
MFDefLeaving ("Runoff");
return (_MDOutRunoffID);
}
示例13: NCurlGetType
NCurlType NCurlGetType (const char *url) {
int ret;
NCurlType codes [] = { NCurlFile, NCurlHttp, NCurlFtp, NCurlInvalid };
const char *opts [] = { "file", "http", "ftp", NULL };
if ((ret = CMoptLookup (opts, url, false)) == CMfailed) {
CMmsgPrint (CMmsgUsrError,"Invalid url: \"%s\"!\n", url);
return (NCurlInvalid);
}
return (codes [ret]);
}
示例14: MDWTempRiverDef
int MDWTempRiverDef () {
const char *optStr;
if (_MDOutWTempRiverID != MFUnset) return (_MDOutWTempRiverID);
MFDefEntering ("River temperature");
int optID = MFUnset; // RJS 060214
const char *optName = MDVarRunoff; // RJS 060214
const char *options [] = { MDCalculateStr, MDInputStr, MDInput2Str, (char *) NULL }; // RJS 060214
if ((optStr = MFOptionGet (optName)) != (char *) NULL) optID = CMoptLookup (options, optStr, true); // RJS 060214
switch (optID) {
case MDcalculate:
if (
((_MDInSurfRunoffID = MDRainSurfRunoffDef ()) == CMfailed) ||
// ((_MDInBaseFlowID = MDBaseFlowDef ()) == CMfailed) || // commented out 051614 so that input BaseFlow isn't overwritten
((_MDInBaseFlowID = MFVarGetID (MDVarBaseFlow, "mm", MFInput, MFFlux, MFBoundary)) == CMfailed) ||
// ((_MDInWTempSurfRunoffID = MDWTempSurfRunoffDef ()) == CMfailed) || // commented out RJS 060512
((_MDInWTempSurfRunoffPoolID = MDWTempSurfRunoffPoolDef ()) == CMfailed) || // RJS 060512
((_MDInWTempGrdWaterID = MDWTempGrdWaterDef ()) == CMfailed) ||
((_MDInTotalSurfRunoffID = MFVarGetID (MDVarTotalSurfRunoff, "mm", MFInput, MFFlux, MFBoundary)) == CMfailed) || //RJS 082812
((_MDOutWTempRiverID = MFVarGetID (MDVarWTempRiver, "degC", MFOutput, MFState, MFBoundary)) == CMfailed) ||
(MFModelAddFunction (_MDWTempRiver) == CMfailed)) return (CMfailed);
break;
case MDinput:
if (
((_MDInTotalSurfRunoffID = MFVarGetID (MDVarTotalSurfRunoff, "mm", MFInput, MFFlux, MFBoundary)) == CMfailed) ||
((_MDInBaseFlowID = MFVarGetID (MDVarBaseFlow, "mm", MFInput, MFFlux, MFBoundary)) == CMfailed) ||
((_MDInWTempSurfRunoffPoolID = MDWTempSurfRunoffPoolDef ()) == CMfailed) || // RJS 060512
((_MDInWTempGrdWaterID = MDWTempGrdWaterDef ()) == CMfailed) ||
// ((_MDInTotalSurfRunoffID = MFVarGetID (MDVarTotalSurfRunoff, "mm", MFInput, MFFlux, MFBoundary)) == CMfailed) || //RJS 082812
((_MDOutWTempRiverID = MFVarGetID (MDVarWTempRiver, "degC", MFOutput, MFState, MFBoundary)) == CMfailed) ||
(MFModelAddFunction (_MDWTempRiver) == CMfailed)) return (CMfailed);
break;
case MDinput2:
if (
((_MDInSurfRunoffID = MFVarGetID (MDVarRainSurfRunoff, "mm", MFInput, MFFlux, MFBoundary)) == CMfailed) ||
((_MDInBaseFlowID = MFVarGetID (MDVarBaseFlow, "mm", MFInput, MFFlux, MFBoundary)) == CMfailed) ||
((_MDInWTempSurfRunoffPoolID = MDWTempSurfRunoffPoolDef ()) == CMfailed) || // RJS 060512
((_MDInWTempGrdWaterID = MDWTempGrdWaterDef ()) == CMfailed) ||
((_MDInTotalSurfRunoffID = MFVarGetID (MDVarTotalSurfRunoff, "mm", MFInput, MFFlux, MFBoundary)) == CMfailed) || //RJS 082812
((_MDOutWTempRiverID = MFVarGetID (MDVarWTempRiver, "degC", MFOutput, MFState, MFBoundary)) == CMfailed) ||
(MFModelAddFunction (_MDWTempRiver) == CMfailed)) return (CMfailed);
break;
}
MFDefLeaving ("River temperature");
return (_MDOutWTempRiverID);
}
示例15: MDIrrSoilMoistChgDef
int MDIrrSoilMoistChgDef() {
int optID = MFUnset, ret;
const char *optStr, *optName = MDOptIrrigation;
const char *options [] = { MDNoneStr, MDInputStr, MDCalculateStr, (char *) NULL };
if ((optStr = MFOptionGet (optName)) != (char *) NULL) optID = CMoptLookup (options, optStr, true);
if ((optID == MDnone) || (optID == MDinput) || (_MDOutIrrSoilMoistChgID != MFUnset)) return (_MDOutIrrSoilMoistChgID);
if ((ret = MDIrrGrossDemandDef ()) == CMfailed) return (CMfailed);
if (ret == MFUnset) return (MFUnset);
_MDOutIrrSoilMoistChgID = MFVarGetID (MDVarIrrSoilMoistChange, "mm", MFInput, MFFlux, MFBoundary);
return (_MDOutIrrSoilMoistChgID);
}