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


C++ IOobjectList::lookupClass方法代码示例

本文整理汇总了C++中IOobjectList::lookupClass方法的典型用法代码示例。如果您正苦于以下问题:C++ IOobjectList::lookupClass方法的具体用法?C++ IOobjectList::lookupClass怎么用?C++ IOobjectList::lookupClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IOobjectList的用法示例。


在下文中一共展示了IOobjectList::lookupClass方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: forAllIter

void Foam::lagrangianFieldDecomposer::readFields
(
    const label cloudI,
    const IOobjectList& lagrangianObjects,
    PtrList<PtrList<IOField<Type> > >& lagrangianFields
)
{
    // Search list of objects for lagrangian fields
    IOobjectList lagrangianTypeObjects
    (
        lagrangianObjects.lookupClass(IOField<Type>::typeName)
    );

    lagrangianFields.set
    (
        cloudI,
        new PtrList<IOField<Type> >
        (
            lagrangianTypeObjects.size()
        )
    );

    label lagrangianFieldi = 0;
    forAllIter(IOobjectList, lagrangianTypeObjects, iter)
    {
        lagrangianFields[cloudI].set
        (
            lagrangianFieldi++,
            new IOField<Type>(*iter())
        );
    }
开发者ID:AmaneShino,项目名称:OpenFOAM-2.0.x,代码行数:31,代码来源:lagrangianFieldDecomposerDecomposeFields.C

示例2: objects

void readFields
(
    PtrList<List<Type> >& values,
    const List<word>& fieldNames,
    const IOobjectList& cloudObjs
)
{
    IOobjectList objects(cloudObjs.lookupClass(IOField<Type>::typeName));

    forAll(fieldNames, j)
    {
        const IOobject* obj = objects.lookup(fieldNames[j]);
        if (obj != NULL)
        {
            Info<< "        reading field " << fieldNames[j] << endl;
            IOField<Type> newField(*obj);
            values.set(j, new List<Type>(newField.xfer()));
        }
        else
        {
            FatalErrorIn
            (
                "template<class Type>"
                "void readFields"
                "("
                    "PtrList<List<Type> >&, "
                    "const List<word>&, "
                    "const IOobjectList&"
                ")"
            )
                << "Unable to read field " << fieldNames[j]
                << abort(FatalError);
        }
    }
}
开发者ID:Al-th,项目名称:OpenFOAM-2.2.x,代码行数:35,代码来源:steadyParticleTracksTemplates.C

示例3: fieldObjects

wordList ReadUniformFields
(
    const IOobjectList& objects,
    PtrList<GeoField>& fields,
    const bool syncPar
)
{
    // Search list of objects for wanted type
    IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName));

    wordList masterNames(fieldObjects.names());

    if (syncPar && Pstream::parRun())
    {
        // Check that I have the same fields as the master
        const wordList localNames(masterNames);
        Pstream::scatter(masterNames);

        HashSet<word> localNamesSet(localNames);

        forAll(masterNames, i)
        {
            const word& masterFld = masterNames[i];

            HashSet<word>::iterator iter = localNamesSet.find(masterFld);

            if (iter == localNamesSet.end())
            {
                FatalErrorIn
                (
                    "ReadFields<class GeoField>"
                    "(const IOobjectList&, PtrList<GeoField>&"
                    ", const bool)"
                )   << "Fields not synchronised across processors." << endl
                    << "Master has fields " << masterNames
                    << "  processor " << Pstream::myProcNo()
                    << " has fields " << localNames << exit(FatalError);
            }
            else
            {
                localNamesSet.erase(iter);
            }
        }

        forAllConstIter(HashSet<word>, localNamesSet, iter)
        {
            FatalErrorIn
            (
                "ReadFields<class GeoField>"
                "(const IOobjectList&, PtrList<GeoField>&"
                ", const bool)"
            )   << "Fields not synchronised across processors." << endl
                << "Master has fields " << masterNames
                << "  processor " << Pstream::myProcNo()
                << " has fields " << localNames << exit(FatalError);
        }
    }
开发者ID:GJOMAA,项目名称:OpenFOAM-dev,代码行数:57,代码来源:execFlowFunctionObjects.C

示例4: timeName

