CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > Siemens > STAR-CCM+

AbsoluteSize and GenericAbsoluteSize classes

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

LinkBack Thread Tools Search this Thread Display Modes
Old   September 18, 2011, 10:48
Default AbsoluteSize and GenericAbsoluteSize classes
New Member
Jean-François Corbett
Join Date: Aug 2011
Posts: 8
Rep Power: 11
jfcorbett is on a distinguished road
What is the difference, if any, between the GenericAbsoluteSize and AbsoluteSize classes?

The STAR-CCM+ macro recorder always seems to cast AbsoluteSize to GenericAbsoluteSize before using it, for example:

GenericAbsoluteSize genericAbsoluteSize_1 = ((GenericAbsoluteSize) volumeSourceSize_0.getAbsoluteSize());
Do I absolutely have to cast the AbsoluteSize to a GenericAbsoluteSize like that? Or is it possible (as I hope it is) to shorten the code to:

jfcorbett is offline   Reply With Quote

Old   September 18, 2011, 19:22
Senior Member
Join Date: Oct 2009
Location: Germany
Posts: 637
Rep Power: 18
abdul099 is on a distinguished road
GenericAbsoluteSize extends AbsoluteSize. Therefore you should be able to get rid of the cast, as long as you don't use any method of GenericAbsoluteSize which isn't implemented in AbsoluteSize.
setValue() is implemented in AbsoluteSize and inherited to GenericAbsoluteSize, therefore it should be possible not to use the cast. At least I couldn't see anything in GenericAbsoluteSize which suggests, it wouldn't work.

But anyway you can be on the safe side and do it in one line even with the cast

((GenericAbsoluteSize) volumeSourceSize_0.getAbsoluteSize()).getValue().s etValue(value);

and it's not much more work.
abdul099 is offline   Reply With Quote

Old   September 21, 2011, 08:19
New Member
Jean-François Corbett
Join Date: Aug 2011
Posts: 8
Rep Power: 11
jfcorbett is on a distinguished road
Thanks abdul099. I also contacted CD-adapco support, and they basically confirmed what you said:

I just had a look on the Java API documentation of STAR-CCM+ and the GenericAbsoluteSize inherits all of its methods from the AbsoluteSize class, therefore you are correct you could use the shorter version that you mentioned. In fact I just tried this myself in a simple test case and it worked just fine.

I will ask the developers why the macro recorder always casts the AbsoluteSize to GenericAbsoluteSize, because it seems to me like this class is redundant. Perhaps there is something I am missing. I will let you know as soon as I hear back from them.
jfcorbett is offline   Reply With Quote


absolutesize, genericabsolutesize, java, macro

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

All times are GMT -4. The time now is 17:33.