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

Newbie Question on PtrList usage

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 2 Post By mlaurita
  • 1 Post By GPesch

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   September 20, 2013, 13:56
Default Newbie Question on PtrList usage
  #1
New Member
 
Tom Chyczewski
Join Date: Mar 2009
Location: Bethpage, New York, USA
Posts: 15
Rep Power: 17
chyczewski is on a distinguished road
I recently received the following information from another post:

If N, you need
PtrList<volScalarField> ks(N);
PtrList<volScalarField> thetas(N);
You will access them as ks[i] and thetas[i].
If NxM, make a PtrList<PtrList<volScalarField> > bigOne(N);
forAll (bigOne, i)
{
bigOne.set(i, new PtrList<volScalarField>(M));
}
and then fill the lot. You will access them as bigOne[i][j];

I am able to create the arrays via PtrList as described above but I am not able to access them. If I try

ks[1]=1.0;

I get a fatal error: hanging pointer, cannot dereference at runtime.

If I try

ks.set(1,1.0);


I get a number of compilation errors. Any suggestions?
chyczewski is offline   Reply With Quote

 


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
Newbie Question IcoFoam - Courant Number explodes sprobst76 OpenFOAM Running, Solving & CFD 12 March 1, 2018 07:35
question about uds tanven FLUENT 2 July 5, 2015 11:22
internal field question - PitzDaily Case atareen64 OpenFOAM Running, Solving & CFD 2 January 26, 2011 15:26
Question about Table applicaiton. universez OpenFOAM Running, Solving & CFD 0 January 12, 2010 20:31
CHANNEL FLOW: a question and a request Carlos Main CFD Forum 4 August 23, 2002 05:55


All times are GMT -4. The time now is 16:36.