void processField
(
    const fvMesh& mesh,
    const IOobjectList& objects,
    const word& fieldName,
    label& processed
)
{
    if (processed != -1)
    {
        return;
    }

    typedef GeometricField<Type, fvPatchField, volMesh> fieldType;

    const word timeName(mesh.time().timeName());

    IOobjectList fieldObjbjects(objects.lookupClass(fieldType::typeName));

    if (fieldObjbjects.lookup(fieldName) != NULL)
    {
        fieldType vtf(*fieldObjbjects.lookup(fieldName), mesh);
        const typename fieldType::GeometricBoundaryField& bf =
            vtf.boundaryField();

        forAll(bf, patchI)
        {
            if (isA<externalCoupledMixedFvPatchField<Type> >(bf[patchI]))
            {
                Info<< "Generating external coupled geometry for field "
                    << fieldName << endl;

                const externalCoupledMixedFvPatchField<Type>& pf =
                    refCast<const externalCoupledMixedFvPatchField<Type> >
                    (
                        bf[patchI]
                    );

                pf.writeGeometry();
                processed = 1;

                break;
            }
        }

        if (processed != 1)
        {
            processed = 0;

            Info<< "Field " << fieldName << " found, but does not have any "
                << externalCoupledMixedFvPatchField<Type>::typeName
                << " boundary conditions" << endl;
        }
    }
开发者ID:BarisCumhur,项目名称:OpenFOAM-2.3.x,代码行数:54,代码来源:createExternalCoupledPatchGeometryTemplates.C

示例5: fieldObjects

bool checkFields
(
    const fvMesh& mesh,
    const IOobjectList& objects,
    GeoField* dummy
)
{
    // Search list of objects for volScalarFields
    IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName));

    for
    (
        IOobjectList::iterator iter = fieldObjects.begin();
        iter != fieldObjects.end();
        ++iter
    )
    {
        GeoField current(*iter(), mesh);

        GeoField ref
        (
            IOobject
            (
                "reference"/mesh.time().timeName()/current.name(),
                mesh,
                IOobject::MUST_READ
            ),
            mesh
        );

        dimensionedScalar small("small", ref.dimensions(), SMALL);

        volScalarField error = mag(current - ref)/stabilise(mag(ref), small);

        dimensionedScalar maxError = max(error);

        Info << ref.name() << tab << maxError.value() << endl;

	if ( maxError.value() > 0.001 )
        {
            return true;
        }
    }

    return false;
}
开发者ID:galleon,项目名称:ChipAirCooling,代码行数:46,代码来源:checkReference.C

示例6: fields

void RotateFields
(
    const fvMesh& mesh,
    const IOobjectList& objects,
    const tensor& T
)
{
    // Search list of objects for volScalarFields
    IOobjectList fields(objects.lookupClass(GeometricField::typeName));

    forAllIter(IOobjectList, fields, fieldIter)
    {
        Info<< "    Rotating " << fieldIter()->name() << endl;

        GeometricField theta(*fieldIter(), mesh);
        transform(theta, dimensionedTensor(T), theta);
        theta.write();
    }
开发者ID:Cescfangs,项目名称:OpenFOAM-1.7.x,代码行数:18,代码来源:rotateMesh.C

示例7: fieldObjects

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);
}
开发者ID:Cescfangs,项目名称:OpenFOAM-1.7.x,代码行数:43,代码来源:readFields.C

示例8: fieldObjects

void Foam::readFields
(
    const Mesh& mesh,
    const IOobjectList& objects,
    PtrList<GeoField>& fields
)
{
    // Search list of objects for volScalarFields
    IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName));

    // Remove the cellDist field
    IOobjectList::iterator celDistIter = fieldObjects.find("cellDist");
    if (celDistIter != fieldObjects.end())
    {
        fieldObjects.erase(celDistIter);
    }

    // Construct the vol scalar fields
    fields.setSize(fieldObjects.size());

    label fieldi=0;
    for
    (
        IOobjectList::iterator iter = fieldObjects.begin();
        iter != fieldObjects.end();
        ++iter
    )
    {
        fields.set
        (
            fieldi++,
            new GeoField
            (
                *iter(),
                mesh
            )
        );
    }
}
开发者ID:Brzous,项目名称:WindFOAM,代码行数:39,代码来源:readFields.C

示例9: fieldObjects

