Mesh
DefineRectGrid
- DefineRectGrid(CSX, deltaUnit, mesh);
Full definition:
function CSX = DefineRectGrid(CSX, deltaUnit, mesh);
Create a rectiliniear grid.
example Cartesian mesh:
CSX = InitCSX();
mesh.x = AutoSmoothMeshLines([0 a], 10);
mesh.y = AutoSmoothMeshLines([0 b], 10);
mesh.z = AutoSmoothMeshLines([0 length], 15);
CSX = DefineRectGrid(CSX, unit,mesh);
example Cylindrical mesh:
CSX = InitCSX('CoordSystem',1);
mesh.r = AutoSmoothMeshLines([0 a], 10);
mesh.a = AutoSmoothMeshLines([0 2*pi], pi/30);
mesh.z = AutoSmoothMeshLines([-length 0 length], 15);
CSX = DefineRectGrid(CSX, unit,mesh);
See also InitCSX, SmoothMesh, AutoSmoothMeshLines, DetectEdges
author: Thorsten Liebig
SmoothMesh
- SmoothMesh(mesh, max_res, <ratio, varargin>)
Full definition:
function [mesh] = SmoothMesh( mesh, max_res, <ratio, varargin>)
Convienent function to create a smooth mesh in all directions. Generate smooth mesh by choosing an appropriate algorithm in each direction.
Currently supported smoothing algorithm: SmoothMeshLines, SmoothMeshLines2 and RecursiveSmoothMesh
arguments:
lines: given fixed lines to create a smooth mesh in between
max_res: scalar or vector of desired max. allowed resolution
ratio: grading ratio: scalar or vector of desired neighboring line-delta ratio (optional, default is 1.5) - see also ‘allowed_max_ratio’ argument
variable arguments (‘keyword’,value):
algorithm: define subset of tried algorihm, e.g. [1 3]
symmetric: 0/1 force symmetric mesh (default is input symmetry)
homogeneous: 0/1 force homogeneous mesh
allowed_min_res: allow a given min resolution only
allowed_max_ratio: allow only a given max. grading ratio (default –> ratio*1.25)
debug: 0/1 off/on
example:
mesh.x = [-BoundBox 0 BoundBox];
mesh.y = [-BoundBox 0 BoundBox];
mesh.z = [0 BoundBox];
mesh = SmoothMesh(mesh, lambda/20/unit);
CSX = DefineRectGrid(CSX, unit, mesh);
See also AutoSmoothMeshLines, InitCSX, DefineRectGrid, DetectEdges
author: Thorsten Liebig (C) 2012
SmoothMeshLines
- SmoothMeshLines(lines, max_res, ratio, varargin)
Full definition:
function lines = SmoothMeshLines( lines, max_res, ratio, varargin)
create smooth mesh lines
Warning: This function may not always produce a desired output.
lines: given fixed lines to create a smooth mesh in between
max_res: desired max. resolution
ratio: max. neighboring line-delta ratio, (optional, default is 1.3)
optional variable arguments (‘key’, value)
recursive: SmoothMeshLines a couple of times recursivly (default is 0)
CheckMesh: Do a final mesh check (default is true)
allowed_max_ratio: allow only a given max. grading ratio (default –> ratio*1.25)
example:
% create a x-mesh with lines at 0, 50 and 200 an a desired mesh
resolution of 5
mesh.x = SmoothMeshLines([0 50 200],5,1.3);
See also InitCSX, DefineRectGrid
author: Thorsten Liebig
SmoothMeshLines2
- SmoothMeshLines2(lines, max_res[, ratio, varargin])
Full definition:
lines = SmoothMeshLines2( lines, max_res [, ratio, varargin] )
Create smooth mesh lines.
input:
lines: 1xn vector of (fixed) mesh lines
max_res: maximum distance between any two lines (e.g. lambda/10)
ratio: (optional) default: 1.3
optional variable arguments (‘key’, value)
CheckMesh: Do a final mesh check (default is true)
allowed_max_ratio: allow only a given max. grading ratio (default –> ratio*1.25) output:
lines: 1xn vector of (smoothed) mesh lines
example:
mesh.x = [0 100 2300 2400];
mesh.x = SmoothMeshLines2( mesh.x, 43 );
todo:
if gaps cannot be completely filled because of the ratio restriction, the spacing is not optimal. SmoothRange() needs to be optimized.
SmoothRange() has special handling if stop_taper is to long; can this also happen for start_taper?
(C) 2010 Sebastian Held sebastian.held@uni-due.de See also SmoothMeshLines
AutoSmoothMeshLines
- AutoSmoothMeshLines(lines, max_res, ratio, varargin)
Full definition:
function [lines quality] = AutoSmoothMeshLines( lines, max_res, ratio, varargin)
Generate smooth mesh lines by choosing an appropriate algorithm.
Currently supported algorithm: SmoothMeshLines, SmoothMeshLines2 and RecursiveSmoothMesh
arguments:
lines: given fixed lines to create a smooth mesh in between
max_res: desired max. resolution
ratio: grading ratio: desired neighboring line-delta ratio
default is 1.5
see also ‘allowed_max_ratio’ argument
variable arguments (‘keyword’,value):
algorithm: define subset of tried algorihm, e.g. [1 3]
symmetric: 0/1 force symmetric mesh (default is input symmetry)
homogeneous: 0/1 force homogeneous mesh
allowed_min_res: allow a given min resolution only
allowed_max_ratio: allow only a given max. grading ratio (default –> ratio*1.25)
debug: 0/1 off/on
example:
lines = AutoSmoothMeshLines([-100 -10 10 100], 20, 1.5, 'algorihm', ...
1:3);
See also InitCSX, DefineRectGrid
author: Thorsten Liebig (C) 2012
RecursiveSmoothMesh
- RecursiveSmoothMesh(fixedMeshPoints, max_res, ratio, varargin)
Full definition:
function resultMeshPoints = RecursiveSmoothMesh(fixedMeshPoints, max_res, ratio, varargin)
RecursiveSmoothMesh: This function tries to generate an optimal mesh between the given fixedMeshPoints. The space between the fixed points is filled with the largest possible mesh step size considdering mesh max resolution and mesh increase/decrease ratio.
Algorithm: Mesh creation is done via a simple try and error approach: The next mesh point could be between lastDistance*ratio and lastDistance/ratio away from the last mesh point. If a fixed mesh point exist in this distance, this point is used. If there is a fixed mesh point below this distance, the last (determined) mesh point is wrong, go back and try with a mesh point a few mm below. (If that is not possible because the distance to the mesh point behind the last point is to low, also update this mesh point). The algorithm seems to work very well, except if the ratio is to low. At a value of 1.2, the calculation takes a very long time.
Parameter:
fixedMeshPoints: List containing points at which a mesh line should appear
max_res: Maximum distance between two mesh lines
ratio: Maximum grading ratio between two neighbour mesh lines
optional variable arguments (‘key’, value):
CheckMesh: Do a final mesh check (default is true)
allowed_max_ratio: allow only a given max. grading ratio (default –> ratio*1.25)
Returns:
resultMeshPoints: List containing the positions of all mesh lines. If a empty list is returned, no resolution could be found.
Author: Florian Pfanner Date: 28.09.2012
DetectEdges
- DetectEdges(CSX <, mesh, varargin>)
Full definition:
mesh = DetectEdges(CSX <, mesh, varargin>)
Returns a mesh with the edges added of certain (see below) primitives found in the CSX structure.
optional arguments:
mesh: add edges to an existing (predefined) mesh
optional: ‘keyword’, value
‘Debug’ enable debug mode (default is 1)
‘AddPropertyType’ add a list of additional property types to detect e.g. ‘DumpBox’ or {‘DumpBox’,’ProbeBox’}
‘SetPropertyType’ set the list of property types to detect (override default) e.g. ‘Metal’ or {‘Metal’,’ConductingSheet’}
‘ExcludeProperty’ give a list of property names to exclude from detection
‘SetProperty’ give a list of property names to handly exlusively for detection
advanced options: ‘keyword’, value
‘2D_Metal_Edge_Res’ define a one-third/two-third metal edge resolution
example:
CSX = InitCSX();
% define all properties and primitives to detect
% ...
% ...
mesh = DetectEdges(CSX);
mesh = SmoothMesh(mesh, lambda/20/unit);
CSX = DefineRectGrid(CSX, unit, mesh);
Note:
Only primitives contained in Metal, Material, Excitation, LumpedElement or ConductingSheet properties are processed
Currently this function handles only Box, Polygons, LinPoly and Cylinder.
author: Koen De Vleeschauwer (c) 2012 modified by: Thorsten Liebig (c) 2012, 2013
See also InitCSX, SmoothMesh, DefineRectGrid
AnalyseMesh
- AnalyseMesh(lines)
Full definition:
function results = AnalyseMesh(lines)
Analyse a given mesh line vector
output structure:
results.numLines: number of lines
results.max_res: max. resolution found
results.min_res: min. resolution found
results.max_ratio: max. grading ratio found
results.homogeneous: true/false for homogeneous mesh
results.symmetric: true/false for symmetric mesh
author: Thorsten Liebig (C) 2012
CheckMesh
- CheckMesh(lines, min_res, max_res, ratio, be_quiet)
Full definition:
function [EC pos E_type] = CheckMesh(lines, min_res, max_res, ratio, be_quiet)
Check if mesh lines are valid
parameter:
min_res: minimal allowed mesh-diff
max_res: maximal allowed mesh-diff
ratio: maximal allowed mesh-diff ratio
be_quiet: disable warnings
return:
EC: error code (number of found errors)
pos: line positions with error
E_type: error type
author: Thorsten Liebig