本文整理汇总了C++中ArrayT::Allocate方法的典型用法代码示例。如果您正苦于以下问题:C++ ArrayT::Allocate方法的具体用法?C++ ArrayT::Allocate怎么用?C++ ArrayT::Allocate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArrayT
的用法示例。
在下文中一共展示了ArrayT::Allocate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AssembleQA
void ExodusOutputT::AssembleQA (ArrayT<StringT>& qa) const
{
time_t now;
time(&now);
char date[40], time[20];
strftime(date, 40, "%x", localtime(&now));
strftime(time, 20, "%X", localtime(&now));
qa.Allocate (4);
qa[0] = fCodeName;
qa[1] = fVersion;
qa[2] = date;
qa[3] = time;
}
示例2: OpenGeometryFile
void ParaDynOutputT::OpenGeometryFile (ParaDynT& par, ofstream& geo) const
{
StringT label = "atoms";
StringT geofile;
geofile = CreateFileName (label);
geo.open (geofile);
// header
int h = 0;
ArrayT<StringT> header;
header.Allocate (1);
header[h] = " ITEM: NUMBER OF ATOMS";
par.WriteHeader (geo, header);
}
示例3: RemoveRepeats
// maybe someday this will be added to iArrayT ?
void NodeManagerPrimitive::RemoveRepeats (ArrayT<int>& n) const
{
iArrayT nodes;
nodes.Swap (n);
nodes.SortAscending();
// determine number of nodes
int count = 1;
for (int m=1; m < nodes.Length(); m++)
if (nodes[m] != nodes[m-1]) count++;
// collect nodes, only once
n.Allocate (count);
int *pnew = n.Pointer();
int *pold = nodes.Pointer();
*pnew++ = *pold++;
for (int ni=1; ni < nodes.Length(); ni++, *pold++)
if (*pold != nodes[ni-1])
*pnew++ = *pold;
}