コード例 #1
0
void Foam::HashSet<Key, Hash>::operator&=(const HashSet<Key, Hash>& rhs)
{
    // Remove elements not also found in rhs
    for (iterator iter = this->begin(); iter != this->end(); ++iter)
    {
        if (!rhs.found(iter.key()))
        {
            this->erase(iter);
        }
    }
}
コード例 #2
0
ファイル: readFields.C プロジェクト: Cescfangs/OpenFOAM-1.7.x
void readFields
(
    const vtkMesh& vMesh,
    const typename GeoField::Mesh& mesh,
    const IOobjectList& objects,
    const HashSet<word>& selectedFields,
    PtrList<GeoField>& fields
)
{
    // Search list of objects for volScalarFields
    IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName));

    // Construct the vol scalar fields
    label nFields = fields.size();
    fields.setSize(nFields + fieldObjects.size());

    for
    (
        IOobjectList::iterator iter = fieldObjects.begin();
        iter != fieldObjects.end();
        ++iter
    )
    {
        if (selectedFields.empty() || selectedFields.found(iter()->name()))
        {
            fields.set
            (
                nFields,
                vMesh.interpolate
                (
                    GeoField
                    (
                        *iter(),
                        mesh
                    )
                )
            );
            nFields++;
        }
    }

    fields.setSize(nFields);
}
    void switchableNotImplemented(
        const word &methodName,
        const dictionary &dict
    ) {
        static HashSet<fileName> notImplementedWarningAlreadyIssued;

        word switchName="ignore_unimplemented_"+methodName;
        bool warn=dict.lookupOrDefault<bool>(switchName,false);

        if(warn) {
            fileName fullName=dict.name()+"_"+methodName;
            if(!notImplementedWarningAlreadyIssued.found(fullName)) {
                Info << endl;
                WarningIn("switchableNotImpleemnted")
                    << "The method " << methodName << " isn't properly "
                        << " implemented (at least that is what the developer "
                        << " thinks. You chose to ignore this for "
                        << dict.name() << endl
                        << "The consequences are your responsibility "
                        << "(but if you're lucky everything will be OK)" << endl
                        << "This warning will only appear once"
                        << nl << endl;

                notImplementedWarningAlreadyIssued.insert(fullName);
            }
        } else {
            Info << endl << endl;
            Info << "It seems that the method " << methodName
                << " is not properly implemented (neither in the class or "
                << " any appropriate subclasses)." << endl
                << "If you think that it should work anyway add the entry" << nl
                << nl << switchName << " true;" << nl << endl
                << "to the dictionary " << dict.name() << " and we will "
                << "go on. Alternativly properly implement the method." << nl
                << nl << "Anyway: I'll go die now";
            Info << endl << endl;
            notImplemented(methodName);
        }
    }
コード例 #4
0
bool Foam::HashSet<Key, Hash>::operator==(const HashSet<Key, Hash>& rhs) const
{
    // Are all lhs elements in rhs?
    for (const_iterator iter = this->cbegin(); iter != this->cend(); ++iter)
    {
        if (!rhs.found(iter.key()))
        {
            return false;
        }
    }

    // Are all rhs elements in lhs?
    for (const_iterator iter = rhs.cbegin(); iter != rhs.cend(); ++iter)
    {
        if (!this->found(iter.key()))
        {
            return false;
        }
    }

    return true;
}