Generating Node Files
eharetea

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,zFileName="newNode.node"):
   BaseName FileName.replace('.node','')
   min(map(len, [x,y,z]))
   open(FileName'w')
   # point set cardinality, dimension, num attributes, boundary markers
   f.write("%d %d %d %d\n" % (n301))
   for (numxpt,ypt,zptin zip(range(n), x,y,z):
       f.write("%d\t%f\t%f\t%f\t%d\n" % (numxptyptzpt1))
   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():
  = [00.510.51,  00,   00.5,  11,    10.5,  0]
  = [00,   00.51,  10.500,    00.5,  11,    1]
  = [00,   00,   0,  00.511,    11,    11,    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
Creative Commons License
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