void ReadAndMapFields
(
    const fvMesh& mesh,
    const IOobjectList& objects,
    const fvMesh& tetDualMesh,
    const labelList& map,
    const typename MappedGeoField::value_type& nullValue,
    PtrList<MappedGeoField>& tetFields
)
{
    typedef typename MappedGeoField::value_type Type;

    // Search list of objects for wanted type
    IOobjectList fieldObjects(objects.lookupClass(ReadGeoField::typeName));

    tetFields.setSize(fieldObjects.size());

    label i = 0;
    forAllConstIter(IOobjectList, fieldObjects, iter)
    {
        Info<< "Converting " << ReadGeoField::typeName << ' ' << iter.key()
            << endl;

        ReadGeoField readField(*iter(), mesh);

        tetFields.set
        (
            i,
            new MappedGeoField
            (
                IOobject
                (
                    readField.name(),
                    readField.instance(),
                    readField.local(),
                    tetDualMesh,
                    IOobject::NO_READ,
                    IOobject::AUTO_WRITE,
                    readField.registerObject()
                ),
                pointMesh::New(tetDualMesh),
                dimensioned<Type>
                (
                    "zero",
                    readField.dimensions(),
                    pTraits<Type>::zero
                )
            )
        );

        Field<Type>& fld = tetFields[i].internalField();

        // Map from read field. Set unmapped entries to nullValue.
        fld.setSize(map.size(), nullValue);
        forAll(map, pointI)
        {
            label index = map[pointI];

            if (index > 0)
            {
                label cellI = index-1;
                fld[pointI] = readField[cellI];
            }
            else if (index < 0)
            {
                label faceI = -index-1;
                label bFaceI = faceI - mesh.nInternalFaces();
                if (bFaceI >= 0)
                {
                    label patchI = mesh.boundaryMesh().patchID()[bFaceI];
                    label localFaceI = mesh.boundaryMesh()[patchI].whichFace
                    (
                        faceI
                    );
                    fld[pointI] = readField.boundaryField()[patchI][localFaceI];
                }
                //else
                //{
                //    FatalErrorIn("ReadAndMapFields(..)")
                //        << "Face " << faceI << " from index " << index
                //        << " is not a boundary face." << abort(FatalError);
                //}

            }
            //else
            //{
            //    WarningIn("ReadAndMapFields(..)")
            //        << "Point " << pointI << " at "
            //        << tetDualMesh.points()[pointI]
            //        << " has no dual correspondence." << endl;
            //}
        }
开发者ID:GJOMAA,项目名称:OpenFOAM-dev,代码行数:92,代码来源:foamToTetDualMesh.C

示例10: main

int main(int argc, char *argv[])
{
    argList::validOptions.insert("noFlipMap", "");

#   include "addRegionOption.H"
#   include "addTimeOptions.H"
#   include "setRootCase.H"
#   include "createTime.H"

    bool noFlipMap = args.optionFound("noFlipMap");

    // Get times list
    instantList Times = runTime.times();

    label startTime = Times.size()-1;
    label endTime = Times.size();

    // check -time and -latestTime options
#   include "checkTimeOption.H"

    runTime.setTime(Times[startTime], startTime);

#   include "createNamedPolyMesh.H"

    // Search for list of objects for the time of the mesh
    IOobjectList objects
    (
        mesh,
        mesh.pointsInstance(),
        polyMesh::meshSubDir/"sets"
    );

    Info<< "Searched : " << mesh.pointsInstance()/polyMesh::meshSubDir/"sets"
        << nl
        << "Found    : " << objects.names() << nl
        << endl;


    IOobjectList pointObjects(objects.lookupClass(pointSet::typeName));

    //Pout<< "pointSets:" << pointObjects.names() << endl;

    for
    (
        IOobjectList::const_iterator iter = pointObjects.begin();
        iter != pointObjects.end();
        ++iter
    )
    {
        // Not in memory. Load it.
        pointSet set(*iter());
        SortableList<label> pointLabels(set.toc());

        label zoneID = mesh.pointZones().findZoneID(set.name());
        if (zoneID == -1)
        {
            Info<< "Adding set " << set.name() << " as a pointZone." << endl;
            label sz = mesh.pointZones().size();
            mesh.pointZones().setSize(sz+1);
            mesh.pointZones().set
            (
                sz,
                new pointZone
                (
                    set.name(),             //name
                    pointLabels,            //addressing
                    sz,                     //index
                    mesh.pointZones()       //pointZoneMesh
                )
            );
            mesh.pointZones().writeOpt() = IOobject::AUTO_WRITE;
            mesh.pointZones().instance() = mesh.facesInstance();
        }
        else
        {
            Info<< "Overwriting contents of existing pointZone " << zoneID
                << " with that of set " << set.name() << "." << endl;
            mesh.pointZones()[zoneID] = pointLabels;
            mesh.pointZones().writeOpt() = IOobject::AUTO_WRITE;
            mesh.pointZones().instance() = mesh.facesInstance();
        }
    }



    IOobjectList faceObjects(objects.lookupClass(faceSet::typeName));

    HashSet<word> slaveCellSets;

    //Pout<< "faceSets:" << faceObjects.names() << endl;

    for
    (
        IOobjectList::const_iterator iter = faceObjects.begin();
        iter != faceObjects.end();
        ++iter
    )
    {
        // Not in memory. Load it.
        faceSet set(*iter());
//.........这里部分代码省略.........
开发者ID:Cescfangs,项目名称:OpenFOAM-1.7.x,代码行数:101,代码来源:setsToZones.C

示例11: fieldOk

bool fieldOk(const IOobjectList& cloudObjs, const word& name)
{
    IOobjectList objects(cloudObjs.lookupClass(IOField<Type>::typeName));

    return (objects.lookup(name) != NULL);
}
开发者ID:Al-th,项目名称:OpenFOAM-2.2.x,代码行数:6,代码来源:steadyParticleTracksTemplates.C


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