CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM Programming & Development

Dynamic .lookup("keyword") function

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Display Modes
Old   July 12, 2013, 14:18
Default Dynamic .lookup("keyword") function
Join Date: Aug 2012
Posts: 76
Rep Power: 7
HakikiCanakkaleli is on a distinguished road

== 1 ==
Is it possible to have an array type, dynamically changing "keyword" entry for the "Dictionary lookup"?


class object(dict.lookup("keyword"));
== 2 ==
I would like to look up multiple keywords in a dictionary. So, I made the following:

const label arraySizeName = 1000; 
word names[arraySizeName];
const word fileName = "radius";

for (label k = 0; k < 10; k++)

names[k] = fileName+name(k);
const scalar a(readScalar(dict.lookup(names[k])));

So, I did not put the ditto marks of "keyword".

== 3 ==

I compiled it and it did not give any errors. But, for some arbitrary reason, I cannot test it whether it works well or not.

I appreciate any comment.

Many thanks in advance.
HakikiCanakkaleli is offline   Reply With Quote

Old   July 12, 2013, 15:56
Join Date: Aug 2012
Posts: 76
Rep Power: 7
HakikiCanakkaleli is on a distinguished road
Revealed that it is possible. :]
HakikiCanakkaleli is offline   Reply With Quote


Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to define to right point for locationInMesh Mirage12 OpenFOAM Native Meshers: snappyHexMesh and Others 7 March 13, 2016 15:07
non-orthogonal faces and incorrect orientation? nennbs OpenFOAM Native Meshers: blockMesh 7 April 17, 2013 05:42
dynamic viskosity field function jarry STAR-CCM+ 2 August 18, 2010 04:53
Version 15 on Mac OS X gschaider OpenFOAM Installation 113 December 2, 2009 11:23
LibvtkFoamso fred OpenFOAM Paraview & paraFoam 2 November 18, 2005 20:01

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