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 Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 19, 2010, 17:23
Default List cannot be trusted...?
  #1
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 22
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, 04:04
Default
  #2
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
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, 11:26
Default
  #3
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 22
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


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 20:08
DxFoam reader update hjasak OpenFOAM Post-Processing 69 April 24, 2008 02:24
Errors running allwmake in OpenFOAM141dev with WM_COMPILE_OPTION%3ddebug unoder OpenFOAM Installation 11 January 30, 2008 21:30
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 18:51
New List of Free CFD Codes Bert Laney Main CFD Forum 5 September 15, 1999 16:24


All times are GMT -4. The time now is 03:56.