CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   IstreamConstructorTablePtr (https://www.cfd-online.com/Forums/openfoam-programming-development/223227-istreamconstructortableptr.html)

Tobi December 31, 2019 16:10

IstreamConstructorTablePtr
 
Hi all,


I also have another question that I do not get at the moment. We have the object named IstreamConstructorTablePtr_ in the ddtScheme class. See code snippet below.



Code:

template<class Type>
 tmp<ddtScheme<Type>> ddtScheme<Type>::New
 (
    const fvMesh& mesh,
    Istream& schemeData
 )
 {
    if (fv::debug)
    {
        InfoInFunction << "Constructing ddtScheme<Type>" << endl;
    }
 
    if (schemeData.eof())
    {
        FatalIOErrorInFunction
        (
            schemeData
        )  << "Ddt scheme not specified" << endl << endl
            << "Valid ddt schemes are :" << endl
            << IstreamConstructorTablePtr_->sortedToc()
            << exit(FatalIOError);
    }
 
    const word schemeName(schemeData);
 
    typename IstreamConstructorTable::iterator cstrIter =
        IstreamConstructorTablePtr_->find(schemeName);
 
    if (cstrIter == IstreamConstructorTablePtr_->end())
    {
        FatalIOErrorInFunction
        (
            schemeData
        )  << "Unknown ddt scheme " << schemeName << nl << nl
            << "Valid ddt schemes are :" << endl
            << IstreamConstructorTablePtr_->sortedToc()
            << exit(FatalIOError);
    }
 
    return cstrIter()(mesh, schemeData);
}


However, I cannot determine where the object is created or initiated.

Zeppo January 2, 2020 12:46

Hi.
Declaration and definition of IstreamConstructorTablePtr_ are done in ddtScheme class with two macros: declareRunTimeSelectionTable and defineRunTimeSelectionTable

I presented some thoughts on the subject in the thread https://www.cfd-online.com/Forums/op...selection.html. Check it out.


All times are GMT -4. The time now is 21:24.