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

Question in java

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By me3840

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 1, 2014, 17:50
Default Question in java
  #1
Member
 
hayder
Join Date: Jan 2012
Posts: 32
Rep Power: 14
hyderkhan74 is on a distinguished road
Hi

I wonder If any one found a way to change the scalar physical quantity to value (double). For example if I need to change the the base size for mesh, the following command will used to read the base size (from volumetric control),
GenericAbsoluteSize genericAbsoluteSize_0
= ((GenericAbsoluteSize) volumeSourceSize_0.getAbsoluteSize());

here (generic Absolute Size) is (ScalarPhysicalQuantity) so the following command will not work ,
double myValue_3 = genericAbsoluteSize_0.getValue() ;

So My question Is there other way to read the base size and set it to variable?

Thanks in advance
hyderkhan74 is offline   Reply With Quote

Old   April 1, 2014, 18:57
Default
  #2
Senior Member
 
Join Date: Nov 2010
Location: USA
Posts: 1,232
Rep Power: 24
me3840 is on a distinguished road
You can cast it to a double. Try:
double myValue_3 = (double) genericAbsoluteSize_0.getValue() ;
me3840 is offline   Reply With Quote

Old   April 2, 2014, 04:55
Default
  #3
Member
 
hayder
Join Date: Jan 2012
Posts: 32
Rep Power: 14
hyderkhan74 is on a distinguished road
Quote:
Originally Posted by me3840 View Post
You can cast it to a double. Try:
double myValue_3 = (double) genericAbsoluteSize_0.getValue() ;

Hi me3840

Thank you for your prompt reply, but still shows the same error which is (incompatible types: ScalarPhysicalQuantity cannot be converted to double)
Is there any other ideas ?

Thank you
hyderkhan74 is offline   Reply With Quote

Old   April 7, 2014, 14:37
Default
  #4
Senior Member
 
Join Date: Nov 2010
Location: USA
Posts: 1,232
Rep Power: 24
me3840 is on a distinguished road
Ah, a little more complicated.

Just make a ScalarPhysicalQuantity and set the value, then call your double and get the value:
double size = 0.0;
ScalarPhysicalQuantity scal = ((ScalarPhysicalQuantity) genericAbsoluteSize_0.getValue());
size = scal.getValue();
simulation_0.println(size);
hyderkhan74 likes this.
me3840 is offline   Reply With Quote

Old   April 8, 2014, 05:12
Default
  #5
Member
 
hayder
Join Date: Jan 2012
Posts: 32
Rep Power: 14
hyderkhan74 is on a distinguished road
Quote:
Originally Posted by me3840 View Post
Ah, a little more complicated.

Just make a ScalarPhysicalQuantity and set the value, then call your double and get the value:
double size = 0.0;
ScalarPhysicalQuantity scal = ((ScalarPhysicalQuantity) genericAbsoluteSize_0.getValue());
size = scal.getValue();
simulation_0.println(size);

That Work now ,Thank you for your help .
hyderkhan74 is offline   Reply With Quote

Reply


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
Simple Java question - close & save simulation eRzBeNgEl STAR-CCM+ 8 September 5, 2013 09:45
Quick Java problem. Please help! Pleb STAR-CCM+ 3 September 8, 2012 16:07
Question Re Engineering Data Source imnull ANSYS 0 March 5, 2012 13:51
internal field question - PitzDaily Case atareen64 OpenFOAM Running, Solving & CFD 2 January 26, 2011 15:26
Poisson Solver question Suresh Main CFD Forum 3 August 12, 2005 04:37


All times are GMT -4. The time now is 06:11.