void DFO_XYArrayToTable:: CalcOutput(FOcalcType calcType) { DoStatusChk(); if (!StatusOK()) return; outputTableDC.SetID("XYDataArray"); const DC_XYDataArray& inputXYArray = *static_cast<DO_XYDataArray*>(GetInPortData(inputXYArrayObjRef))->xyDataArray; int ncols = inputXYArray.Size(); int nrows = inputXYArray[0].Size(); const SC_DoubleArray* inputX; if (!interpolateToCommonX) { for (int i = 1; i < ncols; i++) if (inputXYArray[i].Size() != nrows) { SetObjErrMsg("All XY arrays must have the same # of rows"); return; } inputX = &inputXYArray[0].xData; } else { inputX = &static_cast<DO_XYData*>(GetInPortData(interpolateToCommonXObjRef))->GetXY().xData; nrows = inputX->Size(); } outputTableDC.Alloc(ncols + 1, nrows); outputTableDC.columnDesc += "X"; outputTableDC.dataTable += *inputX; SC_DoubleArray outputY; for (int i = 0; i < ncols; i++) { if (interpolateToCommonX) { DC_Curve curveDC; SC_SetupErr curvErr; if (!curveDC.CreateCurve(inputXYArray[i], curvErr)) { SetObjErrMsg("Error creating curve"); return; } curveDC.GetCurveY(*inputX, outputY); outputTableDC.dataTable += outputY; } else { outputTableDC.dataTable += inputXYArray[i].yData; } outputTableDC.columnDesc += inputXYArray[i].GetID(); } outputTableDC.SetRowDesc("X"); }
void DFO_RealToVariableArray:: DoStatusChk() { outputVarDO.Reset("Combined reals"); // base class check FuncObjC::DoStatusChk(); // check input objects nrealSel = 0; for (int i = 0; i < maxRealSel; i++) if (realSelData[i].doReal) { if (IsNull(realSelData[i].realID)) SetObjErrMsg("variable ID not set for real"); if (!CheckInputFO(realSelData[i].realObjRef, "Real")) return; DO_Real* tmpDO = static_cast<DO_Real*>(GetInPortData(realSelData[i].realObjRef)); realSelData[i].realDataDO = tmpDO; nrealSel++; } if (nrealSel == 0) { SetObjErrMsg("no reals selected"); return; } }
void DFO_CalcConfidenceGrid:: DoStatusChk() { FuncObjC::DoStatusChk(); if (!CheckInputFO(inputGridResultsObjRef, "test grid input source")) return; inputGridResultsDC = static_cast<DO_GridData*>(GetInPortData(inputGridResultsObjRef))->gridData; if (inputGridResultsDC->IsEmpty()) { SetObjErrMsg("no output ???"); return; } if (!autoBestCase) { if ((bestCaseXIndex < 0) || (bestCaseXIndex >= inputGridResultsDC->xData.Size())) { SetObjErrMsg("best fit case X index out of range"); return; } if ((bestCaseYIndex < 0) || (bestCaseYIndex >= inputGridResultsDC->yData.Size())) { SetObjErrMsg("best fit case Y index out of range"); return; } } }
void DFO_TableTranspose:: DoStatusChk() { FuncObjC::DoStatusChk(); if (CheckInputFO(inputTableObjRef, "table input data source")) { inputTableDC = static_cast<DO_TableData*>(GetInPortData(inputTableObjRef))->tableData; ninputRows = inputTableDC->GetNRows(); ninputCols = inputTableDC->GetNCols(); if ((ninputCols < 1) || (ninputRows < 1)) SetObjErrMsg("No input table columns or rows"); if ((ninputRows < 2) && (ninputCols < 2)) SetObjErrMsg("table must have more than 1 entry"); if (skipXColumn) { if (xcolumnIndex >= ninputCols) SetObjErrMsg("X column index out of range"); if (ninputCols == 1) SetObjErrMsg("no data after X column is removed"); } } }
void DFO_SingleFit::DoAllocCheck() { if (CheckInputFO(fieldDataObjRef, "field data source")) { inputXY = static_cast<DO_XYData*>(GetInPortData(fieldDataObjRef))->xyData; if (limitInput) { fieldDataDC = &limitedXY; } else { fieldDataDC = inputXY; } // allocation is OK as long as input is set fitResultsDC.nfitAlloc = inputXY->Size(); //fitResultsDC.okToAlloc = (fitResultsDC.nfitAlloc > 2); fitResultsDC.okToAlloc = (fitResultsDC.nfitAlloc > 0); } /* else { if (fieldDataObjRef.objRef != 0) { char debugMsg[120]; MakeString(debugMsg, "DfO_SingleFit ****", fieldDataObjRef.objRef->GetID(), "::", fieldDataObjRef.objRef->GetStatusMsg(), 120); SetObjErrMsg(debugMsg); } } */ }
void DFO_Derivative:: DoStatusChk() { // set flags for data to use *useDerivativeCheckRef = isMaster && derivativeDC.useSuperTime; *windowPctSpanCheckRef = isMaster && ((derivativeDC.derivativeCalcType == dctLogPctWindow) || (derivativeDC.derivativeCalcType == dctLinPctWindow)); *windowValSpanCheckRef = isMaster && ((derivativeDC.derivativeCalcType == dctLogValWindow) || (derivativeDC.derivativeCalcType == dctLinValWindow)); FuncObjC::DoStatusChk(); outputTPDC.SetID("derivative"); if (CheckInputFO(inputTPObjRef, "Input P(t)")) tpDataDC = static_cast<DO_XYData*>(GetInPortData(inputTPObjRef))->xyData; derivativeDO.timeProcess = 0; if ((!isMaster) && (CheckInputFO(masterObjRef, "Master spec"))) { DO_Derivative* inputDO = static_cast<DO_Derivative*>(GetInPortData(masterObjRef)); derivativeDC = *(inputDO->derivative); windowPctSpanMS.enteredRealValue = derivativeDC.windowPctSpan; windowValSpanMS.enteredRealValue = derivativeDC.windowValSpan; derivativeDO.timeProcess = inputDO->timeProcess; } if (isMaster) { // get data if (derivativeDC.useSuperTime && CheckInputFO(timeProcessObjRef, "Input time process")) derivativeDO.timeProcess = static_cast<DO_TimeProcess*>(GetInPortData(timeProcessObjRef))->timeProcess; if (*windowPctSpanCheckRef) { windowPctSpanMS.DoCheck("Window % lin/log span", *this); derivativeDC.windowPctSpan = windowPctSpanMS.GetLimitedValue(1.0, 85.0); } if (*windowValSpanCheckRef) { windowValSpanMS.DoCheck("Window val lin/log span", *this); derivativeDC.windowValSpan = windowValSpanMS.GetLimitedValue(0.001, 1000.0); } } }
void PlotObjBaseC::DoStatusChk() { objPenSet = 0; // pen set FuncObjC::DoStatusChk(); // kluge for pasting penSetObjRef.objRef = assocPlot; // if (CheckInputFO(penSetObjRef, "Pen set ??")) // this should always be true objPenSet = static_cast<DO_PenSet*>(GetInPortData(penSetObjRef))->penSetData; }
void UFO_WriteXY:: CalcOutput(FOcalcType calcType) { DoStatusChk(); if (StatusOK() && (calcType == foc_Apply)) { IO_XYData outFile; const DC_XYData& outXY = *(static_cast<DO_XYData*>(GetInPortData(xyObjRef)))->xyData; outFile.WriteXYFile(outFname, writeColHeaders, outXY); } }
void DFO_ExtractSequenceInterval:: DoStatusChk() { *endCheckRef = setStartAndEnd; FuncObjC::DoStatusChk(); startSeqMS.SetTypeLabel("Start sequence"); endSeqMS.SetTypeLabel("End sequence"); xyOutputData.SetID("sequence"); // check input objects CheckInputFO(xyInputDataObjRef, "XY data source"); CheckInputFO(seqTimesObjRef, "Sequence time data source"); startSeqMS.DoCheck("Start sequence", *this); if (setStartAndEnd) endSeqMS.DoCheck("End sequence", *this); if (StatusNotOK()) return; xyInputDataDC = static_cast<DO_XYData*>(GetInPortData(xyInputDataObjRef))->xyData; sequenceTimesDC = static_cast<DO_SequenceTimes*>(GetInPortData(seqTimesObjRef))->seqTimes; startSeq = startSeqMS.GetCurrentIndex(); if (setStartAndEnd) { endSeq = endSeqMS.GetCurrentIndex(); if (endSeq < startSeq) { int tmp = startSeq; startSeq = endSeq; endSeq = tmp; } } else endSeq = startSeq; int maxSeq = sequenceTimesDC->Size(); if ((startSeq < 0) || (endSeq >= sequenceTimesDC->Size())) SetObjErrMsg("Sequence out of range"); }
void PFO_2DTableHistogram:: DoStatusChk() { objTableData = 0; // base class check PlotObjC::DoStatusChk(); // check input objects if (!CheckInputFO(tableDataObjRef, "Table Data")) return; objTableData = ((DO_TableData*) GetInPortData(tableDataObjRef))->tableData; // check parameters int maxCol = objTableData->GetNCols(); if (xDataIndx >= maxCol) SetObjErrMsg("X index out of range for current table"); int nSeries = 0; for ( int i = 0; i < maxTableHistogram; i++) if (seriesData[i].doHistogram && (seriesData[i].tableColIndx < maxCol)) nSeries++; if (nSeries == 0) SetObjErrMsg("no series set to plot"); // set up output seriesLegendData.Clear(); if (nSeries > 0) { seriesLegendData.Alloc(nSeries); // for (int i = 0; i < maxTableHistogram; i++) // if (seriesData[i].doHistogram && (seriesData[i].tableColIndx < maxCol)) // seriesLegendData.AddSeries(seriesData[i].GetLabel( // objTableData->columnDesc[seriesData[i].tableColIndx]), // seriesData[i]); } if (cursorReport != 0) recalcOnViewChange = cursorReport->showReport; /* startRow = 0; if (!plotAllRows) { if (lastNRows <1 ) SetObjErrMsg("at least one row must be plotted"); startRow = objTableData->dataTable[xDataIndx].Size() - lastNRows; if (startRow < 0) startRow = 0; } */ }
void DFO_BlendColorMap:: DoStatusChk() { blendColorMap.ncolorMap = 0; FuncObjC::DoStatusChk(); tValMS.Reset("Blend T value"); tValMS.DoCheck("Blend T value master", *this); // get data if ((! CheckInputFO(input1ObjRef, "Color map A")) || (! CheckInputFO(input2ObjRef, "Color map B"))) return; colorMap1 = static_cast<DO_ColorMap*>(GetInPortData(input1ObjRef))->colorMapData; colorMap2 = static_cast<DO_ColorMap*>(GetInPortData(input2ObjRef))->colorMapData; if (colorMap1->ncolorMap != colorMap2->ncolorMap) { SetObjErrMsg("Both input color maps must be the same size"); return; } blendColorMap.AddColorMaps(*colorMap1, *colorMap2); }
void UncertInput::CalcOutput(FOcalcType calcType) { DoStatusChk(); if (StatusOK()) { calcWasPerformed = true; //lastMetricVal = static_cast<DO_Real*>(GetInPortData(inputMetrics[currSelectedMetric].metricObject))->realVal; lastMetricVal.SetEmpty(); for (int i = 0; i < maxMetricSel; i++) { if (inputMetrics[i].uncertOnMetric) lastMetricVal += static_cast<DO_Real*>(GetInPortData(inputMetrics[i].metricObject))->realVal; } } }
void DFO_SelectVariable:: DoStatusChk() { DFO_SelectBase::DoStatusChk(); indexMS.SetTypeLabel("Selected Variable"); if (!CheckInputFO(varDataArrayObjRef, "Data source")) return; varDataDO = static_cast<DO_VariableArray*>(GetInPortData(varDataArrayObjRef)); if (IndexRangeOK(varDataDO->variableArrayData->Size())) { indexMS.indexDO.SetValueLabel((*varDataDO->variableArrayData)[indexMS.GetCurrentIndex()].varID); } }
void PlotDefC:: DoStatusChk() { FuncObjC::DoStatusChk(); if (plotPenSetObjRef.objRef == 0) plotPenSetObjRef.SetDefault(typeid(DO_PenSet)); if (CheckInputFO(plotPenSetObjRef, "Pen set")) { defaultPenSetDO = *((DO_PenSet*) GetInPortData(plotPenSetObjRef)); defaultPenSet = defaultPenSetDO.penSetData; } else { defaultPenSet = 0; defaultPenSetDO = DO_PenSet(); } }
void CaptureOutputFO::DoStatusChk() { xyDataDO.xyData = 0; FuncObjC::DoStatusChk(); if (!CheckInputFO(xyArrayObjRef, "Input array")) return; DO_XYDataArray* dataDO = static_cast<DO_XYDataArray*>(GetInPortData(xyArrayObjRef)); if (dataDO->xyDataArray->IsEmpty()) { SetObjErrMsg("no entries in input array ??"); return; } if (dcIndex > dataDO->xyDataArray->UpperBound()) dcIndex = 0; xyDataDO.xyData = &(*dataDO->xyDataArray)[dcIndex]; }
void PFO_GridContour::DoStatusChk() { contourLines.DeAlloc(); PSC_3DGridData::StatusChkSetup(*this); PlotObjC::DoStatusChk(); PSC_ContourSpec::DoStatusChk(*this); CheckInputFO(dataObjRef, "Grid Data"); if (StatusNotOK()) return; gridData = static_cast<DO_GridData*> (GetInPortData(dataObjRef))->gridData; PSC_3DGridData::DoStatusChk(*this, *gridData); // check and set triang SC_Triangulation& currTri = gridData->GetTriangulation(); if (!currTri.TriangulationOK()) SetObjErrMsg("cannot triangulate ??"); }
void DFO_CreateXYArray:: DoStatusChk() { // check input objects nSelected = 0; for (int i = 0; i < maxXYDataDesc; i++) if (xyData[i].doXY) { // we still build the array even if the input is not OK if (CheckInputFO(xyData[i].xyObjRef, "XY")) xyData[i].xyDataDC = static_cast<DO_XYData*>(GetInPortData(xyData[i].xyObjRef))->xyData; else xyData[i].xyDataDC = 0; nSelected++; } // slight kluge -- reset status to clear any errors from XY check // base class check FuncObjC::DoStatusChk(); // only error ... if (nSelected == 0) SetObjErrMsg("no XY selected"); }
void PFO_CovarLimMatrix:: DoStatusChk() { // base class check PFO_ColorBase::DoStatusChk(); if (!CheckInputFO(inputDataObjRef, "Covariance Data")) return; DO_CovarArray* objData = static_cast<DO_CovarArray*>(GetInPortData(inputDataObjRef)); covarArrayDC = objData->covarArrayData; covarHeaderDC = objData->covarHeader; maxCovar = covarArrayDC->Size(); if (plotWithColorMap) { if (!ColorAttributeIsDiag()) { colorData.AllocAndSetSize(maxCovar); for (int i = 0; i < maxCovar; i++) { if (colorAttribute == caIndx) colorData[i] = double(i); else if (colorAttribute == caSSE) colorData[i] = (*covarArrayDC)[i].sumSquaredError; } if (limitIsMaster && autoLimits) rangeLimit.InitLimit(colorData); CheckRangeLimits(); } if (colorAttribute == caIndx) colorLimitDO.SetValueLabel("Index"); else if (colorAttribute == caSSE) colorLimitDO.SetValueLabel("SSE"); else if (colorAttribute == caMainDiag) colorLimitDO.SetValueLabel("Main Diagonal Length"); else if (colorAttribute == caOffDiag) colorLimitDO.SetValueLabel("Off Diagonal Length"); } bestEstSymbol.symbolPen = covarPen; int num = 1; if (plotEllipse && plotBestEst) num = 2; seriesLegendData.Alloc(num); if (plotEllipse || plotBestEst) { PSC_SeriesSpec temp; temp.seriesPen = covarPen; //ellipse line legend if (plotEllipse) { temp.seriesPlotType = psl_LineOnly; temp.lineThickness = covarLineThk; static const char* defStr[] = {"99.0% confidence limits", "95.4% confidence limits", "90.0% confidence limits", "68.3% confidence limits"}; seriesLegendData.AddSeries(legendOverride.GetLabel(defStr[int(cLimits)]), temp); } if (plotBestEst) { //best estimate legend temp.seriesPlotType = psl_SymbolOnly; temp.symbolType = bestEstSymbol.symbolType; temp.symbolSize = bestEstSymbol.symbolSize; static const char* symStr = "best estimate"; seriesLegendData.AddSeries(legendOverride.GetLabel(symStr), temp); } } else seriesLegendData.Clear(); }
void PFO_Scatterplot:: DoStatusChk() { // base class check PlotObjC::DoStatusChk(); // check input objects if (!CheckInputFO(scatterDataObjRef, "Scatterplot data")) return; const DO_SAPlotTable* scatterDO = static_cast<DO_SAPlotTable*>(GetInPortData(scatterDataObjRef)); nplotDV = scatterDO->nDV; nplotIV = scatterDO->nIV; if ((nplotDV == 0) || (nplotIV == 0)) SetObjErrMsg("not a scatter data table (maybe grid lines?)"); else if (plotDVIndx >= nplotDV) SetObjErrMsg("DV to plot out of range"); else if (plotIVIndx >= nplotIV) SetObjErrMsg("IV to plot out of range"); if (StatusNotOK()) return; scatterDataDC = scatterDO->tableData; dvLabel = scatterDataDC->columnDesc[plotDVIndx + nplotIV]; ivLabel = scatterDataDC->columnDesc[plotIVIndx]; if (plotXGridLines) { if (!CheckInputFO(xgridLineObjRef, "X grid lines")) return; const DO_SAPlotTable* xgridDO = static_cast<DO_SAPlotTable*>(GetInPortData(xgridLineObjRef)); if (nplotIV != xgridDO->nIV) SetObjErrMsg("X grid line incompatible with scatter data"); xGridLinesDC = xgridDO->tableData; } else xGridLinesDC = 0; if (plotYGridLines) { if (!CheckInputFO(ygridLineObjRef, "Y grid lines")) return; const DO_SAPlotTable* ygridDO = static_cast<DO_SAPlotTable*>(GetInPortData(ygridLineObjRef)); if ((nplotDV != ygridDO->nDV)) SetObjErrMsg("Y grid line incompatible with scatter data"); yGridLinesDC = ygridDO->tableData; } else yGridLinesDC = 0; seriesLegendData.Clear(); if (StatusNotOK()) return; char legTitle[80]; MakeString(legTitle, dvLabel, "/", ivLabel, 80); seriesLegendData.AddSeries(legTitle, scatterSpec); }