|
[Sponsors] |
March 27, 2013, 04:04 |
dimensionedScalar as class member
|
#1 |
New Member
Cedric
Join Date: Mar 2013
Posts: 2
Rep Power: 0 |
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; } 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 06:58. |
|
March 28, 2013, 14:40 |
|
#2 |
Senior Member
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23 |
Is that the actual code you're trying to compile?
Your function getX has no return value and the member variable dimX should not have brackets after it for a start.
__________________
Laurence R. McGlashan :: Website |
|
March 29, 2013, 06:57 |
|
#3 | |
New Member
Cedric
Join Date: Mar 2013
Posts: 2
Rep Power: 0 |
Hi
Thanks for the reply I typed it up in here, forgot to copy the returntype, thanks. Quote:
error: no matching function for call to ‘Foam::dimensioned<double>::dimensioned()’ I looked up the source code and found that a NULL constructor is called with empty brackets, which seems to work. However, I cannot seem to be able to assign any value afterwards. |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[OpenFOAM] Native ParaView Reader Bugs | tj22 | ParaView | 270 | January 4, 2016 12:39 |
Doxygen documentation | Tanay | OpenFOAM Installation | 9 | September 23, 2011 12:40 |
member function [value()] of dimensioned<Type> class | sblee1977 | OpenFOAM Programming & Development | 2 | November 9, 2010 04:52 |
Version 15 on Mac OS X | gschaider | OpenFOAM Installation | 113 | December 2, 2009 11:23 |
Errors running allwmake in OpenFOAM141dev with WM_COMPILE_OPTION%3ddebug | unoder | OpenFOAM Installation | 11 | January 30, 2008 21:30 |