CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   STAR-CCM+ (https://www.cfd-online.com/Forums/star-ccm/)
-   -   Question in java (https://www.cfd-online.com/Forums/star-ccm/132501-question-java.html)

hyderkhan74 April 1, 2014 17:50

Question in java
 
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

me3840 April 1, 2014 18:57

You can cast it to a double. Try:
double myValue_3 = (double) genericAbsoluteSize_0.getValue() ;

hyderkhan74 April 2, 2014 04:55

Quote:

Originally Posted by me3840 (Post 483328)
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

me3840 April 7, 2014 14:37

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 April 8, 2014 05:12

Quote:

Originally Posted by me3840 (Post 484455)
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 .


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