# 34. `plugins.bifmesh` — Vascular Sweeping Mesher

## 34.1. Functions defined in module plugins.bifmesh

`plugins.bifmesh.``structuredQuadMeshGrid`(sgx=3, sgy=3, isopquad=None)

  it returns nodes (2D) and elems of a structured quadrilateral grid. nodes and elements are both ordered first vertically (y) and then orizontally (x). This function is the equivalent of simple.rectangularGrid but on the mesh level.

`plugins.bifmesh.``structuredHexMeshGrid`(dx, dy, dz, isophex='hex64')

  it builds 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.

`plugins.bifmesh.``findBisectrixUsingPlanes`(cpx, centx)

  it 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 towards the centx if the centx is offplane. It uses the lines from intersection of 2 planes.

`plugins.bifmesh.``cpBoundaryLayer`(BS, centr, issection0=False, bl_rel=0.2)

  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.

`plugins.bifmesh.``cpQuarterLumen`(lumb, centp, edgesq=0.75, diag=0.848528137423857, verbos=False)

  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.

`plugins.bifmesh.``visualizeSubmappingQuadRegion`(sqr, timewait=None)

  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)

`plugins.bifmesh.``cpOneSection`(hc, oc=None, isBranchingSection=False, verbos=False)

  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

`plugins.bifmesh.``cpAllSections`(HC, OC, start_end_branching=[False, False])

  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.

`plugins.bifmesh.``cpStackQ16toH64`(cpq16)

  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.

`plugins.bifmesh.``mapHexLong`(mesh_block, cpvr)

  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.

`plugins.bifmesh.``mapQuadLong`(mesh_block, cpvr)

  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.