示例#1
0
static void _NFcompAggregatePrint(NFobject_p object) {
    size_t i;
    NFcompAggregate_p component = (NFcompAggregate_p) object;

    if (component->TimeStep != (NFtimeStep_p) NULL) {
        if (component->TimeStep->Length > 1)
            CMmsgPrint(CMmsgInfo, "Time Step: %d %ss\n", component->TimeStep->Length,
                       NFtimeUnitString(component->TimeStep->Unit));
        else
            CMmsgPrint(CMmsgInfo, "Time Step: %d %s\n", component->TimeStep->Length,
                       NFtimeUnitString(component->TimeStep->Unit));
    }
    if (component->Component != (NFobject_p) NULL) CMmsgPrint(CMmsgInfo, "Component: %s\n", component->Component->Name);
    if (component->Variable != (NFnumVariable_p) NULL)
        CMmsgPrint(CMmsgInfo, "Variable: %s\n", component->Variable->Name);
    CMmsgPrint(CMmsgInfo, "Categories Begin\n");
    CMmsgIndent(CMmsgInfo, true);
    for (i = 0; i < component->Categories->Num; ++i) NFobjectPrint(component->Categories->List[i]);
    CMmsgIndent(CMmsgInfo, false);
    CMmsgPrint(CMmsgInfo, "Categories End\n");
    CMmsgPrint(CMmsgInfo, "Variables Begin\n");
    CMmsgIndent(CMmsgInfo, true);
    for (i = 0; i < component->Variables->Num; ++i) NFobjectPrint(component->Variables->List[i]);
    CMmsgIndent(CMmsgInfo, false);
    CMmsgPrint(CMmsgInfo, "Variables End\n");
}
示例#2
0
static void _NFmodProcessPrint(NFobject_p object) {
    size_t i;
    NFmodProcess_p module = (NFmodProcess_p) object;

    for (i = 0; i < module->Aliases->Num; ++i) NFobjectPrint(module->Aliases->List[i]);
    CMmsgPrint(CMmsgInfo, "Parameters Begin\n");
    CMmsgIndent(CMmsgInfo, true);
    for (i = 0; i < module->Parameters->Num; ++i) NFobjectPrint(module->Parameters->List[i]);
    CMmsgIndent(CMmsgInfo, false);
    CMmsgPrint(CMmsgInfo, "Parameters End\n");
    CMmsgPrint(CMmsgInfo, "Components Begin\n");
}
示例#3
0
static void _NFmodEquationPrint(NFobject_p object) {
    size_t i;
    NFmodEquation_p module = (NFmodEquation_p) object;

    if (module->Variable != (NFnumVariable_p) NULL) {
        CMmsgPrint(CMmsgInfo, "Equation variable Begin\n");
        CMmsgIndent(CMmsgInfo, true);
        NFobjectPrint((NFobject_p) module->Variable);
        CMmsgIndent(CMmsgInfo, false);
        CMmsgPrint(CMmsgInfo, "Equation variable End\n");
    }
    for (i = 0; i < module->Aliases->Num; ++i) NFobjectPrint(module->Aliases->List[i]);
    for (i = 0; i < module->Parameters->Num; ++i) NFobjectPrint(module->Parameters->List[i]);
}
示例#4
0
static void _NFobjOutputPrint(NFobject_p object) {
    size_t i;
    NFobjOutput_p output = (NFobjOutput_p) object;

    if (output->Path != (char *) NULL) CMmsgPrint(CMmsgInfo, "Path: %s\n", output->Path);
    for (i = 0; i < output->Variables->Num; ++i) NFobjectPrint(output->Variables->List[i]);
}
示例#5
0
static void _NFcompModelPrint(NFobject_p object) {
    size_t i;
    NFcompModel_p model = (NFcompModel_p) object;

    if (model->Version != (char *) NULL) CMmsgPrint(CMmsgInfo, "Version: %s\n", model->Version);
    if (model->Begin != (NFtime_p) NULL)
        CMmsgPrint(CMmsgInfo, "Begin: %04d-%02d-%02d %02d:%02d\n", model->Begin->Year,
                   model->Begin->Month,
                   model->Begin->Day,
                   model->Begin->Hour,
                   model->Begin->Minute);
    if (model->End != (NFtime_p) NULL)
        CMmsgPrint(CMmsgInfo, "End: %04d-%02d-%02d %02d:%02d\n", model->End->Year,
                   model->End->Month,
                   model->End->Day,
                   model->End->Hour,
                   model->End->Minute);
    if (model->TimeStep != (NFtimeStep_p) NULL)
        CMmsgPrint(CMmsgInfo, "TimeStep: %d %s\n", model->TimeStep->Length,
                   NFtimeUnitString(model->TimeStep->Unit));
    CMmsgPrint(CMmsgInfo, "Parameters Begin\n");
    CMmsgIndent(CMmsgInfo, true);
    for (i = 0; i < model->Parameters->Num; ++i) NFobjectPrint(model->Parameters->List[i]);
    CMmsgIndent(CMmsgInfo, false);
    CMmsgPrint(CMmsgInfo, "Parameters End\n");
    CMmsgPrint(CMmsgInfo, "Components Begin\n");

    CMmsgPrint(CMmsgInfo, "Components Begin\n");
    CMmsgIndent(CMmsgInfo, true);
    for (i = 0; i < model->Components->Num; ++i) NFobjectPrint(model->Components->List[i]);
    CMmsgIndent(CMmsgInfo, false);
    CMmsgPrint(CMmsgInfo, "Components End\n");

    CMmsgPrint(CMmsgInfo, "Layout Plugins Begin\n");
    CMmsgIndent(CMmsgInfo, true);
    for (i = 0; i < model->IOPlugins->Num; ++i) NFobjectPrint(model->IOPlugins->List[i]);
    CMmsgIndent(CMmsgInfo, false);
    CMmsgPrint(CMmsgInfo, "Layout Plugins End\n");

    CMmsgPrint(CMmsgInfo, "Module Plugins Begin\n");
    CMmsgIndent(CMmsgInfo, true);
    for (i = 0; i < model->ModPlugins->Num; ++i) NFobjectPrint(model->ModPlugins->List[i]);
    CMmsgIndent(CMmsgInfo, false);
    CMmsgPrint(CMmsgInfo, "Module Plugins End\n");
}
示例#6
0
static void _NFmodInterfacePrint(NFobject_p object) {
    NFmodInterface_p module = (NFmodInterface_p) object;

    if (module->Variable != (NFnumVariable_p) NULL) {
        CMmsgPrint(CMmsgInfo, "Output variable Begin\n");
        CMmsgIndent(CMmsgInfo, true);
        NFobjectPrint((NFobject_p) module->Variable);
        CMmsgIndent(CMmsgInfo, false);
        CMmsgPrint(CMmsgInfo, "Output variable End\n");
    }
    if (module->InputVar != (NFnumVariable_p) NULL) {
        CMmsgPrint(CMmsgInfo, "Input variable Begin\n");
        CMmsgIndent(CMmsgInfo, true);
        NFobjectPrint((NFobject_p) module->InputVar);
        CMmsgIndent(CMmsgInfo, false);
        CMmsgPrint(CMmsgInfo, "Input variable End\n");
    }
}
示例#7
0
static void _NFmodDerivativePrint(NFobject_p object) {
    NFmodDerivative_p module = (NFmodDerivative_p) object;

    if (module->Variable != (NFnumVariable_p) NULL) {
        CMmsgPrint(CMmsgInfo, "Derivative variable Begin\n");
        CMmsgIndent(CMmsgInfo, true);
        NFobjectPrint((NFobject_p) module->Variable);
        CMmsgIndent(CMmsgInfo, false);
        CMmsgPrint(CMmsgInfo, "Derivative variable End\n");
    }
    if (module->InputVar != (NFnumVariable_p) NULL) {
        CMmsgPrint(CMmsgInfo, "Input variable Begin\n");
        CMmsgIndent(CMmsgInfo, true);
        NFobjectPrint((NFobject_p) module->InputVar);
        CMmsgIndent(CMmsgInfo, false);
        CMmsgPrint(CMmsgInfo, "Input variable End\n");
    }

    switch (module->Direction) {
        case NFdirX:
            CMmsgPrint(CMmsgInfo, "Direction: X\n");
            break;
        case NFdirY:
            CMmsgPrint(CMmsgInfo, "Direction: Y\n");
            break;
        case NFdirZ:
            CMmsgPrint(CMmsgInfo, "Direction: Z\n");
            break;
    }
    switch (module->Difference) {
        case NFintervalCenter:
            CMmsgPrint(CMmsgInfo, "Difference: Centered\n");
            break;
        case NFintervalEnd:
            CMmsgPrint(CMmsgInfo, "Difference: Forward\n");
            break;
        case NFintervalBegin:
            CMmsgPrint(CMmsgInfo, "Difference: Backward\n");
            break;
    }
}
示例#8
0
static void _NFcompRegionPrint(NFobject_p object) {
    size_t i;
    NFcompRegion_p component = (NFcompRegion_p) object;

    if (component->TimeStep != (NFtimeStep_p) NULL)
        CMmsgPrint(CMmsgInfo, "TimeStep: %d %s\n", component->TimeStep->Length,
                   NFtimeUnitString(component->TimeStep->Unit));
    CMmsgPrint(CMmsgInfo, "Variables Begin\n");
    CMmsgIndent(CMmsgInfo, true);
    for (i = 0; i < component->Variables->Num; ++i) NFobjectPrint(component->Variables->List[i]);
    CMmsgIndent(CMmsgInfo, false);
    CMmsgPrint(CMmsgInfo, "Variables End\n");
    CMmsgPrint(CMmsgInfo, "Components Begin\n");

    CMmsgPrint(CMmsgInfo, "Aliases Begin\n");
    CMmsgIndent(CMmsgInfo, true);
    for (i = 0; i < component->Aliases->Num; ++i) NFobjectPrint(component->Aliases->List[i]);
    CMmsgIndent(CMmsgInfo, false);
    CMmsgPrint(CMmsgInfo, "Aliases End\n");
    CMmsgPrint(CMmsgInfo, "Components Begin\n");
}
示例#9
0
static void _NFcompContainerPrint(NFobject_p object) {
    size_t i;
    NFcompContainer_p component = (NFcompContainer_p) object;

    if (component->TimeStep != (NFtimeStep_p) NULL) {
        if (component->TimeStep->Length > 1)
            CMmsgPrint(CMmsgInfo, "Time Step: %d %ss\n", component->TimeStep->Length,
                       NFtimeUnitString(component->TimeStep->Unit));
        else
            CMmsgPrint(CMmsgInfo, "Time Step: %d %s\n", component->TimeStep->Length,
                       NFtimeUnitString(component->TimeStep->Unit));
    }
    if (component->States != (char *) NULL) CMmsgPrint(CMmsgInfo, "States: %s\n", component->States);

    CMmsgPrint(CMmsgInfo, "Parameters Begin\n");
    CMmsgIndent(CMmsgInfo, true);
    for (i = 0; i < component->Parameters->Num; ++i) NFobjectPrint(component->Parameters->List[i]);
    CMmsgIndent(CMmsgInfo, false);
    CMmsgPrint(CMmsgInfo, "Parameters End\n");
    CMmsgPrint(CMmsgInfo, "Variables Begin\n");
    CMmsgIndent(CMmsgInfo, true);
    for (i = 0; i < component->Variables->Num; ++i) NFobjectPrint(component->Variables->List[i]);
    CMmsgIndent(CMmsgInfo, false);
    CMmsgPrint(CMmsgInfo, "Variables End\n");
    CMmsgPrint(CMmsgInfo, "Components Begin\n");
    CMmsgIndent(CMmsgInfo, true);
    for (i = 0; i < component->Components->Num; ++i) NFobjectPrint(component->Components->List[i]);
    CMmsgIndent(CMmsgInfo, false);
    CMmsgPrint(CMmsgInfo, "Components End\n");
    CMmsgPrint(CMmsgInfo, "Modules Begin\n");
    CMmsgIndent(CMmsgInfo, true);
    for (i = 0; i < component->Modules->Num; ++i) NFobjectPrint(component->Modules->List[i]);
    CMmsgIndent(CMmsgInfo, false);
    CMmsgPrint(CMmsgInfo, "Modules End\n");
    CMmsgPrint(CMmsgInfo, "Outputs Begin\n");
    CMmsgIndent(CMmsgInfo, true);
    for (i = 0; i < component->Outputs->Num; ++i) NFobjectPrint(component->Outputs->List[i]);
    CMmsgIndent(CMmsgInfo, false);
    CMmsgPrint(CMmsgInfo, "Outputs End\n");
}
示例#10
0
/****************************************************************************************************************
 * Parse configuration
*****************************************************************************************************************/
NFcompModel_p NFmodelParse (FILE *inFile, bool report)
{
	char *doc;

	NFdata_t      data;
	XML_Parser parser;

	data.SkipName   = "root";
	data.Abort      = false;
	data.Buffer     = (char *) NULL;
	data.BufferLen  = 0;
	data.Skip       = false;
	data.Stack      =
	data.StackSize  =
	data.SkipLevel  = 0;
	data.Model      = (NFcompModel_p) NULL;
	data.Objects    = (NFobject_p *)  NULL;

	if ((doc = _NFreadDoc (inFile)) == (char *) NULL) {
		CMmsgPrint (CMmsgAppError, "Document reading error in %s:%d\n",__FILE__,__LINE__);
		return ((NFcompModel_p) NULL);
	}

	if ((parser = XML_ParserCreate(NULL)) == (XML_Parser) NULL) {
		CMmsgPrint (CMmsgSysError, "Memory allocation in %s:%d\n",__FILE__,__LINE__);
		return ((NFcompModel_p) NULL);
	}

	XML_SetUserData             (parser, &data);
	XML_SetElementHandler       (parser, _NFentryStart, _NFentryEnd);
	XML_SetCharacterDataHandler (parser, _NFentryText);
	XML_UseParserAsHandlerArg   (parser);

	if (XML_Parse(parser, doc, strlen (doc), true) == XML_STATUS_ERROR) {
		CMmsgPrint (CMmsgAppError,"Parse error at line %d\n", XML_GetCurrentLineNumber(parser));
		return ((NFcompModel_p) NULL);
	}
	XML_ParserFree (parser);
	if (data.Objects != (NFobject_p *) NULL) free (data.Objects);
	if ((data.Abort) && (data.Model != (NFcompModel_p) NULL)) {
		NFobjectFree ((NFobject_p) data.Model);
		return ((NFcompModel_p) NULL);
	}
	if (report) NFobjectPrint ((NFobject_p) (data.Model));
	return (data.Model);
}
示例#11
0
static void _NFcompInputPrint(NFobject_p object) {
    size_t i;
    NFcompInput_p component = (NFcompInput_p) object;

    if (component->TimeStep != (NFtimeStep_p) NULL) {
        if (component->TimeStep->Length > 1)
            CMmsgPrint(CMmsgInfo, "Time Step: %d %ss\n", component->TimeStep->Length,
                       NFtimeUnitString(component->TimeStep->Unit));
        else
            CMmsgPrint(CMmsgInfo, "Time Step: %d %s\n", component->TimeStep->Length,
                       NFtimeUnitString(component->TimeStep->Unit));
    }
    if (component->URL != (char *) NULL) CMmsgPrint(CMmsgInfo, "URL: %s\n", component->URL);
    CMmsgPrint(CMmsgInfo, "Variables Begin\n");
    CMmsgIndent(CMmsgInfo, true);
    for (i = 0; i < component->Variables->Num; ++i) NFobjectPrint(component->Variables->List[i]);
    CMmsgIndent(CMmsgInfo, false);
    CMmsgPrint(CMmsgInfo, "Variables End\n");

}