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

List cannot be trusted...?

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 19, 2010, 16:23
Default List cannot be trusted...?
  #1
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 21
marupio is on a distinguished road
Why does setSize() trash my data?

I have:
Code:
class: equationMaster
{
    List<equation> eqns_;
}
Where equation is itself a list:
Code:
class: equation
:
    public List<operation>
{
    // null constructor, friend operators << and >>
   // construct from components and IStream
}
and operation is
Code:
class: operation
{
   // four labels defined, some with enumeration
   // null constructor, friend operators << and >>
   // construct from components and IStream
}
Now, when I do this:
Code:
eqns_.setSize(eqns_size() + 1);
it trashes my operation list.

Anyone with any ideas what is going on? Have I overused lists?

Any assistance would be appreciated...

-Dave
marupio is offline   Reply With Quote

Old   July 20, 2010, 03:04
Default
  #2
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,684
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by marupio View Post
it trashes my operation list.

Anyone with any ideas what is going on? Have I overused lists?

Any assistance would be appreciated...
I'd guess that the copy operation in setSize() might be causing issues.
Without actually knowing anything about your classes, you might nonetheless take a look at PtrList and see it that makes more sense for some of your operations.
olesen is offline   Reply With Quote

Old   July 20, 2010, 10:26
Default
  #3
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 21
marupio is on a distinguished road
Thanks Mark. (I thought it might be a constructor issue.) I did switch to PtrList and it is behaving now.
marupio is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
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
Errors running allwmake in OpenFOAM141dev with WM_COMPILE_OPTION%3ddebug unoder OpenFOAM Installation 11 January 30, 2008 20:30
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 17:51
New List of Free CFD Codes Bert Laney Main CFD Forum 5 September 15, 1999 15:24


All times are GMT -4. The time now is 21:37.