本文整理汇总了C++中HashTable::found方法的典型用法代码示例。如果您正苦于以下问题:C++ HashTable::found方法的具体用法?C++ HashTable::found怎么用?C++ HashTable::found使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HashTable
的用法示例。
在下文中一共展示了HashTable::found方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getFieldViewName
static word getFieldViewName(const word& foamName)
{
if (FieldviewNames.found(foamName))
{
return FieldviewNames[foamName];
}
else
{
return foamName;
}
}
示例2:
Foam::label Foam::HashTable<T, Key, Hash>::erase
(
const HashTable<AnyType, Key, AnyHash>& rhs
)
{
label count = 0;
// Remove rhs keys from this table - terminates early if possible
// Could optimize depending on which hash is smaller ...
for (iterator iter = begin(); iter != end(); ++iter)
{
if (rhs.found(iter.key()) && erase(iter))
{
count++;
}
}
return count;
}
示例3: snapNearestPointsToSurface
/* For each column of fixed x value, find the point whose z value is closest to h.
Update those points to have a z value of h.
*/
void snapNearestPointsToSurface(
IOField<point>& newPoints,
const Mountain& mountain)
{
HashTable<int, scalar> minDistances;
HashTable<int, scalar> closestZcoords;
forAll(newPoints, ip)
{
int x = roundUp(newPoints[ip].x(), 10); // FIXME: this hashtable method is dubious because it's not safe to compare doubles for equality
scalar z = newPoints[ip].z();
scalar h = mountain.heightAt(x);
scalar distance = abs(z - h);
if (!minDistances.found(x) || distance < minDistances[x])
{
minDistances.set(x, distance);
closestZcoords.set(x, z);
}
}
示例4: procData
void Foam::PrintTable<KeyType, DataType>::print
(
Ostream& os,
const bool printSum,
const bool printAverage
) const
{
HashTable<HashTable<DataType, label>, KeyType> combinedTable;
List<HashTableData> procData(Pstream::nProcs(), HashTableData());
procData[Pstream::myProcNo()] = table_;
Pstream::gatherList(procData);
if (Pstream::master())
{
label largestKeyLength = 6;
label largestDataLength = 0;
List<label> largestProcSize(Pstream::nProcs(), 0);
forAll(procData, procI)
{
const HashTableData& procIData = procData[procI];
for
(
typename HashTableData::const_iterator iter = procIData.begin();
iter != procIData.end();
++iter
)
{
if (!combinedTable.found(iter.key()))
{
combinedTable.insert
(
iter.key(),
HashTable<DataType, label>()
);
}
HashTable<DataType, label>& key = combinedTable[iter.key()];
key.insert(procI, iter());
for
(
typename HashTable<DataType, label>
::const_iterator dataIter = key.begin();
dataIter != key.end();
++dataIter
)
{
std::ostringstream buf;
buf << dataIter();
largestDataLength = max
(
largestDataLength,
label(buf.str().length())
);
}
std::ostringstream buf;
buf << iter.key();
largestKeyLength = max
(
largestKeyLength,
label(buf.str().length())
);
}
}
os.width(largestKeyLength);
os << nl << indent << tab << "# " << title_.c_str() << endl;
os.width(largestKeyLength);
os << indent << "# Proc";
forAll(procData, procI)
{
os << tab;
os.width(largestDataLength);
os << procI;
}
if (printSum)
{
os << tab;
os.width(largestDataLength);
os << "Sum";
}
if (printAverage)
{
os << tab;
os.width(largestDataLength);
os << "Average";
//.........这里部分代码省略.........