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

Java vs C++ for CFD mesh processing

Register Blogs Community New Posts Updated Threads Search

Like Tree13Likes
  • 1 Post By piu58
  • 1 Post By aerosayan
  • 1 Post By aerosayan
  • 1 Post By ssh123
  • 1 Post By aerosayan
  • 1 Post By aerosayan
  • 1 Post By arjun
  • 1 Post By ssh123
  • 1 Post By arjun
  • 1 Post By arjun
  • 1 Post By arjun
  • 1 Post By JBeilke
  • 1 Post By sbaffini

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   July 3, 2021, 18:58
Question Java vs C++ for CFD mesh processing
  #1
New Member
 
Truong Dang
Join Date: Oct 2016
Location: Vietnam
Posts: 21
Rep Power: 9
ssh123 is on a distinguished road
Recently I re-implement my C++ code in Java and realize that the Java execution is faster than the C++ one ! The code takes a gmsh .msh file and convert it to .dat Tecplot file and .vtk file (Paraview).

With JDK 8 my Java code took ~2.6 seconds, whereas the C++ version took:
~5 seconds (MinGW g++ 10.2 with -O3 optimization flag).
~2.8 seconds (MinGW g++ 4.9.2 with -O3 optimization flag).

Key point could be the performance of C++ vector and Java List interface.

Have you ever faced similar situation?

Edited: Looks like this is a bug of MinGW g++ 10.2. My C++ implementation is just slightly slower than Java although it's heavily object oriented.

Ps: I have posted my code to GitHub so that you can have better judgement.
C++: https://github.com/truongd8593/GmshToVtkAndTecplotCpp11
Java: https://github.com/truongd8593/MisaCFDJava

Last edited by ssh123; July 10, 2021 at 03:31.
ssh123 is offline   Reply With Quote

 

Tags
c++, java, mesh


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
[snappyHexMesh] SnappyHexMesh/splitMeshRegion : region1 in zone "-1" GuiMagyar OpenFOAM Meshing & Mesh Conversion 3 August 4, 2023 12:38
foam-extend-4.1 release hjasak OpenFOAM Announcements from Other Sources 19 July 16, 2021 05:02
GeometricField -> mesh() Function Tobi OpenFOAM Programming & Development 10 November 19, 2020 11:33
[snappyHexMesh] SnappyHexMesh no layers and no decent mesh for complex geometry pizzaspinate OpenFOAM Meshing & Mesh Conversion 1 February 25, 2015 07:05
[ICEM] Generating Mesh for STL Car in Windtunnel Simulation tommymoose ANSYS Meshing & Geometry 48 April 15, 2013 04:24


All times are GMT -4. The time now is 00:59.