This generates .node files and runs pyramid on them.
Creates .node files.
Date Created:Monday February 23rd, 2009 11:11 PM
Date Modified:Monday February 23rd, 2009 11:18 PM
#
# Author: Dan Lynch
#
# Writes node files!
#
def makeNode(x,y,z, FileName="newNode.node"):
BaseName = FileName.replace('.node','')
n = min(map(len, [x,y,z]))
f = open(FileName, 'w')
# point set cardinality, dimension, num attributes, boundary markers
f.write("%d %d %d %d\n" % (n, 3, 0, 1))
for (num, xpt,ypt,zpt) in zip(range(n), x,y,z):
f.write("%d\t%f\t%f\t%f\t%d\n" % (num, xpt, ypt, zpt, 1))
f.close()
eleWriteRead(BaseName)
def eleWriteRead(BaseName):
getTerm('%s %s%s' % ("pyramid",BaseName,".node"))
print "Here is the ele file:"
print readFile('%s%s' % (BaseName, ".1.ele"))
print "Here is the node file:"
print readFile('%s%s' % (BaseName, ".1.node"))
getTerm('%s %s%s' % ('showme', BaseName, ".1.ele"))
def getTerm(string):
from commands import getstatusoutput as GS
lines = GS(string)
for line in lines[1].split('\n'):
print line
def readFile(FileName):
return open(FileName).read()
def boxCoords():
l = [0, 0.5, 1, 0.5, 1, 0, 0, 0, 0.5, 1, 1, 1, 0.5, 0]
m = [0, 0, 0, 0.5, 1, 1, 0.5, 0, 0, 0, 0.5, 1, 1, 1]
n = [0, 0, 0, 0, 0, 0, 0.5, 1, 1, 1, 1, 1, 1, 1]
return [l,m,n]
def Test():
(x,y,z) = boxCoords();
makeNode(x,y,z)
Downloads:
Download: node.py 1 KB
Please login or Click Here to register for downloads
Generating Node Files by Dan Lynch
is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
Based on a work at www.3daet.com
Permissions beyond the scope of this license may be available at http://www.3daet.com
