Esempio n. 1
0
void DPO_STEPWISEPS::SetLists()
{
   listDataOK = indepVarObjRefUI.CheckDataObj();

    SC_StringArray varList;
    SC_StringArray obsList;
    if (listDataOK)
    {
        const DC_SATable&   indepTableDC =
            static_cast<DO_SATable*>(indepVarObjRefUI.GetDataObj())->GetSATableRef();

        indepTableDC.GetVariableIDs(varList);
        indepTableDC.GetTypeIDs(DC_SATable::saVector, obsList);
    }
    else
    {
        varList.Alloc(1);
        varList += "no variables";
        obsList.Alloc(1);
        obsList += "no obs";
    }

    dropIndexesUI.SetListText(obsList);
    forceIndexesUI.SetListText(varList);
    weightIndexUI.SetListText(varList);
    SetAllSensitive();
}
Esempio n. 2
0
void OptSimRunResults::GetFitIDs(SC_StringArray&  fitIDs) const
{
    fitIDs.ForceMinStringLen(OptFitDescription::fitIDLen);
    fitIDs.Alloc(fitDescriptions.Size());
    for (int i = 0; i < fitDescriptions.Size(); i++)
        fitIDs += fitDescriptions[i].fitID;
};
Esempio n. 3
0
void  DC_ProfileSimResults::GetRunIDs(SC_StringArray&  runIDs) const
{
    runIDs.ForceMinStringLen(ProfileSimRunResults::runIDLen);
    runIDs.Alloc(Size());
    for (int i = 0; i < Size(); i++)
        runIDs += (*this)[i].runID;
};
Esempio n. 4
0
bool CurveFile::GetIDs(SC_StringArray& currIDs) const
{
  currIDs.SetEmpty();
  if (currentCurveData != 0)
    currentCurveData->GetIDs(currIDs);
  return ! currIDs.IsEmpty();
}
Esempio n. 5
0
void ProfileSimRunResults::GetCaseIDs(SC_StringArray&  caseIDs) const
{
    caseIDs.DeAlloc();
    caseIDs.SetStringLen(ProfileSimCaseResults::caseIDLen);
    caseIDs.Alloc(Size());
    for (int i = 0; i < Size(); i++)
        caseIDs += (*this)[i].caseID;
};
Esempio n. 6
0
bool LayerStaticSupport::GetGeoLayerIDs(SC_StringArray& ids)
{
  ids.SetStringLen(IntervalBase::intervalIDLen);
  ids.Alloc(geologyLayers.Size());
  for (int i = 0; i < geologyLayers.Size(); i++)
    ids += geologyLayers[i].intervalID;
  return !ids.IsEmpty();
}
Esempio n. 7
0
bool LayerStaticSupport::GetWellBoreZoneIDs(SC_StringArray& ids)
{
  ids.SetStringLen(IntervalBase::intervalIDLen);
  ids.Alloc(wellBoreZones.Size());
  for (int i = 0; i < wellBoreZones.Size(); i++)
    ids += wellBoreZones[i].intervalID;
  return !ids.IsEmpty();
}
Esempio n. 8
0
void ExposedList::Update()
{
    if (!IsExposed())
        return;

    ExposedObjC::Update();
    if (listData.IsEmpty())
        {
            SC_StringArray temp;
            temp.Alloc(1);
            temp += "<< no data >>";
            scrolledList.SetListText(temp);
            exposedMS.enteredIndexValue = offsetVal;
            currListData.DeAlloc();
        }
    else
        {
            // has list changed ?
            if (!(currListData == listData))
                {
                    // update if different
                    scrolledList.SetListText(listData);
                    currListData = listData;
                }

            if (exposedMS.enteredIndexIsSingle)
                {
                    int currIndx = exposedMS.enteredIndexValue - offsetVal;
                    if (currIndx < 0)
                        currIndx = 0;
                    if (currIndx >= listData.Size())
                        currIndx = listData.Size() - 1;
                    scrolledList.SetSingleSelection(currIndx);
                    scrolledList.SetSelectionVisible();
                    exposedMS.enteredIndexValue = currIndx + offsetVal;
                }
            else
                {
                    SC_IntArray currIndex(exposedMS.enteredIndexArray);
                    int maxIndex = listData.Size();
                    int nOK = 0;
                    int i;
                    for (i = 0; i < currIndex.Size(); i++)
                        if ((currIndex[i] - offsetVal) < maxIndex)
                            {
                                currIndex[nOK++] =  currIndex[i] - offsetVal;
                            }
                    currIndex.SetSize(nOK);
                    scrolledList.SetMultipleSelection(currIndex);

                    for (i = 0; i < nOK; i++)
                        exposedMS.enteredIndexArray[i] = currIndex[i] + offsetVal;
                    exposedMS.enteredIndexArray.SetSize(nOK);
                }
        }
    SetAllSensitive();

}
Esempio n. 9
0
 void ReadStringArray(SC_StringArray& strings)
 {
     strings.DeAlloc();
     int nLines = ReadInt();
     int strLen = ReadInt();
     strings.SetStringLen(strLen);
     strings.AllocAndSetSize(nLines);
     for (int i = 0; i < nLines; i++ ) {
         ReadText(strings[i], strLen);
     }
 }
