sdth#
Purpose
Class constructor for SDT handle objects.
Syntax
methods(sdth) % to list methods
Description
The Structural Dynamics Toolbox now supports SDT handles (sdth objects). Currently implemented types for sdth objects are
SDTRoot | global context information used by the toolbox. This object contains reload commands (typically dock opening) that you may want to bypass and only load the data contained in the saved file. To do so, you must create the variable ReloadAsStruct=1; in your base workspace before executing the load command. |
IDopt | identification options (see idopt) |
FeplotFig | feplot figure handle |
IiplotFig | iiplot figure handle |
VectCor | Vector correlation handle (see ii_mac) |
XF | stack pointer (see xfopt) |
SDT handles are wrapper objects used to give easier access to user interface functions. Thus idopt displays a detailed information of current identification options rather than the numeric values really used.
Only advanced programmers should really need access to the internal structure of SDT handles. The fixed fields of the object are opt, type, data, GHandle (if the sdth object is stored in a graphical object), and vfields.
Most of the information is stored in the variable field storage field vfields and a field of vfields is accessible using GetData. To get the model of a cf FeplotFig, you may use the syntax cf.mdl.GetData.
fileutil#
File utilities handles folder search, canonical path resolution, switches between full and relative path, file locking...
- firstdir : wd=sdth.fileutil('firstdir',{wd1,wd2}) gets back the first found directory in the provided list.
- cd : move the current directory to the found folder
- base : assign in base the found folder in variable wd.
- cffile : sdth.fileutil('cffile',fname) gets back the canonical path (mainly resolves symlinks with a unique hard link, relative path features /../, ...)
- abs2rel : [fname,wd]=sdth.fileutil('abs2rel',FileName,root) gets back relative path fname and root if root is an effective root of FileName, else gets back FileName and an empty wd.
- rel2abs : FileName=sdth.fileutil('rel2abs',fname,root) gets back fname if it is already an absolute path, else gets back the concatenation of root and fname.
- fsafe : series of safe file handling commands, checking file existance, HDF5 mode interactions, and locks with fjlockto avoid corruption and potential errors. It also aims at porting usefull linux file commands on Windows platforms.
- save : sdth.fileutil('fsafe','save',fname,'var',....): overloads save function, taking the same arguments after the save token. Lock checks, HDF5 robustness, -append token handling with file preexistence.
- savekeep : sdth.fileutil('fsafe','savekeep',fname,'var',....): same as save command but saves preexistent file with a numeric ending root.
- load : sdth.fileutil('fsafe','load',fname,'var',....): overloads load function, taking the same arguments after the load token. Lock checks, added SDT handles robustness for path changes.
- delete : sdth.fileutil('fsafe','delete',fname): overloads delete function. Lock checks, fail safe.
- move : sdth.fileutil('fsafe','move',fnameOld,fnameNew): alternative movefile command. Lock checks, performs an atomic move using java.nio if available.
- movenoe : sdth.fileutil('fsafe','movenoe',fnameOld,fnameNew): same as move but fail safe.
- printw : sdth.fileutil('fsafe','printw',fname,fmt,strings): integrared print to file. Opens fname in w mode and calls fprintf with fmt and strings. Lock checks.
- tail : st=sdth.fileutil('fsafe','tail',fname,nc): outputs in st the last nc characters of file fname. Efficient alternative to linux command tail on all OSes. Lock checks. Usefull for log file monitoring.
- whos : li=sdt.fileutil('fsafe','whos',fname): overloads whos -file command. Lock and existence checks, HDF5 robustness. If no output is required, quicker and robust display if provided for HDF5 files.
- whosl : li=sdt.fileutil('fsafe','whosl',fname): same as whos but only provides the list of saved variables, very quick for HDF5 files when no more information is required.
- prf : handling of a preferences file in the .prf format. Used to store history data associated to applications. By default, fullfile(sdtdef('tempdir'),'sdt.prf' is used, sdt can be replaced by another rootVal in the command.
- prfset : data=sdth.fileutil('prfget rootVal',name,fmt): reads preference name of format fmt in fullfile(sdtdef('tempdir'),'rootVal.prf'. Supported formats are S for strings and G for real values.
- prfset : sdth.fileutil('prfset rootVal',name,fmt,data): sets preference name of format fmt to data in fullfile(sdtdef('tempdir'),'rootVal.prf'. Supported formats are S for strings and G for real values.
- bashwd : replaces drive names and backslashes for cygwin calls. e.g. O: is replaced by /mnt/o/. cygpath=sdth.fileutil('bashwd',winpath).
- fnlength : truncates a file name of over 200 characters. Replaces all character setover 200 by ___. ftrunc=sdth.fileutil('fnlength',fname).
GetData,-mdl,-rec,-warndel#
This method aims at recovering dereferenced copies of objects, and sort associated handles. It is documented in sdtweb syntax#GetData as its calls are referenced good coding practice.
os, cf.os_, cf.osd_#
os is a short cut method to access comgui objSet.
sdth.os('l.') lists currently loaded OsDic entries. sdth.os('l.Fg') lists a category associated with the first two letters. sdth.os('l.FiCevalz') lists the details of a specific entry.
figure(10);plot([0 1]); sdth.os(10,'ImGrid'); % Apply the ImGrid style using objSet sdth.os('l.im') % List current Im styles ci=iiplot;iicom(ci,'curveInit','Example',demosdt('demoGartteCurve')); ci.osd_('ImGrid','ImLw40') % Apply two styles short cut to command below ci.os_('@OsDic',{'ImGrid','ImLw40'})
urn#
urn, stands for Uniform Resource Name, which are used in SDT to designate and/or select GUI objects (for example sdth.urn('Dock.Id.ci') selects the iiplot figure of the identification dock) or model components (for example sdth.urn('Test.DOF',model) will seek a stack entry called Test in the model then extract the associated .DOF field.
For a more extensive list see sdthurn.
urn.nmap#
Models may contain a .nmap field used to store name maps for nodes, materials, bases, ... examples of usage are given in d_feplot. This field should be a vhandle.nmap object which is a handle associated to maps and more details are given in the documentation of that object but could be a containers.Map object which uses string keys access to values.
findobj[,_sub,...]#
findobj implements objects recovery and implements parsing strategies compatible with subsref and subsasgn formats.
Given a graphical object as a first argument findobj overloads the MATLAB findobj command with added robustness. The call is complemented with a findall call is the fondobj command does find anything. The sytax is then the same as for a classical findobj call, as e.g. gf=sdt.findobj(0,'Type','figure','Tag','feplot').
Further commands provides specific object property handling and subs parsing.
-
_sub implements a string input group parsing strategy into subs format using a splitting symbol and safe group separation by {}, () or "" nesting. This strategy allows exploiting rich string expressions for parameter and procedures processing.
The command syntax accounts for the two characters following _subs. The first character is the splitting token and the second one can be set to
~
not to evaluate parsed content into brackets. Command _subs{} is specific and will use : as splitting character, and will provide a better handling of mainly braces grouped information.Split is performed for each group into braces, brackets or double quotes. Nesting is supported so that the subs output will be levelled by groups, in each subgroup, the entries will be split in the same level using the splitting token.
Groups in double quotes " will not be processed further.
Groups in braces { } will be split.
Groups in brackets( ) will be interpreted or split. Use of @ will be intepreted as a function handle with the higher level. If the group does not start with @ it will be intepreted with eval unless it starts with :. If the _subs command is set with the sixth character as~
the strings will not be evaluated, but they will be split as for braces groups.% split and interpret r1=sdth.findobj('_sub.','nmap.Node(1:5)') r1(3).subs % split and do not interpret r1=sdth.findobj('_sub.~','nmap.Node(1:5)') r1(3).subs % split braces group r1=sdth.findobj('_sub{}','MeshCfg{cube:clamped:sine}') % split colon separated list r2=sdth.findobj('_sub:',r1(2).subs{1}) % split braces group and token separation r1=sdth.findobj('_sub{}','MeshCfg{cube,clamped,sine}') % function handle interpretation in brackets groups r1=sdth.findobj('_sub,','feutilb(@unConSel)') functions(r1.subs)
- _cellgen performs cell label expansion, typically for sensor labels. lab=sdth.findobj('_cellgensplitToken',sList). splitToken provides the delimiter to split the input. sList is a string detailing the generation strategy. A tree based strategy is then used to generate the various labels. Groups between the delimiter can be put into braces to improve readability. Wild cards .* are accepted.
lab=sdth.findobj('_cellgen:','{trans}:{top,bottom}:{X,Y,Z}'); % braces are not mandatory but can improve readability lab=sdth.findobj('_cellgen:','trans:top,bottom:X,Y,Z');
As an additional argument one can provide maps to use wild cards in lists. In such case, matching patters in maps will be expanded. Note that all entries must be matched in the maps in such case.nodeM=vhandle.nmap('Map:Nodes'); nodeM('top1')=1; nodeM('top2')=2; nodeM('bot1')=3; nodeM('bot2')=4; lab=sdth.findobj('_cellgen:','{top*,bot1}:{X,Y,Z}',struct('maps',{{nodeM}}));
- _isClone is dedicated to SDT handleobjects and tells whether the given object is a clone.
- _CloneParent is dedicated to SDT handleobjects and provides the parent handle is the given object is a clone.
See also