示例#1
0
void Foam::edgeMesh::write
(
    const fileName& name,
    const edgeMesh& mesh
)
{
    if (debug)
    {
        Info<< "edgeMesh::write"
            "(const fileName&, const edgeMesh&) : "
            "writing to " << name
            << endl;
    }

    const word ext = name.ext();

    writefileExtensionMemberFunctionTable::iterator mfIter =
        writefileExtensionMemberFunctionTablePtr_->find(ext);

    if (mfIter == writefileExtensionMemberFunctionTablePtr_->end())
    {
        FatalErrorIn
        (
            "MeshedSurface::write"
            "(const fileName&, const MeshedSurface&)"
        )   << "Unknown file extension " << ext << nl << nl
            << "Valid types are :" << endl
            << writefileExtensionMemberFunctionTablePtr_->sortedToc()
            << exit(FatalError);
    }
    else
    {
        mfIter()(name, mesh);
    }
}
示例#2
0
bool Foam::functionEntry::execute
(
    const word& functionName,
    const dictionary& parentDict,
    primitiveEntry& entry,
    Istream& is
)
{
    is.fatalCheck
    (
        "functionEntry::execute"
        "(const word&, const dictionary&, primitiveEntry&, Istream&)"
    );

    if (!executeprimitiveEntryIstreamMemberFunctionTablePtr_)
    {
        cerr<<"functionEntry::execute"
            << "(const word&, const dictionary&, primitiveEntry&, Istream&)"
            << " not yet initialized, function = "
            << functionName.c_str() << std::endl;

        // return true to keep reading anyhow
        return true;
    }

    executeprimitiveEntryIstreamMemberFunctionTable::iterator mfIter =
        executeprimitiveEntryIstreamMemberFunctionTablePtr_->find(functionName);

    if (mfIter == executeprimitiveEntryIstreamMemberFunctionTablePtr_->end())
    {
        FatalErrorIn
        (
            "functionEntry::execute"
            "(const word&, const dictionary&, primitiveEntry&, Istream&)"
        )   << "Unknown functionEntry '" << functionName
            << "' in " << is.name() << " near line " << is.lineNumber()
            << endl << endl
            << "Valid functionEntries are :" << endl
            << executeprimitiveEntryIstreamMemberFunctionTablePtr_->toc()
            << exit(FatalError);
    }

    return mfIter()(parentDict, entry, is);
}
示例#3
0
tetMetric::tetMetricReturnType
tetMetric::New
(
    const dictionary& dict,
    const word& metricName
)
{
    Info << "Selecting metric " << metricName << endl;

    dlLibraryTable::open
    (
        dict,
        "tetMetricLibs",
        metricPointMemberFunctionTablePtr_
    );

    if (!metricPointMemberFunctionTablePtr_)
    {
        FatalErrorIn
        (
            "tetMetric::New(const dictionary&, const word&)"
        )   << "tetMetric table is empty"
            << exit(FatalError);
    }

    metricPointMemberFunctionTable::iterator mfIter =
        metricPointMemberFunctionTablePtr_->find(metricName);

    if (mfIter == metricPointMemberFunctionTablePtr_->end())
    {
        FatalErrorIn
        (
            "tetMetric::New(const dictionary&, const word&)"
        )   << "Unknown metric " << metricName
            << endl << endl
            << "Valid metrics are :" << endl
            << metricPointMemberFunctionTablePtr_->toc()
            << exit(FatalError);
    }

    return mfIter();
}