CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

list new element

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By peterwy

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 27, 2010, 04:59
Default list new element
  #1
New Member
 
Peter Wiemeyer
Join Date: Sep 2009
Location: Germany, Munich
Posts: 22
Rep Power: 16
peterwy is on a distinguished road
Hello,

the question is probably quite easy, but still some basics are missing and I'm not able to find it in the forum ...

I want to make a list or something similiar where I can store elements and I have dynamics memory allocation.

As a result of a search in the mesh I get a couple of cell numbers:
Sometimes only perhaps 5 another time 500000.

So I need to make a list, where I'm able to store just the cell numbers in. One by one, the order doesn't matter at the end. (At the beginning of the storing process it's not clear how much cells will be in at the end)

If the forAll command is working would be great but of course no must have.

Hope its clear so far what I would like to have.

Is there anybody who is able to help me?

Thx @ all & best Regards,
Peter
peterwy is offline   Reply With Quote

Old   May 27, 2010, 05:29
Default
  #2
Senior Member
 
Stefan Herbert
Join Date: Dec 2009
Location: Darmstadt, Germany
Posts: 129
Rep Power: 17
herbert is on a distinguished road
Hi Peter,

I think you can use DynamicList<label> declared in DynamicList.H. You can use the member append to insert your cell numbers at the end of this list. The forAll command is working.

Regards,
Stefan
herbert is offline   Reply With Quote

Old   May 27, 2010, 06:45
Default it works
  #3
New Member
 
Peter Wiemeyer
Join Date: Sep 2009
Location: Germany, Munich
Posts: 22
Rep Power: 16
peterwy is on a distinguished road
Thx for your help.
It worked great.
Just for the next one who is looking for something similar:

Initialize: DynamicList<int> bla;
Append value: bla.append(5);
Clear all entries: bla.clear();

(That are the commands that I needed.)

Best Regards,
Peter
F42 likes this.
peterwy is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
mesh file for flow over a circular cylinder Ardalan Main CFD Forum 7 December 15, 2020 13:06
RP_Set_List_of_Integer linch FLUENT 0 December 2, 2009 10:41
OpenFOAM on MinGW crosscompiler hosted on Linux allenzhao OpenFOAM Installation 127 January 30, 2009 19:08
DxFoam reader update hjasak OpenFOAM Post-Processing 69 April 24, 2008 01:24
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 17:51


All times are GMT -4. The time now is 22:38.