|
[Sponsors] |
September 22, 2010, 13:03 |
add entry to wordList
|
#1 |
New Member
Peter Wiemeyer
Join Date: Sep 2009
Location: Germany, Munich
Posts: 22
Rep Power: 17 |
Hello,
I've a probably very easy question, but I tried already a lot - nearly the cpl. afternoon - but nothing worked so far. First I used something like vector<std::string> and here I added strings with the command vector.push_back(....) Now I want to use the std foam syntax I created a wordList what should be nearly the same as vector<std::string> To add elements at the end the .append function should work. But now the problems comes by: I can append only another wordList but I'm not able to append a entry like wordList testList; testList.append("the first entry"); testList.append("next entry"); and so far. Is anybody able to help me? Would be greatful. Thx a lot, bye Peter |
|
September 24, 2010, 03:44 |
|
#2 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40 |
Quote:
2. If you are doing several appends, using "List" is very inefficient. A "List" is normally used with pre-allocated space. For example, Code:
// dimension for exactly 2 items List<string> testList(2); testList[0] = "the first entry"; testList[1] = "next entry"; For example, Code:
// reserve at least 10 spaces DynamicList<string> testList(10); testList.append("the first entry"); testList.append("next entry"); testList.append("yet another entry"); Note that if you have a list of bool values, you should consider using PackedBoolList - it has many pleasant features that make it behave somewhat like a DynamicList. |
||
September 24, 2010, 04:00 |
|
#3 |
New Member
Peter Wiemeyer
Join Date: Sep 2009
Location: Germany, Munich
Posts: 22
Rep Power: 17 |
Thx already now for your reply. Some time ago I worked with those dynamic Lists. I will try what's possible in this case. I will come back to this threat then in the next days because at the moment other project work is urgent.
Thx & have a nice weekend Peter |
|
October 4, 2010, 08:13 |
|
#4 |
New Member
Peter Wiemeyer
Join Date: Sep 2009
Location: Germany, Munich
Posts: 22
Rep Power: 17 |
SOLVED
working with those dynamic lists is exactly what I needed because when using vector OF has problems with other include files. Thx @ all, Best Regards, Peter |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
NuSGsWallFunction declaration type | anne | OpenFOAM Running, Solving & CFD | 5 | April 14, 2008 15:35 |
Add Measure Markings or Coordinates to the Contour | Colin | FLUENT | 4 | August 25, 2004 10:54 |
Add source term in species equation | zhou1 | FLUENT | 1 | October 21, 2003 07:28 |
How to add new code in ground with PLANT? | Zhang Zhiqin | Phoenics | 2 | April 30, 2003 13:45 |
How to add fire source in STAR-CD?? | raymond | Siemens | 2 | February 22, 2002 14:49 |