|
[Sponsors] |
Transfer elements of dictionary into List<dimensionedScalar> |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
February 25, 2014, 13:07 |
Transfer elements of dictionary into List<dimensionedScalar>
|
#1 |
Senior Member
Join Date: Jan 2012
Posts: 166
Rep Power: 14 |
hi,
in one of my files, let s call the file "properties" I have a subdict like Code:
ValueV1 { V1S1 [0 1 1 0 0 0 0] 888888; V1S2 [0 1 1 0 0 0 0] 7777; . //no constant number of entries . . } I tried something like Code:
List<dimensionedScalar> List_V1 = properties.subDict("ValueV1"); Code:
error: no match for ‘operator=’ I know that I can stream the subdict into an object of class dictionary or create a reference to it like Code:
const dictionary& subDict = properties.subDict("Value1"); greetings maybee Last edited by maybee; February 27, 2014 at 05:57. |
|
February 26, 2014, 08:09 |
|
#2 |
Member
Join Date: Jul 2011
Posts: 54
Rep Power: 15 |
I would think that this is not possible since the subDict type has some other properties compared to the List type. Maybe you should try to run a forAll loop over the entries of the subDict and then assign them to a List<dimensioned scalar>. But are these really all entries of type dimensionedScalar?
If that is not possible then you can maybe just read the scalar values out of the subDict with the readScalar() function. Can't guarantee that this works, but maybe something like this: Code:
//Get name of dictionary before List<dimensionedScalar> list(dict.size()); forAll(dictName, i) { //Get name of actual entry before dimensionedScalar listElement = (entryName, dimensionset(0, 1, 1, 0, 0, 0, 0), readScalar(properties.lookup(entryName))); list[i]=listElement; } |
|
February 27, 2014, 05:55 |
|
#3 |
Senior Member
Join Date: Jan 2012
Posts: 166
Rep Power: 14 |
hi,
thx for the help. Unfortunately I can t use your code since the number of elements/entries within the subdict is not constant. Therefore I can t write the code using the list entries. I edited my intitial quesiton now. Edit: I guess I have found a solution that works like this: Code:
wordList VALUES ( properties.lookup("VALUES") ); forAll(VALUES, i) { const word& Current = VALUES[i]; dictionary& subDict_Values = properties.subDict("TheValues"); List_Values[i] = dimensionedScalar(subDict_Values.lookup(Current)); } greetings maybee Last edited by maybee; February 27, 2014 at 11:05. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Heat transfer coefficient - what is waht | Stan | FLUENT | 28 | December 29, 2021 17:29 |
Fluent Tutorial on Heat transfer | Far | FLUENT | 15 | July 29, 2017 16:31 |
Question about heat transfer coefficient setting for CFX | Anna Tian | CFX | 1 | June 16, 2013 07:28 |
Convective Heat Transfer - Heat Exchanger | Mark | CFX | 6 | November 15, 2004 16:55 |
additional variable mass transfer in CFX5.6 | john | CFX | 1 | February 14, 2004 01:30 |