CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   Load Mesh file to C++ (https://www.cfd-online.com/Forums/main/15518-load-mesh-file-c.html)

ehsan August 6, 2008 01:52

Load Mesh file to C++
 
Hi How can i load Mesh file from Gambit to C++ ? with all Node,Element,Boundary !!!

Ahmed August 6, 2008 12:58

Re: Load Mesh file to C++
 
save the mesh file in text format (in Gambit it is called nuetral format)

ehsan August 8, 2008 12:28

Re: Load Mesh file to C++
 
I know that, but my problem is: how can i read that with C++?? with what operation,function & how ???

Markus Lummer August 11, 2008 02:01

Re: Load Mesh file to C++
 
You can use the C++ input stream cin or the usual C-functions.

ehsan August 11, 2008 03:14

Re: Load Mesh file to C++
 
can u explain it more ? i read it like this (C++): fstream infile("Grid.txt");

and after that i use two 'for' loop for X&y, but it didn't work !!!

Markus Lummer August 11, 2008 03:18

Re: Load Mesh file to C++
 
Try

ifstream infile("Grid.txt");

infile >> x; infile >> y; // etc.

ehsan August 15, 2008 07:29

Re: Load Mesh file to C++
 
i found it but iused with

FILE* f; f=fopen("filename"; scanf(f,"r");

it's read one line ...


All times are GMT -4. The time now is 10:03.