コード例 #1
0
ファイル: DPO_STEPWISEPS.cpp プロジェクト: jjayne/nSIGHTS
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();
}
コード例 #2
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;
};
コード例 #3
0
ファイル: DC_OptSimResults.cpp プロジェクト: jjayne/nSIGHTS
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;
};
コード例 #4
0
ファイル: OptSimAnneal.cpp プロジェクト: jjayne/nSIGHTS
void SimulatedAnnealingOptimizer::GetExtraOutputID(SC_StringArray& extraIDs) const
{
    extraIDs.Alloc(2);
    extraIDs += "Temperature";
    extraIDs += "SimplexSpan";

}
コード例 #5
0
ファイル: G_Layer.cpp プロジェクト: nsights/nSIGHTS
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();
}
コード例 #6
0
ファイル: G_Layer.cpp プロジェクト: nsights/nSIGHTS
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();
}
コード例 #7
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;
};
コード例 #8
0
ファイル: ExposedList.cpp プロジェクト: jjayne/nSIGHTS
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();

}
コード例 #9
0
ファイル: G_DataCapture.cpp プロジェクト: nsights/nSIGHTS
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();
}
コード例 #10
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;
    }

}
コード例 #11
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;
        }
    }
}
コード例 #12
0
ファイル: DlgVaryPriority.cpp プロジェクト: jjayne/nSIGHTS
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();
}
コード例 #13
0
ファイル: DC_OptSimResults.cpp プロジェクト: jjayne/nSIGHTS
// 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;
                }
            }
        }
    }
}
コード例 #14
0
ファイル: MPIAppSupport.cpp プロジェクト: jjayne/nSIGHTS
    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);
            }
    }