View Issue Details

IDProjectCategoryView StatusLast Update
0003742OpenFOAMBugpublic2021-10-22 13:02
ReporternoZeroDays Assigned Tohenry  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionno change required 
Product Version9 
Summary0003742: lookup of data from objectRegistry region0 successful but it is not a dictionary, it is a dictionary!
DescriptionHello,

I have tried the following with a coded function object:

Info << mesh().lookupObject<dictionary>("data") << endl;

I got the following error:

--> FOAM FATAL ERROR:

    lookup of data from objectRegistry region0 successful
    but it is not a dictionary, it is a dictionary

However, when I use IOobject it doesn't complain:

Info << mesh().lookupObject<IOdictionary>("data") << endl;
Steps To ReproduceCreate a coded function object and add the line above.
TagsNo tags attached.

Activities

noZeroDays

2021-10-22 12:17

reporter   ~0012245

Sorry in the last paragraph I mean; "However, when I use IOdictionary it doesn't complain "

henry

2021-10-22 12:30

manager   ~0012246

You have not provided sufficient information to reproduce the problem.

henry

2021-10-22 12:36

manager   ~0012247

IOdictionary is a registered object but dictionary is not, you will need to use IOdictionary as the type to lookup.

noZeroDays

2021-10-22 12:47

reporter   ~0012248

Sorry for not providing more informations, here is how to reproduce that:

Copy the airfoil2D tutorial and add the following at the end of system/controlDict

functions
{
    myCodedFunc
    {
        type coded;
        libs ("libutilityFunctionObjects.so");
        name something;

        codeWrite
        #{
                Info << mesh().lookupObject<dictionary>("data") << endl;
                
        #};
    }
}

noZeroDays

2021-10-22 12:48

reporter   ~0012249

The thing is that the error message itself is misleading.

henry

2021-10-22 13:02

manager   ~0012250

You should use lookupObject<IOdictionary>

henry

2021-10-22 13:02

manager   ~0012251

User error

Issue History

Date Modified Username Field Change
2021-10-22 12:16 noZeroDays New Issue
2021-10-22 12:17 noZeroDays Note Added: 0012245
2021-10-22 12:30 henry Note Added: 0012246
2021-10-22 12:36 henry Note Added: 0012247
2021-10-22 12:47 noZeroDays Note Added: 0012248
2021-10-22 12:48 noZeroDays Note Added: 0012249
2021-10-22 13:02 henry Note Added: 0012250
2021-10-22 13:02 henry Assigned To => henry
2021-10-22 13:02 henry Status new => closed
2021-10-22 13:02 henry Resolution open => no change required
2021-10-22 13:02 henry Note Added: 0012251