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

Compilation fails under OF1806+

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 1 Post By anon_q
  • 1 Post By anon_q
  • 1 Post By olesen
  • 1 Post By olesen

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   November 6, 2018, 08:35
Unhappy Compilation fails under OF1806+
  #1
Senior Member
 
Join Date: Mar 2018
Posts: 115
Rep Power: 8
anon_q is on a distinguished road
Hello,
I have an OpenFOAM code that compiles and runs properly under OpenFOAM 6.
Now I switched to OpenFOAM V1806 but unfortunately the code doesn't compile. After reading the errors reported by the compiler, I understand that the problem is caused by hashtable, so I decided to isolate the problem and I created the sample code below that produces the same error:

The code:
Code:
#include "fvCFD.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

void fillHashTable(HashTable<List<label>, label>& hashTable, label maxN);
int main(int argc, char *argv[])
{

    HashTable<List<label>, label> table1;

    fillHashTable(table1, 5);

    Info << table1 << endl;
    Info<< "End\n" << endl;

    return 0;
}

void fillHashTable(HashTable<List<label>, label>& hashTable, label maxN)
{
    List<label> tmpList;
    for(int i=0; i < maxN; ++i)
    {
        tmpList.clear();
        tmpList = {2*i, i*i, i*i*i};
        hashTable.insert(i , tmpList);
    }
}
The error:
Code:
...
/home/evren/OpenFOAM/OpenFOAM-v1806/src/OpenFOAM/lnInclude/HashTableI.H:35: error: no match for call to ‘(Foam::string::hash) (const int&)’
     return Hash()(key) & (capacity_ - 1);
            ~~~~~~^~~~~
...
As I stated above, the code compiles and works perfectly when I use OpenFOAM 6.
Could you please help me debug this problem, is it a bug?
Update:
After changing the type of key to word it works, Could you please confirm that hashtables in OpenFOAM v1806 work only with string keys?
olesen likes this.

Last edited by anon_q; November 6, 2018 at 12:45.
anon_q is offline   Reply With Quote

 

Tags
openfoam, openfoam 1806


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
[OpenFOAM.org] OpenFOAM 4.0 compilation fails with latest Intel compiler mstud OpenFOAM Installation 3 October 6, 2016 16:01
Modified interFoam compilation fails voingiappone OpenFOAM Programming & Development 6 October 1, 2013 03:47
OpenFOAM compilation fails on applicationsutilitiesmesh geoffjay OpenFOAM Installation 12 April 29, 2008 15:26
Compilation fails on Linuxx86 agrahn OpenFOAM Bugs 21 August 31, 2007 04:10
Compilation fails on suse linux 101 su_junwei OpenFOAM Bugs 2 July 20, 2007 04:56


All times are GMT -4. The time now is 17:02.