Contents

On this page


triellipt.amr

Mesh refinement tools.

getunit()

triellipt.amr.getunit(mesh)

Creates an AMR unit.

Parameters

mesh : TriMesh

Input triangle mesh.

Returns

AMRUnit

AMR unit with the mesh.

AMRUnit

class triellipt.amr.AMRUnit(mesh)

Mesh refinement unit.

Attributes

mesh : TriMesh

Current triangle mesh.

data : dict

Data defined on the unit.

Properties

Name Description
refiner Data-refiner after refinement.
collector Data-collector after coarsening.

refine()

AMRUnit.refine(self, trinums=None)

Performs a static mesh refinement.

Parameters

trinums : Iterable = None

Numbers of triangles to refine, if None takes all triangles.

Returns

AMRUnit

Unit with the refined mesh.

Notes

coarsen()

AMRUnit.coarsen(self, trinums_cores)

Performs a static mesh coarsening.

Parameters

trinums_cores : Iterable

Numbers of the super-triangle-cores to coarsen.

Returns

AMRUnit

Unit with the coarsened mesh.

Notes

find_node()

AMRUnit.find_node(self, anchor)

Finds the neighborhood of an anchor point.

Parameters

anchor : (float, float)

Coordinates of an anchor point.

Returns

flat-int-array

Numbers of triangles near the anchor point.

find_subset()

AMRUnit.find_subset(self, count, anchor, remove_heads=False)

Finds a convex subset of a mesh.

Parameters

count : int

Seed number of triangles in a subset.

anchor : (float, float)

Anchor point for a starting triangle.

remove_heads : bool = False

Removes single-paired triangles, if True.

Returns

flat-int-array

Numbers of triangles in a subset.

find_masked()

AMRUnit.find_masked(self, mask)

Finds triangles by a mask-function.

Parameters

mask : function

Boolean mask (x, y) on the triangles centroids.

Returns

flat-int-array

Numbers of the found triangles.

front_coarse()

AMRUnit.front_coarse(self)

Finds a front of coarse triangles.

front_fine()

AMRUnit.front_fine(self)

Finds a front of fine triangles.

from_func()

AMRUnit.from_func(self, func)

Creates data from a function.

Parameters

func : Callable

Function to create data.

Returns

flat-float-array

Data defined on mesh nodes.

constrain()

AMRUnit.constrain(self, data)

Constrains data on hanging nodes.

Parameters

data : float-flat-array

Input data defined on mesh nodes.

Returns

float-flat-array

Constrained data.

getinterp()

AMRUnit.getinterp(self, xnodes, ynodes)

Creates an interpolator on a mesh.

Parameters

xnodes : flat-float-array

x-coordinates of the interpolation nodes.

ynodes : flat-float-array

y-coordinates of the interpolation nodes.

Returns

TriInterp

Callable interpolator.

Notes

TriInterp object has the following attributes:

TriInterp() takes nodes-data and returns interpolated one.

TriFront

class triellipt.amr.TriFront(unit=None, data=None)

Front of triangles.

Properties

Name Description
trinums Indices of the front-facing triangles.
voidnums Indices of void triangles in the front.

atrank()

TriFront.atrank(self, rank)

Selects the front with the specified rank.

angles()

TriFront.angles(self)

Computes the orientation angles of the front.

Returns

flat-float-array

Angles between the voids and the front centroids.

scales()

TriFront.scales(self)

Computes the normalized front scales.

Returns

flat-float-array

Normalized distances between the front centroids and voids.

filter_by_mask()

TriFront.filter_by_mask(self, mask)

Filters the front by the mask.

Parameters

mask : function

Boolean mask (x, y) on the triangles centroids.

Returns

TriFront

New front.

filter_by_angle()

TriFront.filter_by_angle(self, angmin, angmax)

Filters the front by the orientation angles.

filter_by_scale()

TriFront.filter_by_scale(self, minval, maxval)

Filters the front by the scales.

join_meshes()

triellipt.amr.join_meshes(mesh1, mesh2, tol=None)

Join the meshes along a shared boundary, if available.

Parameters

mesh1 : TriMesh

1-st input mesh.

mesh2 : TriMesh

2-nd input mesh.

tol : int = None

Absolute tolerance in decimal places for detecting nearby points.

Returns

TriMesh | None

New mesh or None, if failed.

Copyright © 2023, Igor Semenov.