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

How to deal with fields of unknown type

Register Blogs Community New Posts Updated Threads Search

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   May 20, 2008, 09:27
Default Hello, maybe you can sugges
  #1
kar
Senior Member
 
Kārlis Repsons
Join Date: Mar 2009
Location: Latvia
Posts: 111
Rep Power: 17
kar is on a distinguished road
Hello,

maybe you can suggest a good solution for this problem: let F be an array of names and pointers (void*) to fields like volScalarField, surfaceVectorField etc; when adding a new entry to F, pointer type should be somehow memorised such a way, that it is as easy as possible to deal with that actual type of field later through pointer.

For example, I could use

volScalarField& f;
string typeName__ = f.type();,

but that means, whenever I need to do something, I need to build a ton of switches depending on typeName__. That is bad. Especially if I know, there is type() for each pointer...

A template solution?
kar is offline   Reply With Quote

 


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
TurbDyMFoam Unknown dynamicFvMesh type mixerFvMesh david OpenFOAM Running, Solving & CFD 11 February 16, 2009 16:30
Unknown error sivakumar OpenFOAM Pre-Processing 9 September 9, 2008 12:53
Unknown faceTetPolyPatchCellDecomp chris1980 OpenFOAM Running, Solving & CFD 2 September 4, 2006 06:01
UNKNOWN ERROR Robbie FLUENT 0 July 15, 2005 19:27
Unknown Error Robbie FLUENT 0 July 12, 2005 17:05


All times are GMT -4. The time now is 09:36.