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

Problem with declaring an object of a certain class

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 10, 2018, 19:37
Default Problem with declaring an object of a certain class
  #1
Member
 
Join Date: Apr 2016
Posts: 30
Rep Power: 10
shanvach is on a distinguished road
Hi all,

This is a pretty basic but I need some help. I want to access a member function called GaussNormal() inside the Random class. So I first created a object rnd of class Random.Then called the member function. The following is what I wrote

Code:
Random& rnd;
scalar rn = rnd.GaussNormal();
and I get the following error
Code:
In file included from twoPhaseEulerFoam.C:107:0:
pU/UEqns.H: In function ‘int main(int, char**)’:
pU/UEqns.H:27:13: error: ‘rnd’ declared as reference but not initialized
     Random& rnd;
             ^
pU/UEqns.H:28:33: error: no matching function for call to ‘Foam::Random::GaussNormal()’
     scalar rn = rnd.GaussNormal();
I think I might have to use a constructor, but I don't know how to work that out.
Your help in this matter is greatly appreciated.

Thanks and Regards,
Shantanu Vachhani
shanvach is offline   Reply With Quote

Reply

Tags
class, constructor, object, random, twophaseeulerfoam

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
strange problem with data seav OpenFOAM Running, Solving & CFD 0 April 11, 2014 06:01
CCL / Monitor Object Problem James Date CFX 4 September 29, 2010 03:23
ParaView 3.8.0 problem on debian Unseen OpenFOAM Installation 4 August 16, 2010 11:26
looking for radiation problem with `floating' object mirko OpenFOAM 0 June 30, 2010 17:51
[blockMesh] BlockMeshmergePatchPairs hjasak OpenFOAM Meshing & Mesh Conversion 11 August 15, 2008 08:36


All times are GMT -4. The time now is 23:04.