CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   objectRegistry related problems (http://www.cfd-online.com/Forums/openfoam-programming-development/132660-objectregistry-related-problems.html)

burt April 3, 2014 21:55

objectRegistry related problems
 
Hi there

this problem has been bothering me for days!

Info << newMesh().thisDb().lookupObject<dictionary>("fvSch emes") << endl;

error comes:
lookup of fvSchemes from objectRegistry background successful
but it is not a dictionary, it is a dictioanry

personally I think there is someting wrong with the ptr, just can not figure out the solution.

anyone has ever been through this??

thanks a lot for your attention!!!

burt

wyldckat April 6, 2014 14:32

Quick questions:
  1. Which OpenFOAM version or variant are you using?
  2. How can we reproduce the same error?

burt April 10, 2014 20:33

hi wyldckat
I am using OF 2.2.2
I got this problem after I wrote hundreds of codes, this error occur when it came to this line
fvm::ddt(U_subdomain)
I was trying to solve UEqn in a subdomain


Quote:

Originally Posted by wyldckat (Post 484198)
Quick questions:
  1. Which OpenFOAM version or variant are you using?
  2. How can we reproduce the same error?


wyldckat April 13, 2014 16:07

Hi burt,

This is an interesting result... it stating that it is a dictionary and not a dictionary :D

From what I figure out, you can have access to this particular dictionary like this:
Code:

Info << newMesh().schemesDict() << endl;
This is possible because the class "fvMesh" inherits directly from the class "fvSchemes".

Actually, this also works:
Code:

Info << newMesh().thisDb().lookupObject<IOdictionary>("fvSchemes") << endl;
The difference is that "IOdictionary" is derived from "dictionary" and essentially have the same type names, but "IOdictionary" is specific for handling the dictionary files.

Best regards,
Bruno

burt April 14, 2014 22:31

Hi Bruno

it is so nice of you, and obviously you are professional.
when I tried
Code:

Info << fluidRegions[0] .schemesDict() << endl;
the scheme shows well
when I typed
Code:

Info << newMesh() .schemesDict() << endl;
nothing useful appeared
newMesh is a subdomain of fluidRegion[0]
I will dig more!

thanks again for your kindly help!!

Quote:

Originally Posted by wyldckat (Post 485866)
Hi burt,

This is an interesting result... it stating that it is a dictionary and not a dictionary :D

From what I figure out, you can have access to this particular dictionary like this:
Code:

Info << newMesh().schemesDict() << endl;
This is possible because the class "fvMesh" inherits directly from the class "fvSchemes".

Actually, this also works:
Code:

Info << newMesh().thisDb().lookupObject<IOdictionary>("fvSchemes") << endl;
The difference is that "IOdictionary" is derived from "dictionary" and essentially have the same type names, but "IOdictionary" is specific for handling the dictionary files.

Best regards,
Bruno



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