Esempio n. 10
0
    void WriteStringArray(const SC_StringArray& strings)
    {

        WriteInt(strings.Size());
        WriteInt(strings.GetStringLen());
        WriteLine();
        for (int i = 0; i < strings.Size(); i++ )
            {
                WriteText(strings[i]);
            }
    }
Esempio n. 11
0
bool DataCaptureStaticSupport::GetWellIDs(SC_StringArray& wellIDs)
{
  wellIDs.SetStringLen(40);
  wellIDs.Alloc(dataCaptureData.Size());
  for (int i = 0; i < dataCaptureData.Size(); i++)
  {
    DataCaptureSpecGlob& currSpec = *(dataCaptureData[i]);
    if (currSpec.IsWell() && currSpec.IsPressure())
      wellIDs += currSpec.dataDesig;
  }
  return wellIDs.IsNotEmpty();
}
Esempio n. 12
0
void SimulatedAnnealingOptimizer::GetExtraOutputID(SC_StringArray& extraIDs) const
{
    extraIDs.Alloc(2);
    extraIDs += "Temperature";
    extraIDs += "SimplexSpan";

}
Esempio n. 13
0
void DFO_TableTranspose::SetDesc(SC_StringArray& descStr, 
                                    const char*     desc,
                                    int             nreq)
{
    int ndesc = descStr.Size();
    if (ndesc < nreq)
    {
        for (int i = ndesc; i < nreq; i++)
        {
            char tempStr[80];
            CopyString(tempStr, desc, 80);
            ConcatInt(i, tempStr, 3, 80);
            descStr.SetString(tempStr, i);
        }
        descStr.SetSize(nreq);
    }
}
Esempio n. 14
0
void DC_ProfileSimResults::GetCaseIDs(SC_StringArray&  caseIDs) const
{
    static const int maxStrLen = ProfileSimRunResults::runIDLen + 1 + ProfileSimCaseResults::caseIDLen;
    caseIDs.ForceMinStringLen(maxStrLen);
    caseIDs.Alloc(GetnCases());
    char tempStr[maxStrLen];

    for (int i = 0; i < Size(); i++)
    {
        ProfileSimRunResults& currRun = (*this)[i];
        for (int j = 0; j < currRun.Size(); j++)
        {
            CopyString(tempStr, currRun.runID, maxStrLen);
            ConcatString(tempStr, "\t", maxStrLen);
            ConcatString(tempStr, currRun[j].caseID, maxStrLen);
            caseIDs += tempStr;
        }
    }
}
Esempio n. 15
0
void DPO_SelectOptPS::SetIndexList()
{
    SC_StringArray dataIDs;
    if (optSimResultsObjRefUI.CheckDataObj())
    {
        dataDC = static_cast<DO_OptSimResults*>(optSimResultsObjRefUI.GetDataObj())->optResults;
        dataDC->GetMenuStrings(dataIDs, showFitComponents, showOKonly);
    }

    listDataOK = !dataIDs.IsEmpty();
    if (listDataOK)
    {
        indexMSUI.indexListUI.SetListText(dataIDs);
    }
    else
    {
        indexMSUI.indexListUI.SetListNA();
    }
    SetAllSensitive();
}
Esempio n. 16
0
void DPO_SelectLabelArrayPS::SetIndexList()
{
    SC_StringArray dataIDs;
    if (labDataArrayObjRefUI.CheckDataObj())
    {
        dataIDs = static_cast<DO_LabelArray*>(labDataArrayObjRefUI.GetDataObj())->dataLabels;
    }

    listDataOK = !dataIDs.IsEmpty();
    if (listDataOK)
    {
        indexMSUI.indexListUI.SetListText(dataIDs);
    }
    else
    {
        indexMSUI.indexListUI.SetListNA();
    }
    SetAllSensitive();

}
Esempio n. 17
0
BOOL CAutoFitDlg::OnInitDialog()
{
    AutoFitCheckOK();

    m_uprocessTestZonePressureData.Set(this, IDC_AUTO_MAINPRESSURE, processTestZonePressureData);
    m_uprocessTestZonePressureData.AddCallback(this);

    m_uprocessTestZoneFlowData.Set(this, IDC_AUTO_MAINFLOW, processTestZoneFlowData);
    m_uprocessTestZoneFlowData.AddCallback(this);

    m_uprocessObsWellPressureData.Set(this, IDC_AUTO_OBSPRESSURE, processObsWellPressureData);
    m_uprocessObsWellPressureData.AddCallback(this);

    SC_StringArray dummy;
    obsOK = DataCaptureStaticSupport::GetWellIDs(dummy) && (dummy.Size() > 1);

    int idStart = IDC_CHECK1;

    m_ucartesianSpec.Set(this, idStart);
    m_ucartesianSpec.m_udoExtract.AddCallback(this);

    m_uflowSpec.Set(this, idStart);
    m_uflowSpec.m_udoExtract.AddCallback(this);

    m_uhistSpec.Set(this, idStart);
    m_uhistSpec.m_udoExtract.AddCallback(this);

    m_upulseSpec.Set(this, idStart);
    m_upulseSpec.m_udoExtract.AddCallback(this);

    m_uslugSpec.Set(this, idStart);
    m_uslugSpec.m_udoExtract.AddCallback(this);

    CDialog::OnInitDialog();

    CheckRestrictions();

    return TRUE;
}
Esempio n. 18
0
void ExtendedProfile::GetTimeSteps(SC_StringArray& tsVals) const
{
    tsVals.Alloc(Size());

    SC_RealFormat rForm;
    for (int i = 0; i < Size(); i++)
    {
        char tempStr[40];
        rForm.RealToString((*this)[i].profileTime, tempStr, 40);
        tsVals += tempStr;
    }

}
Esempio n. 19
0
void DPO_SelectCurvePS::SetIndexList()
{
    SC_StringArray dataIDs;
    if (curveArrayObjRefUI.CheckDataObj())
    {
        DO_CurveArray* dataDO = static_cast<DO_CurveArray*>(curveArrayObjRefUI.GetDataObj());
        dataDO->curveArray->GetIDs(dataIDs);
    }

    listDataOK = !dataIDs.IsEmpty();
    if (listDataOK)
    {
        indexMSUI.indexListUI.SetListText(dataIDs);
    }
    else
    {
        indexMSUI.indexListUI.SetListNA();
    }

    SetAllSensitive();

}
Esempio n. 20
0
void DlgVaryPriority::ResetAllControls()
{
    vary.SetForFlags();

    SC_StringArray newVaryPars;
    newVaryPars.SetStringLen(60);
    newVaryPars.Alloc(orderedVary.Size());
    for (int i = 0; i < orderedVary.Size(); i++)
        newVaryPars += orderedVary[i]->GetLongID();

    for (int j = 0; j < 3; j++)
    {
        m_varyPriority[j].ClearEntries();
        if (j < orderedVary.Size())
            m_varyPriority[j].AddBasicEntry(newVaryPars);
        m_varyPriority[j].ResetStrings();
        varyPriority[j] = j;
        m_varyPriority[j].ResetSelection();
    }

    CheckRestrictions();
}
Esempio n. 21
0
    static void MPIMasterRun(const char* MPIappID, int maxMPIRank)
    {
        // all msgs for master ...
        NodeFile::mpiDebugRun = true;

        SC_StringArray machineNames;
        machineNames.SetStringLen(maxNameLen);
        machineNames.Alloc(maxMPIRank);
        machineNames.SetString(processorName, 0);

        // get slave processor name
        MPI_Status status;
        for (int i = 1; i < maxMPIRank; i++)
            {
                CheckMPI(MPI_Recv(processorName, maxNameLen, MPI_CHAR, i, mpiTag_ProcName, MPI_COMM_WORLD, &status), "Master get slave names");

                int currRank = status.MPI_SOURCE;
                if (currRank != i)
                    GenAppInternalError("Unexpected slave rank on slave processor name");

                machineNames.SetString(processorName, i);
            }

        time_t stTime;
        bool stTimeOK = false;
        char timeLab[80];
        const char* timeFormat = "%x %X";
        if (time(&stTime) != -1)
            {
#ifdef MSCVS2005
                tm tmOut;
                localtime_s(&tmOut, &stTime);
                strftime(timeLab, 80, timeFormat, &tmOut);
#else
                strftime(timeLab, 80, timeFormat, localtime(&stTime));
#endif
                GenAppInfoMsg("Master start time", timeLab);
                stTimeOK = true;
            }

        bool isOptRun = MPIOptimizationRun();
        int nRuns;
        if (isOptRun)
            {
                GenAppInfoMsg("MPI Run","Optimization only");
            }
        else
            {
                nRuns = MPIGetNCases();
                char nrunstr[10];
                IntToString(nRuns, nrunstr, 10);
                GenAppInfoMsg("Number of runs", nrunstr);
            }
        int nSlaves = maxMPIRank - 1;
        if (nRuns < nSlaves)
            nSlaves = nRuns;

        MPIMasterInit(nSlaves);

        if (isOptRun)
            {
                MPIRunOptimizationMaster(nSlaves);
            }
        else
            {

                MPIMasterSampling(nSlaves, maxMPIRank);

            }

        GenAppInfoMsg(MPIappID, "master run complete");

        MPIMasterCleanup(nSlaves);

        if (!isOptRun)
            {
                using namespace std;
                cout << endl << "Slave Summary" << endl;
                SC_IntArray processorCount(maxMPIRank, 0);
                for (int i = 0; i < nSlaves; i++)
                    {
                        cout << "Slave " << i + 1 << " processed " << indexCount[i] << " runs" << endl;
                        processorCount[machineNames.SearchForKey(machineNames[i + 1])] += indexCount[i];
                    }

                cout << endl << "Machine Summary" << endl;
                for (int i = 0; i < maxMPIRank; i++)
                    if (processorCount[i] > 0)
                        cout << "Machine " << machineNames[i] << " processed " << processorCount[i] << " runs" << endl;
                cout << endl;
            }

        GenAppInfoMsg(MPIappID, "all cases completed OK");

        time_t endTime;
        if (stTimeOK && (time(&endTime) != -1))
            {
                // write start time again
                GenAppInfoMsg("Master start time", timeLab);

                // and end time
#ifdef MSCVS2005
                tm tmOut;
                localtime_s(&tmOut, &endTime);
                strftime(timeLab, 80, timeFormat, &tmOut);
#else
                strftime(timeLab, 80, timeFormat, localtime(&endTime));
#endif
                GenAppInfoMsg("Master end time", timeLab);

                double deltaMin = difftime(endTime, stTime); // / 60.0;
                SC_DecFormat minConv(2);
                minConv.RealToString(deltaMin, timeLab, 80);

                GenAppInfoMsg("Elapsed seconds", timeLab);
            }
    }
