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

dimensionedScalar as class member

Register Blogs Community New Posts Updated Threads Search

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   March 27, 2013, 03:04
Default dimensionedScalar as class member
  #1
New Member
 
Cedric
Join Date: Mar 2013
Posts: 2
Rep Power: 0
Seeker is on a distinguished road
Hi!

I am trying to write a small class. I feel like this should be trivial, but I can't figure out how to get a dimensionedScalar as a class member without errors =/.

I would like to have something along the lines of:
Code:
class A {
    public:
        A();
        ~A() {};
        dimensioned<scalar> getX() {return dimX; } //Edited
    private:
        dimensioned<scalar> dimX();
}

//Constructor
A::A () {
    dimX.name() = "dimX";
    dimX.dimensions() = dimLength;
    dimX.value() = 0.0;
}
Instead of having a dimensionedScalar, I can of course just have a double as class member and than have a dimensionedScalar created and returned when getX() is called... but that's really not pretty =).

The error I am getting is "error: ‘((A*)this)->A::dimX’ does not have class type"

What am I missing?
Thanks!

Last edited by Seeker; March 29, 2013 at 05:58.
Seeker 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
[OpenFOAM] Native ParaView Reader Bugs tj22 ParaView 270 January 4, 2016 11:39
Doxygen documentation Tanay OpenFOAM Installation 9 September 23, 2011 11:40
member function [value()] of dimensioned<Type> class sblee1977 OpenFOAM Programming & Development 2 November 9, 2010 03:52
Version 15 on Mac OS X gschaider OpenFOAM Installation 113 December 2, 2009 10:23
Errors running allwmake in OpenFOAM141dev with WM_COMPILE_OPTION%3ddebug unoder OpenFOAM Installation 11 January 30, 2008 20:30


All times are GMT -4. The time now is 10:01.