|
[Sponsors] |
February 5, 2018, 18:46 |
RTS wiki tutorial question
|
#1 |
New Member
Clint
Join Date: Sep 2015
Posts: 10
Rep Power: 11 |
I have been using the wiki page on RTS
https://openfoamwiki.net/index.php/O...tion_mechanism to help work through some things. It's been very helpful but I have been stuck trying to figure out one of the code snippets for a few days now without much luck. Here is the code in question Code:
template<class DerivedType> class addMrConstructorToTable { public: static Base New ( const dictionary& dict) { return Base(new DerivedType (dict)); } addMrConstructorToTable ( const word& lookup = DerivedType::typeName ) { constructMrConstructorTables(); MrConstructorTablePtr_->insert(lookup, New); } ~addMrConstructorToTable() { destroyMrConstructorTables(); } }; Code:
addMrConstructorToTable::addMrConstructorToTable ( const word& lookup = DerivedType::typeName ) { constructMrConstructorTables(); MrConstructorTablePtr_->insert(lookup, New); } Is it adding a pointer to the addMrConstructorToTable::New() function itself to the hash table by not passing the argument list in the insert call? In that case I still don't understand how a function pointer to the desired derived constructor is being returned when we later access the hash table to create a DerivedType object. Code:
return Base(new DerivedType (dict)); |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
help with 3D Bifurcating Artery tutorial - no wall shear seen | 9aul | FLUENT | 0 | January 15, 2018 18:20 |
[Tutorials] New Dakota - OpenFOAM Coupling Tutorial | Tobi | OpenFOAM Community Contributions | 0 | October 9, 2016 17:19 |
WIKI MRFSimpleFoam Tutorial | baoaero | OpenFOAM Running, Solving & CFD | 2 | September 17, 2013 21:05 |
[Virtualization] OpenFOAM oriented tutorial on using VMware Player - support thread | wyldckat | OpenFOAM Installation | 2 | July 11, 2012 16:01 |
A question on the first tutorial example bcavityb | athlonshi | OpenFOAM Running, Solving & CFD | 7 | October 23, 2008 11:28 |