CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

IstreamConstructorTablePtr

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 3 Post By Tobi
  • 1 Post By Zeppo

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 31, 2019, 16:10
Default IstreamConstructorTablePtr
  #1
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
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.
salehi144, behnamEll and Xiaodong like this.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   January 2, 2020, 12:46
Default
  #2
Senior Member
 
Zeppo's Avatar
 
Sergei
Join Date: Dec 2009
Posts: 261
Rep Power: 21
Zeppo will become famous soon enough
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 Runtime Type Selection. Check it out.
Tobi likes this.
Zeppo is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 16:32.