dictionary scalarField formatting
I'm playing around with some functionality in 1.6-ext and am using a class that requires a scalarField be supplied in a dictionary. Its for a list of times at which to activate a specific boundary condition. How should this entry be formatted? I can't seem to find any tutorials/examples that use this kind of setup.
|
Hi,
If you Info a scalarField to the terminal then you can see the format. It looks like this (where lookupName is just whatever name you want to give it): Code:
lookupName 5 ( 0 0.005 0.01 0.015 0.02); |
Thanks Phil!
I think that almost does it. How should I format it so that it gets read by code like this: Code:
scalarField(entries[i].dict().lookup("times")) I currently have Code:
times 2 (2.0 3.0); Code:
--> FOAM FATAL IO ERROR: |
Hi,
This is how I read a scalarField from a dictionary: Code:
IOdictionary myData |
That definitely makes more sense to me, but I don't want to go re-writing someone else's class. I've never seen a scalarField read like that, so I'm at a loss here. I'll try enabling some debug switches and see what comes out.
Thanks anyways! |
No luck with the debug flags or debug mode. The code I'm looking at is the attachDetach.C. It still exists in OF21x ($FOAM_SRC/dynamicMesh/attachDetach/attachDetach.C), I'm trying it out there and giving it in the same error. Its just syntax, but I can't find anywhere else that uses something similar.
Is it possible that scalarField can't actually be read like this, and no one noticed? |
I don't see anything wrong with attachDetach. The only scalarField lookup is for triggerTimes_ in the constructor initialization list, and the syntax is:
Code:
triggerTimes_(dict.lookup("triggerTimes")), |
Hi David!
Sorry the confusion, what I meant was is that the problem is with MY syntax in the dictionary to define the triggertimes. The comments made by Philip are correct in that a scalarfield as defined in his first message should be read just fine, but I haven't been able to get it working. The syntax I have for my attach/detach face is as follows: Code:
flap1 |
I don't know anything about dynamic mesh, but looking at attachDetach.C, the dictionary constructor expects everything to be in the dictionary root. So you need to use "subDict" in your constructor call.
Assume the dictionary you show above is myDict. Your attachDetach constructor call should be something like: Code:
attachDetach myAttachDetachObject |
Thanks! I found the error: in the attachDetachFvMesh from 1.6-ext, the modifiers are inside a PtrList<entries>, so the syntax in the dictionary should be:
Code:
modifiers |
All times are GMT -4. The time now is 03:04. |