proteus.TriangleUtils module

A collection of functions for manipulating triangleWrappers interface to Shewchuk’s Triangle package. There are a couple of different groups of functions.

One is for writing out triangleWrappers data arrays in Triangle’s fileformat

Inheritance diagram of proteus.TriangleUtils

proteus.TriangleUtils.writeOutTriangulation(tri, filebase='mesh', nbase=0, verbose=0)[source]

collect necessary steps to write out files for triangle data structures

proteus.TriangleUtils.printNodeFile(nodes, filebase='mesh', attrib=None, markers=None, nbase=0)[source]

print out nodes in triangle format, nbase is the numbering base

file format that triangle is expecting

First line: <# of vertices> <dimension (must be 2)> <# of attributes> <# of boundary markers (0 or 1)>

Remaining lines: <vertex #> <x> <y> [attributes] [boundary marker]

proteus.TriangleUtils.printElemFile(elems, filebase='mesh', attrib=None, nbase=0)[source]

print out triangles/elements in the mesh

file format that triangle is expecting First line: <# of triangles> <nodes per triangle> <# of attributes> Remaining lines: <triangle #> <node> <node> <node> ... [attributes]

proteus.TriangleUtils.printPolyFile(nodes, segments, filebase='mesh', pattrib=None, pmarkers=None, smarkers=None, holes=None, regions=None, nbase=0)[source]

print out mesh info in triangle’s poly format, nbase is the numbering base

First line: <# of vertices> <dimension (must be 2)> <# of attributes> <# of boundary markers (0 or 1)> Following lines: <vertex #> <x> <y> [attributes] [boundary marker] One line: <# of segments> <# of boundary markers (0 or 1)> Following lines: <segment #> <endpoint> <endpoint> [boundary marker] One line: <# of holes> Following lines: <hole #> <x> <y> Optional line: <# of regional attributes and/or area constraints> Optional following lines: <region #> <x> <y> <attribute> <maximum area>

proteus.TriangleUtils.printAreaFile(elemAreas, filebase='mesh', nbase=0)[source]

print out area constraints

file format that triangle is expecting First line: <# of triangles> Remaining lines: <triangle #> <maximum area>

note, negative area means that the area is unconstrained

proteus.TriangleUtils.printEdgeFile(edges, filebase='mesh', markers=None, nbase=0)[source]

print out edges in the mesh

file format that triangle is expecting First line: <# of edges> <# of boundary markers (0 or 1)> Following lines: <edge #> <endpoint> <endpoint> [boundary marker]

proteus.TriangleUtils.printNeighborFile(neigs, filebase='mesh', nbase=0)[source]

print out elment neighbors in the mesh

file format that triangle is expecting First line: <# of triangles> <# of neighbors per triangle (always 3)> Following lines: <triangle #> <neighbor> <neighbor> <neighbor>

class proteus.TriangleUtils.TriangleInputFileReader(verbose=0)[source]

collect format strings, specifiers and routines in a class so that I can keep track of them better

just specifies a collection of fixed format strings for the various input file formats allowed

readNodes(filebase, commchar='#', nbase=0, verbose=0)[source]

read nodes specified in Triangle format see recordFormatDoc for format info

returns dataInfo holding basic info about data read and array of data read

data[0] = nodes data[1] = node attributes data[1] = node markers

readTriangles(filebase, commchar='#', nbase=0, verbose=0)[source]

read triangles specified in Triangle format see recordFormatDoc for format info

returns dataInfo holding basic info about data read and array of data read

data[0] = triangles data[1] = triangle attributes

readPoly(filebase, commchar='#', nbase=0, verbose=0)[source]

read nodes, segments, holes, and regions specified in Triangle format see recordFormatDoc for format info

returns dataInfo holding basic info about data read and array of data read

this function is more tedious because of variations in input formats