|
[Sponsors] |
Macros TypeName() , ClassName(), defineTypeNameAndDebug()... |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 23, 2009, 07:01 |
Macros TypeName() , ClassName(), defineTypeNameAndDebug()...
|
#1 |
Senior Member
Join Date: Mar 2009
Posts: 248
Rep Power: 18 |
Dear Forum Users
Greetings to Everybody.... I have some doubt about how the macros ClassName, TypeName and defineTypeNameAndDebug have been defined. Here is what I have found... 1st the Macro ClassName("TypeNameString"); Code:
static const char* typeName_() { return TypeNameString; } \ static const ::Foam::word typeName; \ static int debug
Code:
const ::Foam::word Type::typeName \ ( \ Type::typeName_() \ ); \ \ int Type::debug( \ ::Foam::debug::debugSwitch \ ( \ Type::typeName_(), \ DebugSwitch \ ) \ ); defineTypeNameAndDebug(primitiveMesh,0); it will call two functions , namely:
Code:
const ::Foam::word primitiveMesh::typeName ( primitiveMesh::typeName_() );
Code:
int primitiveMesh::debug( ::Foam::debug::debugSwitch ( primitiveMesh::typeName_(), DebugSwitch ) ); The problematic Macro is the macro TypeName(TypeNameString) defined in the typeInfo.H, it reads: Code:
ClassName(TypeNameString); \ virtual const word& type() const { return typeName; } Code:
static const char* typeName_() { return polyMesh; } \ static const ::Foam::word typeName; \ static int debug; virtual const word& type() const { return typeName; } Please share it with the forum if anybody knows about this. Thanks for the attention Regards Jaswi Last edited by jaswi; March 23, 2009 at 13:50. Reason: The question was not well formulated initially |
|
March 22, 2020, 09:58 |
Macros and typeName initialization
|
#2 |
Member
Rahul Vadrabade
Join Date: Apr 2018
Posts: 46
Rep Power: 8 |
This is too old thread but i was reading same topic which comes in advanced category. Though for the completeness of thread here is answer which might be beneficial for future readers.
As typeName is a static variable hence it is required to initialize outside class. It is initialized in defineTypeNameAndDebug(Type, DebugSwitch) macro at const ::Foam::word primitiveMesh::typeName(primitiveMesh::typeName_() ); |
|
June 15, 2020, 10:52 |
|
#3 | |
Senior Member
|
Quote:
Can you explain also why some class uses ClassName() while some TypeName() in header files? |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
help with macros F_ID and C_ID | Jack Martinez | FLUENT | 0 | August 19, 2007 08:27 |
Problems with Airpak - Copy Macros, diffuser | Nelson | FLUENT | 0 | May 20, 2007 22:56 |
What are UDF macros C_T_S , C_T_AP,...???? | Asghari | FLUENT | 0 | January 28, 2007 10:54 |
udf error in some macros | Asghari | FLUENT | 0 | August 7, 2006 01:10 |
Orientation of Face Variable Macros | hirokata | FLUENT | 0 | February 17, 2006 00:12 |