CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

java vs c++

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 1, 2004, 03:56
Default java vs c++
  #1
zxaar
Guest
 
Posts: n/a
i need little advice. i am currently writing a solver in C++ (visual studio), things are okey, but the problem comes if i have to add few things to GUI. to be truthful i am not able to understand much of visual studio (or MFC). verytime i get into some doubt i have to search hard to get the answer. On the other hand i have very good experience of java (swing etc). so i was wondering to shift my code from C++ to java. it will be little effort but will save lot of time for writing visualisation of results. but i fear that java will be infierier to c++ when it comes to scientific computations. so i wished to ask what do other people suggest on this.
  Reply With Quote

Old   December 1, 2004, 09:41
Default Re: java vs c++
  #2
Jim_Park
Guest
 
Posts: n/a
Really don't know either language. But, if Java is interpreted and c++ is compiled, wouldn't the c++ code run much faster? That'd be what you want for the CFD part.

At least one big CFX user I know uses CFX for his CFD solutions, then uses Tecplot for the visualization. Thinking in a similar pattern, have you considered using c++ for your number crunching (to get the solutions quickly), then visualizating the results in a separate Java code?

The experts will quickly tell you (and me!) what's wrong with this idea.

Good luck.
  Reply With Quote

Old   December 1, 2004, 12:44
Default Re: java vs c++
  #3
Jonas Holdeman
Guest
 
Posts: n/a
I agree that Java makes GUIs easy, and it is portable between operating systems. Any GUI using Visual C++ is not going to be easily portable to Linux. I think that there are toolkits that can be used for GUIs in C++ that are portable. You write to an interface, and the toolkit provides the support for the particular operating system. Perhaps someone else can comment on this. If you are not committed to tight integration of the GUI and computational modules, you could use Java in your GUI and write an intermediate file to be used as input to your comp module. (I started to do this for a mesh generator but never finished it. I hope to go back to this some time in the future).

For the computational module, you may want to use sparse matrix methods, certainly if you are interested in handling large problems. There are C++ linear algebra routines available from Netlib. I don't recall anything in Java, but it has been a year since I looked. If you are interested in CFD computation rather than computer programming, you could save a lot of time by avoiding translating to Java and debugging.
  Reply With Quote

Old   December 1, 2004, 18:43
Default Re: java vs c++
  #4
zxaar
Guest
 
Posts: n/a
there is one more possiblity that i am thinking, that is to call c++ from java, but as i am thinking the speed shall not be that different as i store the mesh in graph and use pointers to access data. so my solver is quite fast(at least in c++), but if the same apporach is used , that is the moevement with refrence or pointers the speed will be similar in java too. my biggest fear is of memory leaks if the data size increases, the solver shall be able to run two million cells (provided good hardware) without memory leaks. though i agree garbage collector of java is robust but i still doubt this.

abot debugging problems, the only type of problems i get are logical probs (very hard to debug), i usually do not get syntax errors. Now logical errors could not come as most of the code is already running (c++). it is just that i wanted that my solver should plot residual curve as fluent does and i found my self groping for answers.
  Reply With Quote

Old   December 2, 2004, 05:34
Default Re: java vs c++
  #5
Steve
Guest
 
Posts: n/a
Rumour has it that STAR-CCM+ consists of a java GUI wrapped around a C++ solver.
  Reply With Quote

Old   December 2, 2004, 08:49
Default Re: java vs c++
  #6
Maciej Matyka
Guest
 
Posts: n/a
"But, if Java is interpreted"

It is not interpreted. Maciej
  Reply With Quote

Old   December 2, 2004, 09:22
Default Re: java vs c++
  #7
Tom
Guest
 
Posts: n/a
Actually it is (or what was) known as a threaded interpreted language - just like the old Forth programming language; i.e. it is "compiled" into psuedo code which is then interpreted into true (machine dependent) machine code at run time by the Java Virtual Machine. That is the psuedo code is interpreted.

This is much faster than a normal interpreted language but much slower than a true compiled language.
  Reply With Quote

Old   December 2, 2004, 09:43
Default Re: java vs c++
  #8
Maciej Matyka
Guest
 
Posts: n/a
ok, you are right here. Maciej
  Reply With Quote

Old   December 2, 2004, 18:39
Default Re: java vs c++
  #9
zxaar
Guest
 
Posts: n/a
we wrote a network visualisation tool , that is to represent a network of large (very large say , 50 000 nodes or more) on screen, in java. and from that experience i can say java is not so slow as it seems. anyway i have found something called V or vide for gui, that is better (but still i am not able to compile it to run ), but this is small do not require visual studio and can be portable., very good tool
  Reply With Quote

Old   December 2, 2004, 22:48
Default Re: java vs c++
  #10
Angen
Guest
 
Posts: n/a
There is at least one C++ tolkit for portable graphic user interfaces (Windows, Unix/Linux, Mac). The name is "Qt" and it is developed by Troltech of Norway. They have comercial versions, which in my opinion are at moderate prices (compared to some Windows toolkits) and possiblly they still have a free toolkit for noncommercial use under Linux. I used this toolkit in Windows platform and I liked it a lot.

Andy
  Reply With Quote

Old   December 3, 2004, 03:05
Default Re: java vs c++
  #11
zxaar
Guest
 
Posts: n/a
i have found the answer to my riddle, i guess best for me to use opengl, and by using this i can draw residual plots while iterating ..on the other hand opengl has lot of things to show grid and results on screen, animate them, or print them. using that will be a saving of lot of time.
  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
I developed an FEM toolkit in Java: FuturEye nkliuyueming Main CFD Forum 7 January 29, 2016 14:28
satexe.exe error when executing another Java program macwind2 Phoenics 0 June 12, 2009 06:07
How to open the ICEM help with java? windhair CFX 2 May 18, 2007 07:05
Getting OpenFOAM to coexist with an existing JAVA VM nik777 OpenFOAM Installation 5 February 22, 2007 08:21
navier stokes implementation in java gerhard Main CFD Forum 0 August 18, 2004 06:07


All times are GMT -4. The time now is 01:26.