proteus.TriangleTools module

Collect functionality to make a lightweight interface for Shewchuk’s Triangle package. Follow the ellipt2d example in some respects

Inheritance diagram of proteus.TriangleTools

class proteus.TriangleTools.TriangleBaseMesh(baseFlags='zen', nbase=0, verbose=0)[source]

A triangulation interface wrapper.

This is a wrapper for the triangulation interface that can create a triangle mesh in different ways

  • from .ele and .node files
  • from a .poly file
  • from a proteus mesh

It should also be able to generate a proteus mesh from the triangle representation and allow the user to access the basic data arrays in triangle

initialize the triangulation object, keep track of what numbering scheme it uses, create a base set of flags for triangulate (e.g., z if using base 0)

does not create a Voronoi diagram by default

resetDefaultTrirep(index=0, verbose=0)[source]

reset the Triangle mesh representation if it has been set to something nontrivial

resetDefaultVorrep(index=0, verbose=0)[source]

reset the Triangle mesh Voronoi representation if it has been set to something nontrivial

convertToProteusMesh(verbose=0)[source]

Generate a representation in the format expected by proteus.

Need to make sure the triangle mesh has generated
nodes elements (triangles) edges neighbors
First set the _global arrays for
nodes elements
convertFromProteusMesh(meshin, verbose=0)[source]

generate a Triangle mesh representation from an proteus mesh. This version will copy over the nodes and elements from the proteus mesh.

Deletes the existing Triangle mesh and regenerates.

readFromNodeFile(filebase, flagsAdd='', verbose=0)[source]

read triangle representation from filebase.node files. assumes the nbase data member is set appropriately

readFromNodeAndEleFiles(filebase, flagsAdd='', verbose=0)[source]

read triangle representation from filebase.node and filebase.ele files. assumes the nbase data member is set appropriately

readFromPolyFile(filebase, flagsAdd='', verbose=0)[source]

Reads in the triangle representation from filebase.poly file.

Parameters:
  • filebase (str) – The filename with the triangluation.
  • flagsAdd (str) –
  • verbose (int) – A flag indicating how much information to pipe to stdout.

Notes

Function assumes the nbase data member is set appropriately.

writeToFile(filebase, verbose=0)[source]

Just write out basic files for triangulateion Still need to write out Voronoi diagram

viewShowme()[source]

just call showme for the mesh held in rep, uses meshshow-tmp file

proteus.TriangleTools.TriangleCall3(filebase='trimesh', baseFlags='zen', flagsAdd='', verbose=0)[source]
proteus.TriangleTools.exProteusMesh0(filebase='trimesh', baseFlags='zen', flagsAdd='', viewMesh=1, verbose=0)[source]

create a Triangle mesh representation read it in from a file and initialize convert to an proteusMesh

proteus.TriangleTools.exProteusMesh1(baseFlags='zen', viewMesh=1, verbose=0)[source]

create an proteusMesh for a rectangle create a Triangle mesh representation convert the proteusMesh mesh to the Triangle mesh representation

proteus.TriangleTools.exProteusLaplace1(filebase='trimesh', baseFlags='zen', flagsAdd='', viewMesh=1, verbose=0)[source]
proteus.TriangleTools.testGenerateTriangulationFromPointSet(points)[source]

input: point-set

generate triangle representation of the points

output: an array contaning the points, and element to Node connectivity

proteus.TriangleTools.testGenerateSSIPtriangulation(points)[source]

input: vertices and SSIP points belonging to a single element

generate triangle representation of the points

output: an array contaning the points, and element quadrature weights for the points

test with input

import numpy from proteus import TriangleTools points = numpy.array([[0.0,0.0,0.0],[0.5,0.4,0.],[1.0,0.0,0.0],[0.2,0.3,0.0],[0.0,1.0,0.0]]) dV,x = TriangleTools.testGenerateSSIPtriangulation(points)