Functions

Working with voxel images

FinEtoolsVoxelMesher.VoxelBoxModule.resample!Method
resample!(V::VoxelBoxVolume, resize_ratio)

Resize the voxel box.

  • resize_ratio = if less than one, the voxel will become bigger (subsampling); otherwise the voxels will shrink (super sampling).
FinEtoolsVoxelMesher.VoxelBoxModule.solidboxMethod
solidbox(corner1::Tuple{CoordT, CoordT, CoordT},
    corner2::Tuple{CoordT, CoordT, CoordT}) where {CoordT<:Number}

Solid box with faces aligned with the global Cartesian axes.

FinEtoolsVoxelMesher.VoxelBoxModule.threshold!Method
threshold!(V::VoxelBoxVolume, threshold_value, voxel_below, voxel_above)

Threshold the data.

The data is set to voxel_below if the data is below or equal to threshold_value; otherwise it is set to voxel_above.

Meshing and remeshing

FinEtoolsVoxelMesher.RemesherModule.meshdataMethod
meshdata(self::ImageMesher)

Retrieve the current mesh data.

The three arrays returned are:

  • t = array of tetrahedral connectivities, one row per element,
  • v = array of coordinates of the nodes, one row per vertex,
  • tmid = array of material identifiers, one per element.
FinEtoolsVoxelMesher.RemesherModule.remesh!Function
remesh!(self::ImageMesher, edge_length_ratio = 1.0)

Perform a re-meshing step.

If no mesh exists, the initial mesh is created; otherwise a coarsening sequence of coarsen surface -> smooth -> coarsen volume -> smooth is performed. The current element size (self.currentelementsize) is used. So don't forget to update the current elements size for the next iteration of the re-meshing algorithm.

  • edge_length_ratio = the largest allowed ratio of the lengths of the longest and the shortest edge length in the tetrahedron to be produced by coarsening (default 1.0). If this is supplied as greater than 1.0, for instance 2.0, extra long spikey tetrahedra are prevented.

After meshing the vertices, tetrahedra, and material identifiers, can be retrieved as self.v, self.t, and self.tmid.

FinEtoolsVoxelMesher.TetRemeshingModule.coarsenMethod
coarsen(t::Array{Int, 2}, inputv::Array{Float64, 2}, tmid::Vector{Int}; bv::Vector{Bool} = Bool[], desired_ts::Number = 0.0, stretch::Number = 1.25, nblayer::Int = 1, surface_coarsening::Bool = false, preserve_thin::Bool = false, vertex_weight::Vector{Float64} = Float64[], reportprogress::F = n -> nothing) where {F<:Function}

Coarsen a T4 (tetrahedral) mesh.

Arguments

  • t = array with vertex numbers, one per tetrahedron in each row
  • v = array of vertex coordinates, one per vertex in each row
  • tmid = tetrahedron material identifiers, one per tetrahedron in each row
  • Keyword arguments:
    • bv=array for all vertices in the input array v. Is the vertex on the boundary? True or false. The boundary vertices are in layer 1. The vertex layer numbers increase away from the boundary, and the bigger the vertex layer number the bigger the mesh size.
    • desired_ts=mesh size desired for vertices in layer 1, here mesh size is the length of an edge
    • stretch=the mesh size should increase by this much within one layer of elements, default is 1.25
    • nblayer=number of boundary layers where the mesh size should not increase, default is 1
    • surface_coarsening = is the coarsening intended for the interior or for the surface? default is false, which means the default is coarsening of the interior.
    • preserve_thin= when coarsening the surface, should features which are thin be unaffected by the coarsening? Here thin means consisting of only "surface" vertices.
    • vertex_weight= weight of vertices, one per vertex; weight <= 1.0 is ignored, but weight>1.0 is used to "stretch" edges connected to the vertex. In this way one may preserve certain edges by assigning larger weight to their vertices. Default is vertex_weight= [] (which means ignore the vertex weights)
    • edge_length_ratio = the largest allowed ratio of the lengths of the longest and the shortest edge length in the tetrahedron to be produced by coarsening(default 1.0). If this is supplied as greater than 1.0, for instance 2.0, extra long spikey tetrahedra are prevented.

Output

t, v, tmid = new arrays for the coarsened grid