当前位置: 首页>>代码示例>>C++>>正文


C++ HashTable::found方法代码示例

本文整理汇总了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;
    }
}
开发者ID:Cescfangs,项目名称:OpenFOAM-1.7.x,代码行数:11,代码来源:foamToFieldview9.C

示例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;
}
开发者ID:aguerrehoracio,项目名称:OpenFOAM-dev,代码行数:19,代码来源:HashTable.C

示例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);
	    }
	}
开发者ID:jjprettyman,项目名称:AtmosFOAM,代码行数:23,代码来源:add2dMountain.C

示例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";
//.........这里部分代码省略.........
开发者ID:BarisCumhur,项目名称:OpenFOAM-dev,代码行数:101,代码来源:PrintTable.C


注:本文中的HashTable::found方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。