- Thank you received: 0
saving the mesh in .vol format
6 years 11 months ago - 6 years 11 months ago #325
by ankit101
saving the mesh in .vol format was created by ankit101
i am using the following script for converting the mesh from gmesh to netgen .vol but I would like to save the mesh also through my script.
from netgen.read_gmsh import ReadGmsh
from netgen.meshing import *
# import the Gmsh file to a Netgen mesh object
mesh = ReadGmsh("coarse_test")
# wrap it into an NGSolve mesh
from ngsolve import *
mesh = Mesh(mesh)
Draw(mesh)
print ("num vol elements:", mesh.GetNE(VOL))
print ("num bnd elements:", mesh.GetNE(BND)).
When I am using mesh.Save ("newmesh.vol"), its throwing back the following error:
Traceback (most recent call last):
File "testgmsh.py", line 18, in <module>
mesh.Save ("newmesh.vol")
AttributeError: 'ngsolve.comp.Mesh' object has no attribute 'Save'.
So could someone help me with saving the mesh after its converted using the script
from netgen.read_gmsh import ReadGmsh
from netgen.meshing import *
# import the Gmsh file to a Netgen mesh object
mesh = ReadGmsh("coarse_test")
# wrap it into an NGSolve mesh
from ngsolve import *
mesh = Mesh(mesh)
Draw(mesh)
print ("num vol elements:", mesh.GetNE(VOL))
print ("num bnd elements:", mesh.GetNE(BND)).
When I am using mesh.Save ("newmesh.vol"), its throwing back the following error:
Traceback (most recent call last):
File "testgmsh.py", line 18, in <module>
mesh.Save ("newmesh.vol")
AttributeError: 'ngsolve.comp.Mesh' object has no attribute 'Save'.
So could someone help me with saving the mesh after its converted using the script
Last edit: 6 years 11 months ago by ankit101.
- christopher
- Offline
- Administrator
Less
More
- Thank you received: 101
6 years 11 months ago #326
by christopher
Replied by christopher on topic saving the mesh in .vol format
There is a difference between the NGSolve mesh (used for FE computations) and the Netgen mesh (from the mesher). When you do
you convert the mesh to a NGSolve mesh, but only the Netgen mesh has the Save function. You can either call Save before this conversion or you can get the Netgen mesh from the NGSolve one by calling
Code:
mesh = Mesh(mesh)
Code:
mesh.ngmesh.Save("newmesh.vol")
Time to create page: 0.095 seconds