160. apps.BifMesh — Vascular Bifurcation Sweeping Mesher

160.1. Functions defined in module apps.BifMesh

apps.BifMesh.structuredQuadMeshGrid(sgx=3, sgy=3, isopquad=None)[source]

Returns nodes (2D) and elems of a structured quadrilateral grid.

nodes and elements are both ordered first vertically (y) and then horizontally (x). This function is the equivalent of simple.rectangularGrid but on the mesh level.

apps.BifMesh.structuredHexMeshGrid(dx, dy, dz, isophex='hex64')[source]

Build a structured hexahedral grid

with nodes and elements both numbered in a structured way: first along z, then along y,and then along x. The resulting hex cells are oriented along z. This function is the equivalent of simple.rectangularGrid but for a mesh. Additionally, dx,dy,dz can be either integers or div (1D list or array). In case of list/array, first and last numbers should be 0.0 and 1.0 if the desired grid has to be inside the region 0.,0.,0. to 1.,1.,1. TODO: include other optons to get the control points for other isoparametric transformation for hex.

apps.BifMesh.findBisectrixUsingPlanes(cpx, centx)[source]

returns a bisectrix-points at each point of a Polygon

(unit vector of the bisectrix). All the bisectrix-points are on the side of centx (inside the Polygon), regardless to the concavity or convexity of the angle, thus avoiding the problem of collinear or concave segments. The points will point toward the centx if the centx is offplane. It uses the lines from intersection of 2 planes.

apps.BifMesh.cpBoundaryLayer(BS, centr, issection0=False, bl_rel=0.2)[source]

it takes n points of a nearly circular section

(for the isop transformation, n should be 24, 48 etc) and find the control points needed for the boundary layer. The center of the section has to be given separately. -issection0 needs to be True only for the section-0 of each branch of a bifurcation, which has to share the control points with the other branches. So it must be False for all other sections and single vessels. This implementation for the bl (separated from the inner lumen) is needed to ensure an optimal mesh quality at the boundary layer in terms of angular skewness, needed for WSS calculation.

apps.BifMesh.cpQuarterLumen(lumb, centp, edgesq=0.75, diag=0.848528137423857, verbos=False)[source]

control points for 1 quarter of lumen mapped in quad regions.

lumb is a set of points on a quarter of section. centp is the center of the section. The number of poin I found that edgesq=0.75, diag=0.6*2**0.5 give the better mapping. Also possible edgesq=0.4, diag=0.42*2**0.5. Currently, it is not perfect if the section is not planar.

apps.BifMesh.visualizeSubmappingQuadRegion(sqr, timewait=None)[source]

visualilze the control points (-1,16,3) in each submapped region

and check the quality of the region (which will be inherited by the mesh crossectionally)

apps.BifMesh.cpOneSection(hc, oc=None, isBranchingSection=False, verbos=False)[source]

What is this

hc is a numbers of points on the boundary line of 1 almost circular section. oc is the center point of the section. It returns 3 groups of control points: for the inner part, for the transitional part and for the boundary layer of one single section

apps.BifMesh.cpAllSections(HC, OC, start_end_branching=[False, False])[source]

control points of all sections

divided in 3 groups of control points: for the inner part, for the transitional part and for the boundary layer. if start_end_branching is [True,True] the first and the last section are considered bifurcation sections and therefore meshed differently.

apps.BifMesh.cpStackQ16toH64(cpq16)[source]

sweeping trick: from sweeping sections longitudinally to mapping hex64: ittakes -1,16,3 (cp of the quad16) and groups them in -1,64,3 (cp of the hex63) but slice after slice: [0,1,2,3],[1,2,3,4],[2,3,4,5],… It is a trick to use the hex64 for sweeping along an arbitrary number of sections.

apps.BifMesh.mapHexLong(mesh_block, cpvr)[source]

map a structured mesh (n_block, e_block, cp_block are in mesh_block)

