Functions
Working with voxel images
FinEtoolsVoxelMesher.VoxelBoxModule.fillsolid!
— Methodfillsolid!(V::VoxelBoxVolume, f::SolidCF, fillvalue::DataT) where {DataT<:Number}
Filled a solid using a solid characteristic function.
FinEtoolsVoxelMesher.VoxelBoxModule.fillvolume!
— Methodfillvolume!(V::VoxelBoxVolume, fillvalue::DataT) where {DataT<:Number}
Fill the volume with a given value.
FinEtoolsVoxelMesher.VoxelBoxModule.pad
— Methodpad(V::VoxelBoxVolume, ipad, jpad, kpad, padvalue)
Pad voxel box with a constant value.
New box is returned.
FinEtoolsVoxelMesher.VoxelBoxModule.resample!
— Methodresample!(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.solidbox
— Methodsolidbox(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.solidellipsoid
— Methodsolidellipsoid(center::Tuple{CoordT, CoordT, CoordT}, a::CoordT, b::CoordT, c::CoordT) where {CoordT<:Number}
Solid ellipsoid.
FinEtoolsVoxelMesher.VoxelBoxModule.solidhalfspace
— Methodsolidhalfspace(center::Tuple{CoordT, CoordT, CoordT},
normal::Tuple{CoordT, CoordT, CoordT}) where {CoordT<:Number}
Solid halfspace.
FinEtoolsVoxelMesher.VoxelBoxModule.solidsphere
— Methodsolidsphere(center::Tuple{CoordT, CoordT, CoordT}, r::CoordT) where {CoordT<:Number}
Solid sphere.
FinEtoolsVoxelMesher.VoxelBoxModule.threshold!
— Methodthreshold!(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
.
FinEtoolsVoxelMesher.VoxelBoxModule.trim!
— Methodtrim!(V::VoxelBoxVolume, emptyvalue)
Trim off pieces of the volume that consist only of the empty value.
FinEtoolsVoxelMesher.VoxelBoxModule.voxeldims
— Methodvoxeldims(V::VoxelBoxVolume)
Compute the dimensions of the voxels.
FinEtoolsVoxelMesher.VoxelBoxModule.vtkexport
— Methodvtkexport(theFile::String, V::VoxelBoxVolume{CoordT,DataT}) where {CoordT<:Number,DataT<:Number}
Compute.
Meshing and remeshing
FinEtoolsVoxelMesher.RemesherModule.currentelementsize
— Methodcurrentelementsize(self::ImageMesher)
Retrieve the current element size.
FinEtoolsVoxelMesher.RemesherModule.meshdata
— Methodmeshdata(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!
— Functionremesh!(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.RemesherModule.updatecurrentelementsize!
— Methodupdatecurrentelementsize!(self::ImageMesher, newcurrentelementsize)
Update the current element size.
FinEtoolsVoxelMesher.RemesherModule.volumes
— Methodvolumes(self::ImageMesher)
Compute tetrahedral volumes in the current mesh.
FinEtoolsVoxelMesher.TetRemeshingModule.coarsen
— Methodcoarsen(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 rowv
= array of vertex coordinates, one per vertex in each rowtmid
= 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 edgestretch
=the mesh size should increase by this much within one layer of elements, default is 1.25nblayer
=number of boundary layers where the mesh size should not increase, default is 1surface_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 isvertex_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