예제 #1
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();
}
예제 #2
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();
}
예제 #3
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;
};
예제 #4
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);
     }
 }
예제 #5
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();
}
예제 #6
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();
}
예제 #7
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);
            }
    }