How to get the mesh information like element, node

Asked by Meng Qing Xiang

Dear all:
 I want to ask a simple question. If I create a domain, how can I get the mesh information like node number and coordinates, element number and information, just like the description in Page 121 of user's guide. I wish to get a example of how to print these information.

For example, I create a simple domain.
from esys.escript import *
from esys.escript.linearPDEs import Poisson
from esys.finley import Rectangle
import numpy
import matplotlib
import pylab
# generate domain:
mydomain = Rectangle(l0=1.,l1=1.,n0=40, n1=20)

I want the mesh information like below:
# node coordinates:
print("%dD-nodes %d\n"%(dim, numNodes))
for i in range(numNodes):
print("%d %d %d"%(Node_ref[i], Node_DOF[i], Node_tag[i]))
for j in range(dim): print(" %e"%Node[i][j])
print("\n")
# interior elements
print("%s %d\n"%(Element_Type, Element_Num))
for i in range(Element_Num):
print("%d %d"%(Element_ref[i], Element_tag[i]))
for j in range(Element_numNodes): print(" %d"%Element_Nodes[i][j])
print("\n")

Best regards,
Qingxiang

Question information

Language:
English Edit question
Status:
Expired
For:
esys-escript Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Bob (caltinay) said :
#1

There is currently no way of getting the information separately, however there is a function that prints out exactly what you are looking for:

domain.print_mesh_info(True)

Revision history for this message
Meng Qing Xiang (642229461-k) said :
#2

Dear Caltinay, Thank you very much for your help. My question can be solved by parsing the print information.
I want to ask another question, how can I save the mesh information into a file?

Revision history for this message
Launchpad Janitor (janitor) said :
#3

This question was expired because it remained in the 'Open' state without activity for the last 15 days.