本文整理汇总了C++中SC_StringArray::Alloc方法的典型用法代码示例。如果您正苦于以下问题:C++ SC_StringArray::Alloc方法的具体用法?C++ SC_StringArray::Alloc怎么用?C++ SC_StringArray::Alloc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SC_StringArray
的用法示例。
在下文中一共展示了SC_StringArray::Alloc方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetLists
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: GetRunIDs
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: GetFitIDs
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: GetExtraOutputID
void SimulatedAnnealingOptimizer::GetExtraOutputID(SC_StringArray& extraIDs) const
{
extraIDs.Alloc(2);
extraIDs += "Temperature";
extraIDs += "SimplexSpan";
}
示例5: GetWellBoreZoneIDs
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: GetGeoLayerIDs
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: GetCaseIDs
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: Update
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: GetWellIDs
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: GetTimeSteps
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: ResetAllControls
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();
}
示例12: GetMenuStrings
// 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;
}
}
}
}
}
示例13: MPIMasterRun
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);
//.........这里部分代码省略.........