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

HasTable to store (key,value) pair in OpenFOAM

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 4, 2022, 13:21
Default HasTable to store (key,value) pair in OpenFOAM
  #1
New Member
 
Join Date: Jan 2015
Posts: 22
Rep Power: 11
adib_mohammad is on a distinguished road
Does HashTable allow creating (key, value) pairs and accessing the value by key as well as iterating through the items in the object?

I need keys of word type and values of label.

I could not find a useful sample usage in the source code.
adib_mohammad is offline   Reply With Quote

Old   December 11, 2022, 09:53
Default
  #2
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
I suggest you dig a bit more in the code, there are plenty of places using HashTable with a word key (the default) and some type of value (integer or otherwise).


The iterator is a bit special (ie, different than std map etc) in that you would use its key(), val() methods to get the pair of key and value, and its normal dereference operator returns the val() and not the pair.
olesen is offline   Reply With Quote

Reply

Tags
hashtable


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
Map of the OpenFOAM Forum - Understanding where to post your questions! wyldckat OpenFOAM 10 September 2, 2021 06:29
Deleting files in /constant/polyMesh to reset and store OpenFOAM case sdfij6354 OpenFOAM Running, Solving & CFD 0 December 21, 2017 08:37
OpenFOAM Training Jan-Jul 2017, Virtual, London, Houston, Berlin CFDFoundation OpenFOAM Announcements from Other Sources 0 January 4, 2017 07:15
OpenFOAM Training Beijing 22-26 Aug 2016 cfd.direct OpenFOAM Announcements from Other Sources 0 May 3, 2016 05:57
[OpenFOAM.org] A Mac OS X of23x Development Environment Using Docker rt08 OpenFOAM Installation 1 February 28, 2016 20:00


All times are GMT -4. The time now is 08:03.