CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > Siemens > STAR-CCM+

AbsoluteSize and GenericAbsoluteSize classes

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 18, 2011, 10:48
Default AbsoluteSize and GenericAbsoluteSize classes
  #1
New Member
 
Jean-François Corbett
Join Date: Aug 2011
Posts: 8
Rep Power: 15
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:

Code:
GenericAbsoluteSize genericAbsoluteSize_1 = ((GenericAbsoluteSize) volumeSourceSize_0.getAbsoluteSize());
genericAbsoluteSize_1.getValue().setValue(25.0);
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:

Code:
volumeSourceSize_0.getAbsoluteSize().getValue().setValue(25.0);
jfcorbett is offline   Reply With Quote

Old   September 18, 2011, 19:22
Default
  #2
Senior Member
 
Join Date: Oct 2009
Location: Germany
Posts: 636
Rep Power: 22
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
Default
  #3
New Member
 
Jean-François Corbett
Join Date: Aug 2011
Posts: 8
Rep Power: 15
jfcorbett is on a distinguished road
Thanks abdul099. I also contacted CD-adapco support, and they basically confirmed what you said:

Quote:
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

Reply

Tags
absolutesize, genericabsolutesize, java, macro


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 16:41.