CFD Online Logo CFD Online URL
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

LinkBack Thread Tools Search this Thread Display Modes
Old   October 10, 2018, 18:37
Default Problem with declaring an object of a certain class
Join Date: Apr 2016
Posts: 30
Rep Power: 7
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

Random& rnd;
scalar rn = rnd.GaussNormal();
and I get the following error
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


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 05:01
CCL / Monitor Object Problem James Date CFX 4 September 29, 2010 02:23
ParaView 3.8.0 problem on debian Unseen OpenFOAM Installation 4 August 16, 2010 10:26
looking for radiation problem with `floating' object mirko OpenFOAM 0 June 30, 2010 16:51
[blockMesh] BlockMeshmergePatchPairs hjasak OpenFOAM Meshing & Mesh Conversion 11 August 15, 2008 07:36

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