Esempio n. 22
0
// for use in menus
void DC_OptSimResults::GetMenuStrings(SC_StringArray&  ids,
                                      bool             includeFitComponents,
                                      bool             includeOKonly) const
{

    static const int maxStrLen = OptSimRunResults::runIDLen + 2 +
                                 CaseVarDescription::caseVarDescLen + 2 +
                                 OptFitDescription::fitIDLen  + 2 +
                                 OptFitComponentDescription::fitIDLen;

    ids.ForceMinStringLen(maxStrLen);
    if (includeFitComponents)
    {
        ids.Alloc(GetnFitComponents());
    }
    else
    {
        ids.Alloc(GetnFits());
    }

    char runStr[maxStrLen];
    char caseStr[maxStrLen];
    char fitStr[maxStrLen];
    char fitCompStr[maxStrLen];
    char okStr[maxStrLen];

    for (int i = 0; i < Size(); i++)
    {
        OptCaseResultsArray& currCases = (*this)[i].runResults;

        CopyString(runStr, (*this)[i].runID, maxStrLen);

        for (int j = 0; j < currCases.Size(); j++)
        {
            CopyString(caseStr, currCases[j].caseDesc, maxStrLen);

            int nfit = currCases[j].caseResults.Size();

            OptSingleFitArray&   currFits = currCases[j].caseResults;

            for (int k = 0; k < currFits.Size(); k++)
            {
                if (includeOKonly && (!currFits[k].fitCompletedOK))
                    continue;

                if (currFits[k].fitCompletedOK)
                {
                    CopyString(okStr, " \t OK", maxStrLen);
                }
                else
                {
                    CopyString(okStr, " \t Bad", maxStrLen);
                }

                CopyString(fitStr, runStr, maxStrLen);
                ConcatString(fitStr, "\t", maxStrLen);
                ConcatString(fitStr, caseStr, maxStrLen);
                ConcatString(fitStr, "\t", maxStrLen);
                ConcatString(fitStr, (*this)[i].fitDescriptions[k].fitID, maxStrLen);
                if (!includeOKonly)
                    ConcatString(fitStr, okStr, maxStrLen);

                if (includeFitComponents)
                {
                    OptFitComponentArray&   currFitComp = currFits[k].fitComponents;

                    for (int l = 0; l < currFitComp.Size(); l++)
                    {
                        CopyString(fitCompStr, fitStr, maxStrLen);
                        ConcatString(fitCompStr, "\t", maxStrLen);
                        ConcatString(fitCompStr, (*this)[i].fitDescriptions[k].fitComponentDescription[l].fitID, maxStrLen);
                        ids += fitCompStr;
                    }
                }
                else
                {
                    ids += fitStr;
                }
            }
        }
    }
}