We have been using Netgen and NG solve as an integral part of our higher order HDG code. But recently we are doing few metric based adaptations and hence,we are in a dire need for a mesh converter that can convert from .vol to .msh or .mesh format. Although I have myself tried to write a mesh converter for this purpose, But I don’t have complete information about the way .vol format is written for 3d meshes.
You can use mesh.Export(name,format) on a Netgen (not NGSolve!) mesh to export to a neutral mesh format. If you put in something wrong as a format you’ll get a list of available export formats, but I’m not sure that all of them are working… Please report if you encounter problems.
As directed by you, I tried the export mesh feature in netgen, although .tet format is not working. Also, the major problem arises when i want to import mesh from different mesh generators as we use netgen for generation of our basis functions on imported mesh. Although, I tried the import mesh option which can take in (A) neutral format (b) surface mesh (c) universal format and few more, I encountered the following problem: Even when I am exporting a .vol file in neutral format and then trying to import this mesh into netgen, The mesh is missing a surface. I don’t know whether its a glitch in graphics or not.
Also can you please explain me the meaning of few notations in .vol mesh which are as follows:
I would be very obliged if you explain what these notations means in .vol file
I just exported a Netgen mesh in neutral format and loaded it using the NGSolve “Mesh(…)” function to load it and it worked for me.
What is you workflow? You want to import the mesh to use it in NGSolve or in Netgen?
Please attach one of the mesh files where you encounter problems.
The part of the vol file you ask about is the list of edges in the mesh.
I’m not sure about the first number. I would have to have a closer look at the source code.
p1 and p2 are the start point and end point of the edge.
trignum1 and trignum2 are just used if a stl-geometry is meshed.
domin/surfnr1 and domout/surfnr2 are the numbers of the surfaces(boundaries) on the two sides of the edge.
ednr 1 seems to be the number of the egde between two surfaces (meshing starts with the edges)
for the last numbers a have to check the source code for more details.
Hope that helps for now.
Thanks, Its only the first parameter # surfid , that i want to know as I have written a mesh converter which is working according to the explanation you gave. I will be very thankful if you can give the explanation of this parameter.
“surfid” is the number of the “FaceDescriptor” (starting by 1). These are used to describe surfaces in a 3d mesh. There are always two edges with the same points and different surfid’s. This means that all those edges describe intersections between two surfaces.
Thanks for your reply but I am still slightly confused about what is the difference between surfnr1, surfnr2 and surfid. All of them are somehow related to the surface ID to which this edge is connected. From my understanding, surfnr1 and surfnr2 are the ID of the surfaces which share this edge. Then what does surfid signify?
When I type mesh.Export(name,file) in my code, It just showed up this message (AttributeError: ‘ngsolve.comp.Mesh’ object has no attribute ‘Export’).
And also where will the export file be saved. Thank you
Hi, there is a difference between the ngsolve mesh (a fem interface to the netgen mesh) and the netgen mesh itself. The export function is defined for the netgen mesh. You tried to call it on the ngsolve one. You can get the netgen mesh by calling mesh.ngmesh. The file is saved relative to your current path.