into a volume defined by the control points cpvr (# regions longitudinally, # regions in 1 cross sectionsm, 64, 3 ). cp_block are the control points of the mesh block. It returns nodes and elements. Nodes are repeated in subsequently mapped regions ! TRICK: in order to make the mapping working for an arbitrary number of sections the following trick is used: of the whole mesh_block, only the part located between the points 1–2 is meshed and mapped between 2 slices only. Thus, the other parts 0–1 and 2–3 are not mapped. To do so, the first and the last slice need to be meshed separately: n_start 0–1 and n_end 2–3.

apps.BifMesh.mapQuadLong(mesh_block, cpvr)[source]

TRICK: as above

apps.BifMesh.getData(*args)[source]

Return global data

apps.BifMesh.getDataItem(data, item)[source]

Return an item from a dict

apps.BifMesh.drawOption(item)[source]

Return draw option

apps.BifMesh.sliceData(item)[source]

Return slice data

apps.BifMesh.longestItem(geomlist)[source]

Return the geometric part with the most elements.

apps.BifMesh.largestSubMesh(M)[source]

Return the largest part with single prop value.

apps.BifMesh.selectPart(M, x0, x1)[source]

Select part of section between x0 and x1

section is a list of Mesh objects. All meshes are clipped to the parts between planes through x0 and x1 perpendicular to the line x0-x1. The mesh with the largest remaining part is returned.

apps.BifMesh.cutPart(M, x0, x1)[source]

Cut part of section at plane thru x0 and return part between x0 and x1

apps.BifMesh.getPart(section, x0, x1, cutat=-1)[source]

Return a cut or a selected part, depending on cutat parameter.

apps.BifMesh.connectPolyLines(plist)[source]

Connect a set of PolyLines into a single one.

The PolyLines are connected in order of the distance between the endpoints.

apps.BifMesh.meshList(coords, elems)[source]

Create a list of Meshes from intersection lines

apps.BifMesh.meshToPolyLine1(m)[source]

Convert a 2-plex mesh with ordered segments to a PolyLine.

apps.BifMesh.meshToPolyLine2(m2)[source]

Convert a 2-plex mesh with ordered segments to a PolyLine.

apps.BifMesh.slicer(S, s0, s1, cutat=-1, visual=False)[source]

Cut a surface with a series of planes.

  • S: surface

  • s0,s1: Coords arrays with the same number of points

Each pair of corresponding points of s0 and s1 defines a plane parallel to the z-axis

apps.BifMesh.sliceBranch(S, cp, s0, s1, cl, nslices)[source]

Slice a single branch of the bifurcation

  • S: the bifurcation surface, oriented parallel to xy.

  • cp : the center of the bifurcation.

  • s0, s1: the control polylines along the branch.

  • cl: the centerline of the branch.

  • nslices: the number of slices used to approximate the branch surface.

apps.BifMesh.sliceIt()[source]

Slice a surface using the provided slicing data

apps.BifMesh.inputLongitudinalSeeds()[source]

Interactive input of the longitudinal meshing seeds.

nseeds = number of seeds in zone0 and zone1 zonesizes are the zone sizes in percentages transition zone is seeded using an approximated geometrical series

apps.BifMesh.seedLongSplines(H, at, curvedSection=True, nPushedSections=6, napproxlong=40, napproxcut=40)[source]

Takes the Longitudinal Splines (6 semi-braches, 12 longitudinal_splines)

and return the control points on them (n_long, n_cross=24) and on the centerlines (n_long).

apps.BifMesh.meshBranch(HC, OC, nlong, ncirc, ntr, nbl)[source]

Convenient function: from sections and centerlines to parametric volume

mesh and outer surface mesh.

apps.BifMesh.inputMeshingParameters()[source]

Dialog for input of the meshing parameters.

apps.BifMesh.sweepingMesher()[source]

Sweeping hexahedral bifurcation mesher

Creates a hexahedral mesh inside the branches of the bifurcation. Currently only the lumen mesh is included in this GPL3 version.

apps.BifMesh.divideControlLines()[source]

Divide the control lines.

apps.BifMesh.center2D(x, x0, x1)[source]

Find the center of the section x between the points x0 and x1

apps.BifMesh.centerline2D(S, s0, s1)[source]

Find the centerline of a tubular surface.

  • S: a tubular surface

  • s0,`s1`: helper polylines on opposing sides of the surface.

apps.BifMesh.extendedCenterline(cl, s0, s1, cp)[source]

Extend the center line to the central point.

cl: center line s0,s1: helper lines cp: central point.

Each center line gets two extra points at the start: the central point and a point on the bisectrix at half distance.

apps.BifMesh.inputDrawOptions()[source]

Input the drawing options

apps.BifMesh.inputSlicingParameters()[source]

Input the slicing parameters

apps.BifMesh.createBranches(branch)[source]

Create the branch control lines for the input lines.

apps.BifMesh.inputCentralPoint()[source]

Fix the central point of the bifurcation

apps.BifMesh.inputControlLines()[source]

Enter six polyline paths in counterclockwise direction.

apps.BifMesh.drawCSys(ax=Formex([[[1., 0., 0.]], [[0., 1., 0.]], [[0., 0., 1.]], [[0., 0., 0.]]], dtype=float32), color='black')[source]

draws the coordinate system with origin in ax[0]

and directions determined by the 3 points in ax[1:4]

apps.BifMesh.updateData(data, newdata)[source]

Update the input data fields with new data values