ENH: Update shell completers
[freefoam.git] / data / shellFunctions / zshCompletion / _freefoam
blob3816f4b99b0f458d38975692b17c0db93467e3e7
1 #compdef freefoam
2 #-------------------------------------------------------------------------------
3 #               ______                _     ____          __  __
4 #              |  ____|             _| |_  / __ \   /\   |  \/  |
5 #              | |__ _ __ ___  ___ /     \| |  | | /  \  | \  / |
6 #              |  __| '__/ _ \/ _ ( (| |) ) |  | |/ /\ \ | |\/| |
7 #              | |  | | |  __/  __/\_   _/| |__| / ____ \| |  | |
8 #              |_|  |_|  \___|\___|  |_|   \____/_/    \_\_|  |_|
10 #                   'FreeFOAM: The Cross-Platform CFD Toolkit'
12 # Copyright (C) 2008-2011 Michael Wild <themiwi@users.sf.net>
13 #                         Gerber van der Graaf <gerber_graaf@users.sf.net>
14 #-------------------------------------------------------------------------------
15 # License
16 #   This file is part of FreeFOAM.
18 #   FreeFOAM is free software; you can redistribute it and/or modify it
19 #   under the terms of the GNU General Public License as published by the
20 #   Free Software Foundation; either version 2 of the License, or (at your
21 #   option) any later version.
23 #   FreeFOAM is distributed in the hope that it will be useful, but WITHOUT
24 #   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
25 #   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
26 #   for more details.
28 #   You should have received a copy of the GNU General Public License
29 #   along with FreeFOAM; if not, write to the Free Software Foundation,
30 #   Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
32 # Description
33 #   ZSH completion script for FreeFOAM.
35 #------------------------------------------------------------------------------
37 # TODO provide completers for field names, patch names, set names, time names etc.
39 # TODO perhaps it would be better to auto-generate this from the header comments.
40 # Or even better, extend the Foam::argList class with help strings and make it
41 # create a real -help output and add a -completerList which produces output
42 # that can easily be transformed into completer functions for various shells.
43 # Otherwise, maintaining this file is a PITA.
45 _freefoam() {
47 local -a solvers utils
48 # set solvers
49 solvers=(                                                                  \
50    'boundary' 'bubble' 'buoyantBoussinesqPimple' 'buoyantBoussinesqSimple' \
51    'buoyantPimple' 'buoyantSimple' 'buoyantSimpleRadiation' 'cavitating'   \
52    'channel' 'chtMultiRegion' 'chtMultiRegionSimple' 'coalChemistry'       \
53    'coldEngine' 'compressibleInter' 'compressibleInterDyM' 'diesel'        \
54    'dieselEngine' 'dns' 'dsmc' 'electrostatic' 'engine' 'financial' 'fire' \
55    'ico' 'inter' 'interDyM' 'interMixing' 'interPhaseChange' 'laplacian'   \
56    'md' 'mdEquilibration' 'mhd' 'MRFInter' 'MRFMultiphaseInter'            \
57    'multiphaseInter' 'nonNewtonianIco' 'PDR' 'PDRAutoRefine' 'pimple'      \
58    'pimpleDyM' 'piso' 'porousExplicitSourceReactingParcel' 'porousInter'   \
59    'porousSimple' 'potential' 'reacting' 'reactingParcel' 'rhoCentral'     \
60    'rhoCentralDyM' 'rhoPimple' 'rhoPiso' 'rhoPorousMRFPimple'              \
61    'rhoPorousSimple' 'rhoReacting' 'rhoSimple' 'scalarTransport' 'settling'\
62    'shallowWater' 'simple' 'solidDisplacement'                             \
63    'solidEquilibriumDisplacement' 'sonic' 'sonicDyM' 'sonicLiquid'         \
64    'twoLiquidMixing' 'twoPhaseEuler' 'uncoupledKinematicParcel' 'Xi'       \
67 # set utilities
68 utils=(                                                                    \
69    'adiabaticFlameT' 'ansysToFoam' 'applyBoundaryLayer'                    \
70    'applyWallFunctionBoundaryConditions' 'attachMesh' 'autoPatch'          \
71    'autoRefineMesh' 'blockMesh' 'boxTurb' 'calc' 'ccm26ToFoam' 'cellSet'   \
72    'cfx4ToFoam' 'changeDictionary' 'checkMesh' 'chemkinToFoam'             \
73    'clearPolyMesh' 'Co' 'collapseEdges' 'combinePatchFaces' 'copySettings' \
74    'createBaffles' 'createPatch' 'createTurbulenceFields' 'debugSwitches'  \
75    'decomposePar' 'deformedGeom' 'dsmcFieldsCalc' 'dsmcInitialise'         \
76    'engineCompRatio' 'engineSwirl' 'enstrophy' 'equilibriumCO'             \
77    'equilibriumFlameT' 'estimateScalarError' 'execFlowFunctionObjects'     \
78    'expandDictionary' 'extrude2DMesh' 'extrudeMesh' 'faceSet' 'flattenMesh'\
79    'flowType' 'fluent3DMeshToFoam' 'fluentMeshToFoam' 'foamDataToFluent'   \
80    'foamMeshToFluent' 'foamToEnsight' 'foamToEnsightParts'                 \
81    'foamToFieldview9' 'foamToGMV' 'foamToStarMesh' 'foamToVTK'             \
82    'formatConvert' 'gambitToFoam' 'gmshToFoam' 'graphExecTime' 'graphResKE'\
83    'graphResUVWP' 'icoErrorEstimate' 'icoMomentError' 'ideasUnvToFoam'     \
84    'IFCLookUpTableGen' 'infoExec' 'insideCells' 'job' 'kivaToFoam'         \
85    'Lambda2' 'log' 'Mach' 'mapFields' 'mdInitialise' 'mergeMeshes'         \
86    'mergeOrSplitBaffles' 'mirrorMesh' 'mixtureAdiabaticFlameT' 'modifyMesh'\
87    'momentScalarError' 'moveDynamicMesh' 'moveEngineMesh' 'moveMesh'       \
88    'mshToFoam' 'netgenNeutralToFoam' 'objToVTK' 'para' 'particleTracks'    \
89    'patchAverage' 'patchIntegrate' 'patchSummary' 'pdfPlot' 'Pe'           \
90    'plot3dToFoam' 'pointSet' 'polyDualMesh' 'postChannel' 'pPrime2'        \
91    'probeLocations' 'ptot' 'Q' 'R' 'reconstructPar' 'reconstructParMesh'   \
92    'redistributeMeshPar' 'refineHexMesh' 'refinementLevel' 'refineMesh'    \
93    'refineWallLayer' 'removeFaces' 'renumberMesh' 'rotateMesh' 'sammToFoam'\
94    'sample' 'selectCells' 'setFields' 'setSet' 'setsToZones' 'smapToFoam'  \
95    'snappyHexMesh' 'solverSweeps' 'splitCells' 'splitMesh'                 \
96    'splitMeshRegions' 'star4ToFoam' 'starToFoam' 'stitchMesh'              \
97    'streamFunction' 'stressComponents' 'subsetMesh' 'surfaceAdd'           \
98    'surfaceAutoPatch' 'surfaceCheck' 'surfaceClean' 'surfaceCoarsen'       \
99    'surfaceConvert' 'surfaceFeatureConvert' 'surfaceFeatureExtract'        \
100    'surfaceFind' 'surfaceMeshConvert' 'surfaceMeshConvertTesting'          \
101    'surfaceMeshExport' 'surfaceMeshImport' 'surfaceMeshTriangulate'        \
102    'surfaceOrient' 'surfacePointMerge' 'surfaceRedistributePar'            \
103    'surfaceRefineRedGreen' 'surfaceSmooth' 'surfaceSplitByPatch'           \
104    'surfaceSplitNonManifolds' 'surfaceSubset' 'surfaceToPatch'             \
105    'surfaceTransformPoints' 'tetgenToFoam' 'transformPoints'               \
106    'upgradeFvSolution' 'uprime' 'vorticity' 'wallGradU' 'wallHeatFlux'     \
107    'wallShearStress' 'wdot' 'writeCellCentres' 'writeMeshObj' 'yPlusLES'   \
108    'yPlusRAS' 'zipUpMesh'                                                  \
109   )
111 # describe the solvers and utilities (two "classes", no brief descriptions,
112 # that would be way too long).
114 # TODO search for additional stuff on FREEFOAM_PATH using something like
115 # 'freefoam -listApps'
116 # TODO make sure the application really exists (e.g. freefoam-para is not
117 # always installed).
119 (( $+functions[_freefoam_applications] )) ||
120 _freefoam_applications() {
121   # output
122   _describe -t solvers 'FreeFOAM solvers' solvers
123   _describe -t utils 'FreeFOAM utilities' utils
127 # utilities
130 # utility match generators for numbers
131 _freefoam_match_int() {
132    local garbage
133    zparseopts -K -D -a garbage M: J: V: 1 2 n F: X:
134    _guard '[0-9]#' "$*"
136 _freefoam_match_float() {
137    local garbage
138    zparseopts -K -D -a garbage M: J: V: 1 2 n F: X:
139    _guard '[0-9]#(|.[0-9]#)' "$*"
141 _freefoam_match_float01() {
142    local garbage
143    zparseopts -K -D -a garbage M: J: V: 1 2 n F: X:
144    _guard '(0#(|.[0-9]#[1-9])|1(|.0)' "$*"
146 _freefoam_match_vector() {
147    #TODO come up with something real...
148    _message 'Enter 3D vector of the form (x y z)'
151 # option sets (for _arguments) for often used options and their combinations
152 local -a _freefoam_case_opt _freefoam_par_opt _freefoam_std_opt
153 local -a _freefoam_common_opt _freefoam_overwrite_opt
154 local -a _freefoam_latest_time_opt _freefoam_time_opt _freefoam_all_time_opt
155 local -a _freefoam_region_opt _freefoam_faceSet_opt _freefoam_cellSet_opt
156 local -a _freefoam_help_opt _freefoam_scaleVec_opt _freefoam_scale_opt
157 local -a _freefoam_coord_dict_opt _freefoam_clean_opt _freefoam_scale_in_opt
158 local -a _freefoam_from_coord_opt _freefoam_scale_out_opt
159 local -a _freefoam_to_coord_opt
160 local app
162 # -case option
163 _freefoam_case_opt=('-case[case directory]::directory:_directories')
164 # -parallel option
165 _freefoam_par_opt=('-parallel[run in parallel]')
166 # -help option
167 _freefoam_help_opt=('-help[display help message]')
168 # standard options (-help, -doc and -srcDoc)
169 _freefoam_std_opt=( \
170    $_freefoam_help_opt[@] \
171    '-doc[open Doxygen documentation of this application]' \
172    '-srcDoc[open source code of this application]' \
173    )
174 # common (often used in combination) options,
175 # namely -case, -parallel, -help, -doc and -srcDoc
176 _freefoam_common_opt=( \
177    $_freefoam_case_opt[@] \
178    $_freefoam_par_opt[@] \
179    $_freefoam_std_opt[@] \
180    )
181 # -scale options
182 _freefoam_scale_opt=( \
183    '-scale[scale factor]:number:_freefoam_match_float "scale factor"')
184 _freefoam_scaleVec_opt=( \
185    '-scale[scaling factors in x, y and z direction]:vector (sx sy sz):_freefoam_match_vector')
186 _freefoam_scale_in_opt=( \
187    '-scaleIn[scaling factor when reading]:number:_freefoam_match_float "scale factor for input"')
188 _freefoam_scale_out_opt=( \
189    '-scaleOut[scaling factor when writing]:number:_freefoam_match_float "scale factor for output"')
190 # -overwrite option
191 _freefoam_overwrite_opt=('-overwrite[overwrite existing data]')
192 # -time option
193 _freefoam_time_opt=( \
194    '-time[apply only to specific time]:time:_freefoam_match_float "time value"')
195 # -latestTime option
196 _freefoam_latest_time_opt=('-latestTime[only apply to latest time step]')
197 # common (often used in combination) time options,
198 # namely -noZero, -constant, -time and -latestTime
199 _freefoam_all_time_opt=( \
200    '-noZero[ignore timestep 0]' \
201    '-constant[include the constant directory]' \
202    $_freefoam_time_opt[@] \
203    $_freefoam_latest_time_opt[@] \
204    )
205 # -region option
206 _freefoam_region_opt=( \
207    '-region[only apply to named mesh region]::name of mesh region:')
209 # set options
210 _freefoam_faceSet_opt=('-faceSet[only apply to named face set]:face set name:')
211 _freefoam_cellSet_opt=('-cellSet[only apply to named cell set]:cell set name:')
213 # other options
214 _freefoam_coord_dict_opt=( \
215    '-dict[use named dictionary instead of constant/coordinateSystems]:dictionary name:_files')
216 _freefoam_clean_opt=( \
217    '-clean[perform some surface checking/cleanup on the input surface]')
218 _freefoam_from_coord_opt=( \
219    '-from[source coordinate system]:coordinate system name:')
220 _freefoam_to_coord_opt=( \
221    '-to[target coordinate system]:coordinate system name:')
223 # file extensions handled by Foam::triSurface
224 local _freefoam_surface_read_ex='*.(ftr|stl|stlb|gts|obj|off|tri|ac|nas)'
225 local _freefoam_surface_write_ex='*.(ftr|stl|stlb|gts|obj|off|vtk|tri|dx|ac|smesh)'
228 # completers for indivudual commands
231 # common completion (i.e. everything which doesn't have it's own function or
232 # otherwise special treatment)
233 (( $+functions[_freefoam-common_apps] )) ||
234 _freefoam-common_apps() {
235    _arguments -S $_freefoam_common_opt[@] && ret=0
237 for app in $solvers cellSet dsmcInitialize engineCompRatio engineSwirl \
238    equilibriumCO faceSet flattenMesh foamToGMV mdInitialise mirrorMesh \
239    moveDynamicMesh moveEngineMesh moveMesh pdfPlot pointSet R zipUpMesh
241   functions[_freefoam-$app]=$functions[_freefoam-common_apps]
242 done
244 (( $+functions[_freefoam-mshToFoam] )) ||
245 _freefoam-mshToFoam() {
246    _arguments -S ':.msh file:_files -g \*.msh' '-hex[read hex cells]' \
247    $_freefoam_std_opt[@]
250 (( $+functions[_freefoam-gmshToFoam] )) ||
251 _freefoam-gmshToFoam() {
252    _arguments -S ':.msh file:_files -g \*.msh' \
253    '-keepOrientation[do not check ordering]' \
254    $_freefoam_case_opt[@] $_freefoam_std_opt[@]
257 (( $+functions[_freefoam-ideasUnvToFoam] )) ||
258 _freefoam-ideasUnvToFoam() {
259    _arguments -S ':.unv file:_files -g \*.unv' \
260    $_freefoam_case_opt[@] $_freefoam_std_opt[@]
263 (( $+functions[_freefoam-ansysToFoam] )) ||
264 _freefoam-ansysToFoam() {
265    _arguments -S ':ANSYS input file:_files' \
266    $_freefoam_scale_opt[@] $_freefoam_case_opt[@] $_freefoam_std_opt[@]
269 (( $+functions[_freefoam-cfx4ToFoam] )) ||
270 _freefoam-cfx4ToFoam() {
271    _arguments -S ':CFX geom file:_files' \
272    $_freefoam_scale_opt[@] $_freefoam_case_opt[@] $_freefoam_std_opt[@]
275 (( $+functions[_freefoam-chemkinToFoam] )) ||
276 _freefoam-chemkinToFoam() {
277    _arguments -S ':CHEMKIN File:_files' ':CHEMKIN ThermodynamicsFile:_files' \
278    ':FOAM ChemistryFile:_files' ':FOAM ThermodynamicsFile:_files' \
279    $_freefoam_common_opt[@]
282 (( $+functions[_freefoam-fluent3DMeshToFoam] )) ||
283 _freefoam-fluent3DMeshToFoam() {
284    _arguments -S ':Fluent mesh file:_files'  \
285    '-ignoreFaceGroups[ignore face groups]:face group names:' \
286    '-ignoreCellGroups[ignore cell groups]:cell group names:' \
287    $_freefoam_scale_opt[@] \
288    $_freefoam_case_opt[@] $_freefoam_std_opt[@] \
291 (( $+functions[_freefoam-fluentMeshToFoam] )) ||
292 _freefoam-fluentMeshToFoam() {
293    _arguments -S ':Fluent mesh file:_files' \
294    '-writeSets[write patch sets]' '-writeZones[write cell zones]' \
295    $_freefoam_scale_opt[@] $_freefoam_case_opt[@] $_freefoam_std_opt[@]
298 (( $+functions[_freefoam-surfaceAdd] )) ||
299 _freefoam-surfaceAdd() {
300    _arguments -S ':first surface file:_files -g'$_freefoam_surface_read_ex \
301    ':second surface file:_files -g'$_freefoam_surface_read_ex \
302    ':output surface file:_files -g'$_freefoam_surface_write_ex \
303    '-points[add points from file]::Foam points file:_files' \
304    '-mergeRegions[merge the regions]' \
305    $_freefoam_case_opt[@] $_freefoam_std_opt[@]
308 (( $+functions[_freefoam-surfaceCoarsen] )) ||
309 _freefoam-surfaceCoarsen() {
310    _arguments -S ':input surface file:_files -g'$_freefoam_surface_read_ex \
311    ':reduction factor:_freefoam_match_float01 "reduction factor in (0,1]' \
312    ':output surface file:_files -g'$_freefoam_surface_write_ex \
313    $_freefoam_case_opt[@] $_freefoam_std_opt[@]
316 (( $+functions[_freefoam-surfaceOrient] )) ||
317 _freefoam-surfaceOrient() {
318    _arguments -S ':surface file:_files -g'$_freefoam_surface_read_ex \
319    ':visible point:_freefoam_match_vector' ':output file:_files' \
320    '-inside[the point is inside instead of outside]' \
321    $_freefoam_case_opt[@] $_freefoam_std_opt[@]
324 (( $+functions[_freefoam-gambitToFoam] )) ||
325 _freefoam-gambitToFoam() {
326    _arguments -S ':GAMBIT file:_files -g \*.neu' \
327    $_freefoam_scale_opt[@] $_freefoam_case_opt[@] $_freefoam_std_opt[@]
330 (( $+functions[_freefoam-netgenNeutralToFoam] )) ||
331 _freefoam-netgenNeutralToFoam() {
332    _arguments -S ':Neutral file:_files -g \*.netgen' $_freefoam_common_opt[@]
335 (( $+functions[_freefoam-objToVTK] )) ||
336 _freefoam-objToVTK() {
337    _arguments -S ':OBJ file:_files -g \*.obj' \
338    ':output VTK file:_files -g \*.vtk' \
339    $_freefoam_case_opt[@] $_freefoam_std_opt[@]
342 (( $+functions[_freefoam-plot3dToFoam] )) ||
343 _freefoam-plot3dToFoam() {
344    _arguments -S ':PLOT3D geom file:_files -g \*.xyz' \
345    '-noBlank[do not expect blanking]' '-2D[data is 2D]::thickness:_freefoam_match_float' \
346    '-singleBlock[data is in a single block]' \
347    $_freefoam_scale_opt[@] $_freefoam_case_opt[@] $_freefoam_std_opt[@]
350 (( $+functions[_freefoam-sammToFoam] )) ||
351 _freefoam-sammToFoam() {
352    _arguments -S ':SAMM mesh file prefix:_files' \
353    $_freefoam_scale_opt[@] $_freefoam_case_opt[@] $_freefoam_std_opt[@]
356 (( $+functions[_freefoam-smapToFoam] )) ||
357 _freefoam-smapToFoam() {
358    _arguments -S ':SMAP fileName:_files -g \*.smap' \
359    $_freefoam_case_opt[@] $_freefoam_std_opt[@]
362 (( $+functions[_freefoam-starToFoam] )) ||
363 _freefoam-starToFoam() {
364    _arguments -S ':STAR mesh file prefix:_files' \
365    $_freefoam_scale_opt[@] $_freefoam_case_opt[@] $_freefoam_std_opt[@]
368 (( $+functions[_freefoam-ccm26ToFoam] )) ||
369 _freefoam-ccm26ToFoam() {
370    _arguments -S ':ccm26 file:_files -g \*.ccm' \
371    $_freefoam_case_opt[@] $_freefoam_std_opt[@]
374 (( $+functions[_freefoam-refineHexMesh] )) ||
375 _freefoam-refineHexMesh() {
376    _arguments -S ':cell set name:' \
377    $_freefoam_overwrite_opt[@] $_freefoam_common_opt[@]
380 # common completer for adiabaticFlameT, equilibriumFlameT and
381 # mixtureAdiabaticFlameT
382 (( $+functions[_freefoam-flameT_apps] )) ||
383 _freefoam-flameT_apps() {
384    _arguments -S ':control file:_files' \
385    $_freefoam_common_opt[@]
387 for app in {adiabatic,equilibrium,mixtureAdiabatic}FlameT; do
388   functions[_freefoam-$app]=$functions[_freefoam-flameT_apps]
389 done
391 (( $+functions[_freefoam-splitCells] )) ||
392 _freefoam-splitCells() {
393    _arguments -S ':edge angle [0..360]:_freefoam_match_float' \
394    '-geometry[geometry based splitting for hex cells]' \
395    '-tol[edge snap tolerance]:tolerance:_freefoam_match_float' \
396    '-set[cell set to split]:cell set name:' \
397    $_freefoam_overwrite_opt[@]  $_freefoam_case_opt[@] $_freefoam_std_opt[@]
400 (( $+functions[_freefoam-collapseEdges] )) ||
401 _freefoam-collapseEdges() {
402    _arguments -S ':edge length [m]:_freefoam_match_float' \
403    ':merge angle [degrees]:_freefoam_match_float' \
404    $_freefoam_overwrite_opt[@] $_freefoam_case_opt[@] $_freefoam_std_opt[@]
407 (( $+functions[_freefoam-splitMesh] )) ||
408 _freefoam-splitMesh() {
409    _arguments -S ':face set:' ':master patch:' ':slave patch:' \
410    $_freefoam_overwrite_opt[@] $_freefoam_case_opt[@] $_freefoam_std_opt[@]
413 (( $+functions[_freefoam-removeFaces] )) ||
414 _freefoam-removeFaces() {
415    _arguments -S :'face set:' \
416    $_freefoam_overwrite_opt[@] $_freefoam_common_opt[@]
419 (( $+functions[_freefoam-combinePatchFaces] )) ||
420 _freefoam-combinePatchFaces() {
421    _arguments -S ':feature angle [0..180]:_freefoam_match_float' \
422    '-snapMesh[remove loose points on edges]' \
423    '-concaveAngle[maximum allowed concave angle]:angle [0..180]:_freefoam_match_float' \
424    $_freefoam_overwrite_opt[@] $_freefoam_common_opt[@]
427 (( $+functions[_freefoam-autoPatch] )) ||
428 _freefoam-autoPatch() {
429    _arguments -S ':feature angle [0-180]:_freefoam_match_float' \
430    $_freefoam_overwrite_opt[@] $_freefoam_case_opt[@] $_freefoam_std_opt[@]
433 (( $+functions[_freefoam-polyDualMesh] )) ||
434 _freefoam-polyDualMesh() {
435    _arguments -S ':feature angle [0-180]:_freefoam_match_float' \
436    '-concaveMultiCells[Creates multiple cells for each point on a concave edge]' \
437    '-splitAllFaces[Create a single face for every original cell the face passes through]' \
438    '-doNotPreserveFaceZones[Do not preserve face zones]' \
439    $_freefoam_overwrite_opt[@] $_freefoam_case_opt[@] $_freefoam_std_opt[@]
442 # common completer for patchAverage and  patchIntegrate
443 (( $+functions[_freefoam-patchCalc_apps] )) ||
444 _freefoam-patchCalc_apps() {
445    _arguments -S ':field name:' ':patch name:' \
446    $_freefoam_all_time_opt[@] $_freefoam_common_opt[@]
448 for app in patch{Average,Integrate}; do
449   functions[_freefoam-$app]=$functions[_freefoam-patchCalc_apps]
450 done
452 (( $+functions[_freefoam-tetgenToFoam] )) ||
453 _freefoam-tetgenToFoam() {
454    _arguments -S ':file prefix:_files' \
455    '-noFaceFile[ignore the face file]' \
456    $_freefoam_common_opt[@]
459 (( $+functions[_freefoam-surfaceFeatureConvert] )) ||
460 _freefoam-surfaceFeatureConvert() {
461    _arguments -S ':input file:files_ -g \*."(nas|eMesh)"' \
462    ':output file:_files -g \*."(eMesh|vtk)"' \
463    $_freefoam_case_opt[@] $_freefoam_std_opt[@]
466 (( $+functions[_freefoam-surfaceSplitByPatch] )) ||
467 _freefoam-surfaceSplitByPatch() {
468    _arguments -S ':input file:_files -g'$_freefoam_surface_read_ex \
469    $_freefoam_case_opt[@] $_freefoam_std_opt[@]
472 (( $+functions[_freefoam-surfaceAutoPatch] )) ||
473 _freefoam-surfaceAutoPatch() {
474    _arguments -S ':input surface file:_files -g'$_freefoam_surface_read_ex \
475    ':output surface file:_files -g'$_freefoam_surface_write_ext \
476    ':included angle [0..180]:_freefoam_match_float' \
477    $_freefoam_case_opt[@] $_freefoam_std_opt[@]
480 (( $+functions[_freefoam-surfaceConvert] )) ||
481 _freefoam-surfaceConvert() {
482    _arguments -S ':input surface file:_files -g'$_freefoam_surface_read_ex \
483    ':output surface file:_files -g'$_freefoam_surface_write_ext \
484    '-clean[clean up surface]' $_freefoam_scale_opt[@] \
485    '-group[reorder faces into groups by region]' \
486    $_freefoam_case_opt[@] $_freefoam_std_opt[@]
489 (( $+functions[_freefoam-expandDictionary] )) ||
490 _freefoam-expandDictionary() {
491    _arguments -S ':dictionary to expand:_files' \
492    $_freefoam_common_opt[@]
495 (( $+functions[_freefoam-mergeMeshes] )) ||
496 _freefoam-mergeMeshes() {
497    _arguments -S \
498    ':parent directory of master case:_directories' ':master case name:' \
499    ':parent directory of case to add:_directories' ':name of case to add:' \
500    $_freefoam_case_opt[@] $_freefoam_std_opt[@]
503 (( $+functions[_freefoam-stitchMesh] )) ||
504 _freefoam-stitchMesh() {
505    _arguments -S ':master patch name:' ':slave patch name:' \
506    '-perfect[the patches, vertices and face centres are perfectly aligned]' \
507    '-partial[the surface overlap only partialy]' \
508    '-toleranceDict[file with tolerances]:dictionary name:_files' \
509    $_freefoam_overwrite_opt[@] $_freefoam_case_opt[@] $_freefoam_std_opt[@]
512 (( $+functions[_freefoam-rotateMesh] )) ||
513 _freefoam-rotateMesh() {
514    _arguments -S \
515       ':old direction (nx,ny,nz):_freefoam_match_vector' ':new direction (nx,ny,nz):_freefoam_match_vector' \
516    $_freefoam_all_time_opt[@] $_freefoam_common_opt[@]
519 (( $+functions[_freefoam-surfaceMeshTriangulate] )) ||
520 _freefoam-surfaceMeshTriangulate() {
521    _arguments -S ':output file:_files -g'$_freefoam_surface_write_ex \
522    '-patches[list of patches]:(patch0 .. patchN):' \
523    '-excludeProcPatches[if not run parallel, exclude processor patches]' \
524    $_freefoam_common_opt[@]
527 (( $+functions[_freefoam-refineWallLayer] )) ||
528 _freefoam-refineWallLayer() {
529    _arguments -S \
530       ':name of patch to refine:' ':refinement factor [0,1]:_freefoam_match_float01' \
531    '-useSet[refine named cell set]::cell set name:' \
532    $_freefoam_overwrite_opt[@] $_freefoam_case_opt[@] $_freefoam_std_opt[@]
535 (( $+functions[_freefoam-star4ToFoam] )) ||
536 _freefoam-star4ToFoam() {
537    _arguments -S ':pro-STAR file prefix:_files' '-ascii[the data is ASCII]' \
538    '-solids[treat solid cells as fluid cells]' \
539    $_freefoam_scale_opt[@] $_freefoam_case_opt[@] $_freefoam_std_opt[@]
542 (( $+functions[_freefoam-deformedGeom] )) ||
543 _freefoam-deformedGeom() {
544    _arguments -S ':scaling factor for deformation:_freefoam_match_float' \
545    $_freefoam_common_opt[@]
548 (( $+functions[_freefoam-createBaffles] )) ||
549 _freefoam-createBaffles() {
550    _arguments -S ':cell set name:' ':patch name:' \
551    $_freefoam_overwrite_opt[@] $_freefoam_common_opt[@]
554 (( $+functions[_freefoam-subsetMesh] )) ||
555 _freefoam-subsetMesh() {
556    _arguments -S ':cell set name:' ':patch name:' \
557    $_freefoam_overwrite_opt[@] $_freefoam_common_opt[@]
560 (( $+functions[_freefoam-mapFields] )) ||
561 _freefoam-mapFields() {
562    _arguments -S ':source case directory:_directories' \
563    '-consistent[meshes are consistent]' \
564    '-parallelSource[the source case is decomposed' \
565    '-sourceTime[time of the source]::scalar:_freefoam_match_float' \
566    '-parallelTarget[the target case is decomposed' \
567    $_freefoam_case_opt[@] $_freefoam_std_opt[@]
570 (( $+functions[_freefoam-insideCells] )) ||
571 _freefoam-insideCells() {
572    _arguments -S ':surface file:_files -g'$_freefoam_surface_read_ex \
573    ':cell set name:' \
574    $_freefoam_case_opt[@] $_freefoam_std_opt[@]
577 (( $+functions[_freefoam-surfacePointMerge] )) ||
578 _freefoam-surfacePointMerge() {
579    _arguments -S ':surface file:_files -g'$_freefoam_surface_read_ex \
580    ':(absolute) merge distance:_freefoam_match_float' \
581    ':output surface file:_files -g'$_freefoam_surface_write_ex \
582    $_freefoam_case_opt[@] $_freefoam_std_opt[@]
585 (( $+functions[_freefoam-surfaceClean] )) ||
586 _freefoam-surfaceClean() {
587    _arguments -S ':surface file:_files -g'$_freefoam_surface_read_ex \
588    ':min length:_freefoam_match_float' ':output surface file:_files -g'$_freefoam_surface_write_ex \
589    $_freefoam_case_opt[@] $_freefoam_std_opt[@]
592 (( $+functions[_freefoam-surfaceRefineRedGreen] )) ||
593 _freefoam-surfaceRefineRedGreen() {
594    _arguments -S ':surface file:_files -g'$_freefoam_surface_read_ex \
595    ':surface output file:_files -g'$_freefoam_surface_write_ex \
596    $_freefoam_case_opt[@] $_freefoam_std_opt[@]
599 (( $+functions[_freefoam-surfaceSplitNonManifolds] )) ||
600 _freefoam-surfaceSplitNonManifolds() {
601    _arguments -S ':surface file:_files -g'$_freefoam_surface_read_ex \
602    ':surface output file:_files -g'$_freefoam_surface_write_ex \
603    '-debug[generate debugging output]' \
604    $_freefoam_case_opt[@] $_freefoam_std_opt[@]
607 (( $+functions[_freefoam-surfaceTransformPoints] )) ||
608 _freefoam-surfaceTransformPoints() {
609    _arguments -S ':surface file:_files -g'$_freefoam_surface_read_ex \
610    ':surface output file:_files -g'$_freefoam_surface_write_ex \
611    '-translate[translation vector]::vector:_freefoam_match_vector' \
612    '-rollPitchYaw[rotation angles]::(roll pitch yaw):_freefoam_match_vector' \
613    '-yawPitchRoll[rotation angles]::(yaw pitch roll):_freefoam_match_vector' \
614    '-rotate[rotate from first to second direction]::(vector vector):' \
615    $_freefoam_scaleVec_opt[@] $_freefoam_case_opt[@] $_freefoam_std_opt[@]
618 (( $+functions[_freefoam-surfaceSmooth] )) ||
619 _freefoam-surfaceSmooth() {
620    _arguments -S ':surface file:_files -g'$_freefoam_surface_read_ex \
621    ':underrelaxation factor (0..1):' ':number of iterations:_freefoam_match_floag01' \
622    ':output surface file:_files -g'$_freefoam_surface_write_ex \
623    $_freefoam_std_opt[@]
626 (( $+functions[_freefoam-surfaceToPatch] )) ||
627 _freefoam-surfaceToPatch() {
628    _arguments -S ':surface file:_files -g'$_freefoam_surface_read_ex \
629    '-tol[search toleracne]::fraction of mesh size:' \
630    $_freefoam_faceSet_opt[@] $_freefoam_case_opt[@] $_freefoam_std_opt[@]
633 (( $+functions[_freefoam-surfaceCheck] )) ||
634 _freefoam-surfaceCheck() {
635    _arguments -S ':surface file:_files -g'$_freefoam_surface_read_ex \
636    '-noSelfIntersection[check for self-intersection]' \
637    $_freefoam_case_opt[@] $_freefoam_std_opt[@]
640 (( $+functions[_freefoam-surfaceFind] )) ||
641 _freefoam-surfaceFind() {
642    _arguments -S ':surface file:_files -g'$_freefoam_surface_read_ex \
643    '-x[x-coordinate of sample point]::X:_freefoam_match_float' \
644    '-y[y-coordinate of sample point]::Y:_freefoam_match_float' \
645    '-z[z-coordinate of sample point]::Z:_freefoam_match_float' \
646    $_freefoam_case_opt[@] $_freefoam_std_opt[@]
649 (( $+functions[_freefoam-surfaceFeatureExtract] )) ||
650 _freefoam-surfaceFeatureExtract() {
651    _arguments -S ':surface file:_files -g'$_freefoam_surface_read_ex \
652    ':output file:_files' \
653    '-minLen[minimum cumulative length of feature]:_freefoam_match_float' \
654    '-includedAngle[construct set from included angle]:included angle [0..180]:_freefoam_match_float' \
655    '-deleteBox[delete axis-aligned box]:((x0 y0 z0)(x1 y1 z1)):' \
656    '-minElem[minimum number of edges in feature]:_freefoam_match_int' \
657    '-subsetBox[extract all edges in axis-aligned box]:((x0 y0 z0)(x1 y1 z1)):' \
658    '-set[use existing set]:name of input feature set:' \
659    $_freefoam_case_opt[@] $_freefoam_std_opt[@]
662 (( $+functions[_freefoam-surfaceSubset] )) ||
663 _freefoam-surfaceSubset() {
664    _arguments -S ':surfaceSubsetDic:_files -g surfaceSubsetDict' \
665    ':surface file:_files -g'$_freefoam_surface_read_ex \
666    ':output surface file:_files -g'$_freefoam_surface_write_ex \
667    $_freefoam_case_opt[@] $_freefoam_std_opt[@]
670 (( $+functions[_freefoam-extrude2DMesh] )) ||
671 _freefoam-extrude2DMesh() {
672    _arguments -S ':thickness:_freefoam_match_float "thickness"' \
673    $_freefoam_overwrite_opt[@] $_freefoam_common_opt[@]
676 (( $+functions[_freefoam-applyBoundaryLayer] )) ||
677 _freefoam-applyBoundaryLayer() {
678    _arguments -S \
679    $_freefoam_common_opt[@] \
680    '-writenut[output turbulent viscosity]' \
681    - set1 \
682       '-Cbl[coefficient for scaling of the average distance from the wall]::scalar:_freefoam_match_float' \
683    - set2 \
684       '-ybl[specify the uniform boundary layer thickness]::scalar:_freefoam_match_float'
687 # common completer for autoRefineMesh, boxTurb, foamMeshToFluent and selectCells
688 # taking -case, -help, -doc and -srcDoc
689 (( $+functions[_freefoam-std_noPar_apps] )) ||
690 _freefoam-std_noPar_apps() { _arguments -S $_freefoam_case_opt[@] $_freefoam_std_opt[@] }
691 for app in autoRefineMesh boxTurb foamMeshToFluent selectCells; do
692   functions[_freefoam-$app]=$functions[_freefoam-std_noPar_apps]
693 done
695 (( $+functions[_freefoam-splitMeshRegions] )) ||
696 _freefoam-splitMeshRegions() {
697    _arguments -S '-cellZones[split different cell zones]' \
698    '-detectOnly[do no processing]' \
699    '-blockedFaces[split at give face set]::name of face set:' \
700    '-sloppyCellZones[try to match regions to existing cell zones]' \
701    '-makeCellZones[create mesh with cells in different cell zones]' \
702    $_freefoam_overwrite_opt[@] $_freefoam_common_opt[@] \
703    - set1 \
704       '-insidePoint[only keep region containing specified point]::point:_freefoam_match_vector' \
705    - set2 \
706       '-largestOnly[only keep largest region]'
709 (( $+functions[_freefoam-infoExec] )) ||
710 _freefoam-infoExec() {
711    _arguments -S \
712    '-dictionary[use specified dictionary]:dictionary name:_files' \
713    '-entry[use specified entry from dictionary (parent:child notation)]:entry name:' \
714    '-keywords[list keywords in the dictionary]' \
715    '-times[list all time steps]' \
716    $_freefoam_case_opt[@] $_freefoam_std_opt[@]
719 (( $+functions[_freefoam-decomposePar] )) ||
720 _freefoam-decomposePar() {
721    _arguments -S '-ifRequired[only decompose if required]' \
722    '-force[overwrite existing data]' \
723    '-cellDist[write cell distribution as a labelList]' \
724    '-fields[use existing decomposed mesh, only decompose fields]' \
725    '-filterPatches[remove empty patches]' \
726    '-copyUniform[also copy any "uniform" directories]' \
727    $_freefoam_case_opt[@] $_freefoam_std_opt[@]
730 (( $+functions[_freefoam-extrudeMesh] )) ||
731 _freefoam-extrudeMesh() {
732    _arguments -S '-mergeFaces[merge faces for axisymmetric cases]' \
733    $_freefoam_case_opt[@] $_freefoam_std_opt[@] \
734    - set1 \
735       '-sourceRoot[parent directory of the source case]:directory containing the case:_directories' \
736       '-sourceCase[source case name]:source case name:' \
737       '-sourcePatch[source patch]:name of source patch to extrude:' \
738    - set2 \
739       '-surface[specify surface file to extrude]:surface file:_files -g'$_freefoam_surface_read_ex
742 (( $+functions[_freefoam-redistributeMeshPar] )) ||
743 _freefoam-redistributeMeshPar() {
744    _arguments -S \
745    '-mergeTol[relative merge distance]:number:_freefoam_match_float' \
746    $_freefoam_common_opt[@]
749 (( $+functions[_freefoam-log] )) ||
750 _freefoam-log() {
751    _arguments -S '-n[create single-column file with data only]' \
752    '-s[suppress default information and only print extracted variables]' \
753    ':log file:_files'
756 (( $+functions[_freefoam-checkMesh] )) ||
757 _freefoam-checkMesh() {
758    _arguments -S '-noTopology[do not check mesh-topology]' \
759    '-allTopology[more extensive topology checks]' \
760    '-allGeometry[more extensive geometry checks]' \
761    $_freefoam_region_opt[@] $_freefoam_latest_time_opt[@] \
762    $_freefoam_time_opt[@] $_freefoam_common_opt[@]
765 (( $+functions[_freefoam-foamToEnsightParts] )) ||
766 _freefoam-foamToEnsightParts() {
767    _arguments -S '-ascii[write in ASCII instead of "C binary"]' \
768    '-index[ignore the time index in the time file]:start:_freefoam_match_int "start index"' \
769    '-noMesh[suppress writing the geometry]' \
770    $_freefoam_all_time_opt[@] $_freefoam_case_opt[@] $_freefoam_std_opt[@]
773 (( $+functions[_freefoam-foamToEnsight] )) ||
774 _freefoam-foamToEnsight() {
775    _arguments -S '-ascii[write in ASCII instead of "C binary"]' \
776    '-patches[only use named patches]:patch list:' \
777    '-noPatches[supress writing any patches]' \
778    $_freefoam_all_time_opt[@] $_freefoam_common_opt[@]
781 (( $+functions[_freefoam-setSet] )) ||
782 _freefoam-setSet() {
783    _arguments -S '-batch[read commands from batch file]::batch file:_files' \
784    '-noVTK[do not export to VTK]' \
785    $_freefoam_all_time_opt[@] $_freefoam_common_opt[@]
788 # apps taking time, case and standard options.
789 # common completer for foamDataToFluent and postChannel.
790 (( $+functions[_freefoam-std_noPar_time_apps] )) ||
791 _freefoam-std_noPar_time_apps() { _arguments -S \
792    $_freefoam_all_time_opt[@] $_freefoam_case_opt[@] $_freefoam_std_opt[@]
794 for app in foamDataToFluent postChannel; do
795   functions[_freefoam-$app]=$functions[_freefoam-std_noPar_time_apps]
796 done
798 # apps taking all time options and all common options.
799 (( $+functions[_freefoam-common_time_apps] )) ||
800 _freefoam-common_time_apps() {
801    _arguments -S $_freefoam_all_time_opt[@] $_freefoam_common_opt[@]
803 for app in createTurbulenceFields estimateScalarError formatConvert            \
804            icoErrorEstimate icoMomentError momentScalarError pPrime2           \
805            patchSummary probeLocations ptot sample setFields streamFunction    \
806            stressComponents wallGradU wallHeatFlux                             \
807            wallShearStress wdot writeCellCentres; do
808   functions[_freefoam-$app]=$functions[_freefoam-common_time_apps]
809 done
811 (( $+functions[_freefoam-common_compressible_time_apps] )) ||
812 _freefoam-common_compressible_time_apps() {
813    _arguments -S '-compressible[operate in compressible mode]' \
814    $_freefoam_all_time_opt[@] $_freefoam_common_opt[@]
816 for app in yPlus{RAS,LES} applyWallFunctionBoundaryConditions; do
817   functions[_freefoam-$app]=$functions[_freefoam-common_compressible_time_apps]
818 done
820 (( $+functions[_freefoam-setsToZones] )) ||
821 _freefoam-setsToZones() {
822    _arguments -S '-noFlipMap[no automatic face flipping]' \
823    $_freefoam_all_time_opt[@] $_freefoam_common_opt[@]
826 (( $+functions[_freefoam-foamToStarMesh] )) ||
827 _freefoam-foamToStarMesh() {
828    _arguments -S '-tri[extract a triangulated surface]' \
829    '-noBnd[suppress writing of a .bnd file]' \
830    '-surface[only extract the surfaces]' \
831    $_freefoam_scale_opt[@] $_freefoam_all_time_opt[@] \
832    $_freefoam_case_opt[@] $_freefoam_std_opt[@]
835 (( $+functions[_freefoam-writeMeshObj] )) ||
836 _freefoam-writeMeshObj() {
837    _arguments -S \
838    '-face[export face with specified label]::face label:_freefoam_match_int "face index"' \
839    '-patchFaces[also export patch faces]' \
840    '-cell[export cell with specified label]::cell label:_freefoam_match_int "cell index"' \
841    '-point[export point with specified label]::point label:_freefoam_match_int "point index"' \
842    $_freefoam_cellSet_opt[@] $_freefoam_faceSet_opt[@] $_freefoam_all_time_opt[@] $_freefoam_common_opt[@]
845 (( $+functions[_freefoam-foamToFieldview9] )) ||
846 _freefoam-foamToFieldview9() {
847    _arguments -S '-noWall[do not export the walls]' \
848    $_freefoam_all_time_opt[@] $_freefoam_case_opt[@] $_freefoam_std_opt[@]
851 # apps taking -dict, all time and common options.
852 _freefoam-common_time_dict_apps() {
853    _arguments -S \
854    '-dict[use named dictionary instead of system/controlDict]:dictionary name:_files' \
855    $_freefoam_all_time_opt[@] $_freefoam_common_opt[@]
857 for app in Lambda2 flowType dsmcFieldsCalc; do
858   functions[_freefoam-$app]=$functions[_freefoam-common_time_dict_apps]
859 done
861 # apps taking -noWrite, -dict, all time and common options.
862 # common completer for Co, Mach, Pe, Q, enstrophy, execFlowFunctionObjects,
863 # uprime and vorticity.
864 (( $+functions[_freefoam-common_time_dict_noWrite_apps] )) ||
865 _freefoam-common_time_dict_noWrite_apps() {
866    _arguments -S '-noWrite[suppress output to files]' \
867    '-dict[use named dictionary instead of system/controlDict]:dictionary name:_files' \
868    $_freefoam_all_time_opt[@] $_freefoam_common_opt[@]
870 for app in Co Mach Pe Q enstrophy execFlowFunctionObjects uprime vorticity; do
871   functions[_freefoam-$app]=$functions[_freefoam-common_time_dict_noWrite_apps]
872 done
874 (( $+functions[_freefoam-renumberMesh] )) ||
875 _freefoam-renumberMesh() {
876    _arguments -S \
877    '-blockOrder[order cells into regions and faces into region-internal/external]' \
878    '-writeMaps[write renumber map (new to old)]' \
879    '-orderPoints[order points into internal/boundary points]' \
880    $_freefoam_overwrite_opt[@] $_freefoam_all_time_opt[@] $_freefoam_common_opt[@]
883 (( $+functions[_freefoam-reconstructPar] )) ||
884 _freefoam-reconstructPar() {
885    _arguments -S \
886    '-fields[only reconstruct named fields]:list of fields:' \
887    '-noLagrangian[do not reconstruct Lagrangian fields]' \
888    $_freefoam_region_opt[@] $_freefoam_all_time_opt[@] \
889    $_freefoam_case_opt[@] $_freefoam_std_opt[@]
892 (( $+functions[_freefoam-reconstructParMesh] )) ||
893 _freefoam-reconstructParMesh() {
894    _arguments -S '-fullMatch[check all boundary faces]' \
895    '-mergeTol[relative merge distance]:number:_freefoam_match_float' \
896    $_freefoam_region_opt[@] $_freefoam_all_time_opt[@] \
897    $_freefoam_case_opt[@] $_freefoam_std_opt[@]
900 (( $+functions[_freefoam-foamToVTK] )) ||
901 _freefoam-foamToVTK() {
902    _arguments -S '-surfaceFields[write cell-surface fields]' \
903    '-ascii[write in ASCII instead of binary]' \
904    '-nearCellValue[output cell value on patches instead of patch value]' \
905    '-pointSet[only apply to named point set]:point set name:' \
906    '-noLinks[do not link processor files to master (in parallel)]' \
907    '-excludePatches[exclude specified patches]:list of patches to exclude:' \
908    '-useTimeName[use the time index in the VTK file name instead of the time index]' \
909    '-allPatches[combine all patches into a single file]' \
910    '-noFaceZones[do not export faceZones]' \
911    '-fields[convert selected fields only]::list of fields:' \
912    '-noPointValues[do not export point fields]' \
913    '-noInternal[only export data on patches]' \
914    $_freefoam_faceSet_opt[@] $_freefoam_cellSet_opt[@] $_freefoam_region_opt[@] \
915    $_freefoam_all_time_opt[@] $_freefoam_common_opt[@]
918 (( $+functions[_freefoam-attachMesh] )) ||
919 _freefoam-attachMesh() {
920    _arguments -S \
921    $_freefoam_overwrite_opt[@] $_freefoam_case_opt[@] $_freefoam_std_opt[@]
924 (( $+functions[_freefoam-refineMesh] )) ||
925 _freefoam-refineMesh() {
926    _arguments -S \
927    '-dict[refine according to refineMeshDict]::specify refineMeshDict:_files -g refineMeshDict' \
928    $_freefoam_overwrite_opt[@] $_freefoam_common_opt[@]
931 (( $+functions[_freefoam-createPatch] )) ||
932 _freefoam-createPatch() {
933    _arguments -S $_freefoam_overwrite_opt[@] $_freefoam_common_opt[@]
936 # common  completer for apps taking -overwrite and common options
937 (( $+functions[_freefoam-common_overwrite_apps] )) ||
938 _freefoam-common_overwrite_apps() {
939    _arguments -S $_freefoam_overwrite_opt[@] $_freefoam_common_opt[@]
941 for app in modifyMesh snappyHexMesh; do
942    functions[_freefoam-$app]=$functions[_freefoam-common_overwrite_apps]
943 done
945 (( $+functions[_freefoam-mergeOrSplitBaffles] )) ||
946 _freefoam-mergeOrSplitBaffles() {
947    _arguments -S '-split[split duplicate surfaces]' \
948    '-detectOnly[do no processing]' \
949    $_freefoam_overwrite_opt[@] $_freefoam_common_opt[@]
952 (( $+functions[_freefoam-refinementLevel] )) ||
953 _freefoam-refinementLevel() {
954    _arguments -S '-readLevel[read reference refinementLevel file]' \
955    $_freefoam_common_opt[@]
958 (( $+functions[_freefoam-blockMesh] )) ||
959 _freefoam-blockMesh() {
960    _arguments -S \
961    '-dict[specify an alternative dictionary]::dictionary file:_files' \
962    '-blockTopology[write the topology as a set of edges in OBJ format]' \
963    $_freefoam_region_opt[@] $_freefoam_case_opt[@] $_freefoam_std_opt[@]
966 # common completer for apps taking -region and common options
967 (( $+functions[_freefoam-common_region_apps] )) ||
968 _freefoam-common_region_apps() {
969    _arguments -S $_freefoam_region_opt[@] $_freefoam_common_opt[@]
971 for app in changeDictionary particleTracks; do
972    functions[_freefoam-$app]=$functions[_freefoam-common_region_apps]
973 done
975 (( $+functions[_freefoam-transformPoints] )) ||
976 _freefoam-transformPoints() {
977    _arguments -S \
978    '-translate[translate by given vector]::vector:_freefoam_match_vector' \
979    '-rotateFields[also rotate vector/tensor fields]' \
980    '-rotate[rotate from first to second direction]::(vector vector):' \
981    $_freefoam_scaleVec_opt[@] $_freefoam_common_opt[@]
984 (( $+functions[_freefoam-potential] )) ||
985 _freefoam-potential() {
986    _arguments -S '-writep[also write the pressure field]' \
987    $_freefoam_common_opt[@]
990 (( $+functions[_freefoam-kivaToFoam] )) ||
991 _freefoam-kivaToFoam() {
992    _arguments -S \
993    '-zHeadMin[minimum cylinder-head height]::scalar:_freefoam_match_float "minimum cylinder-head height"' \
994    '-file[use a different kiva file from otape17]::kiva file:_files' \
995    '-version[specify kiva version]::kiva version:compadd -- kiva3{,v}' \
996    $_freefoam_case_opt[@] $_freefoam_std_opt[@]
999 (( $+functions[_freefoam-copySettings] )) ||
1000 _freefoam-copySettings() {
1001    _arguments -S ':source directory:_directories' \
1002    ':destination directory:_directories'
1005 (( $+functions[_freefoam-clearPolyMesh] )) ||
1006 _freefoam-clearPolyMesh() {
1007    _arguments -S $_freefoam_region_opt[@] $_freefoam_case_opt[@]
1010 # common completer for freefoam-graph* utilities
1011 (( $+functions[_freefoam-graph_apps] )) ||
1012 _freefoam-graph_apps() {
1013    _arguments -S ':log file:_files'
1015 for app in graphExecTime graphResKE graphResUVWP; do
1016   functions[_freefoam-$app]=$functions[_freefoam-graph_apps]
1017 done
1019 (( $+functions[_freefoam-job] )) ||
1020 _freefoam-job() {
1021    _arguments -S \
1022    '-p[run job in parallel]' \
1023    '-hosts[specify file with host names]:hostfile:_files' \
1024    '-log[specify alternate logfile name for output]:logfile:_files' \
1025    $_freefoam_case_opt[@] $_freefoam_help_opt[@] \
1026    - set1 \
1027       '-s[also send output to screen]' \
1028    - set2 \
1029       '-fg[run the job in the foreground (i.e. do not background it)]'
1032 (( $+functions[_freefoam-para] )) ||
1033 _freefoam-para() {
1034    _arguments -S $_freefoam_help_opt[@] $_freefoam_case_opt[@]
1037 (( $+functions[_freefoam-solverSweeps] )) ||
1038 _freefoam-solverSweeps() {
1039    _message "no arguments or options"
1042 (( $+functions[_freefoam-debugSwitches] )) ||
1043 _freefoam-debugSwitches() {
1044    _message "no arguments or options"
1047 (( $+functions[_freefoam-calc] )) ||
1048 _freefoam-calc() {
1049    #TODO better completion here based on the operation
1050    _arguments -S ':operation:' ':fields:' \
1051    '-noWrite[suppress output to files]' \
1052    '-dictionary[use specified dictionary]:dictionary name:_files' \
1053    $_freefoam_all_time_opt[@] $_freefoam_common_opt[@]
1056 (( $+functions[_freefoam-IFCLookUpTableGen] )) ||
1057 _freefoam-IFCLookUpTableGen() {
1058    _arguments -S ':control file:_files' \
1059    $_freefoam_all_time_opt[@] $_freefoam_common_opt[@]
1062 (( $+functions[_freefoam-surfaceMeshConvert] )) ||
1063 _freefoam-surfaceMeshConvert() {
1064    _arguments -S ':input surface file:_files -g'$_freefoam_surface_read_ex \
1065    ':output surface file:_files -g'$_freefoam_surface_write_ex \
1066    $_freefoam_coord_dict_opt[@] $_freefoam_scale_in_opt[@] \
1067    $_freefoam_from_coord_opt[@]  $_freefoam_scale_out_opt[@] \
1068    $_freefoam_to_coord_opt[@] \
1069    $_freefoam_case_opt[@] $_freefoam_std_opt[@]
1072 (( $+functions[_freefoam-surfaceMeshConvertTesting] )) ||
1073 _freefoam-surfaceMeshConvertTesting() {
1074    _arguments -S ':input surface file:_files -g'$_freefoam_surface_read_ex \
1075    ':output surface file:_files -g'$_freefoam_surface_write_ex \
1076    $_freefoam_scale_opt \
1077    '-surfMesh[also write surface mesh]' \
1078    '-unsorted[use the unsorted elements for input/output]' \
1079    '-triFace[use triFace elements for input/output]' \
1080    $_freefoam_clean_opt[@] \
1081    '-orient[check the face orientation of the input surface]' \
1082    '-triSurface[use the triSurface library for input/output]' \
1083    $_freefoam_scale_opt[@] \
1084    $_freefoam_case_opt[@] $_freefoam_std_opt[@]
1087 (( $+functions[_freefoam-surfaceMeshExport] )) ||
1088 _freefoam-surfaceMeshExport() {
1089    _arguments -S ':output surface file:_files -g'$_freefoam_surface_write_ex \
1090    '-name[specify alternative surface name for writing]:surface name:' \
1091    $_freefoam_coord_dict_opt[@] $_freefoam_clean_opt[@] \
1092    $_freefoam_scale_in_opt[@] $_freefoam_from_coord_opt[@] \
1093    $_freefoam_scale_out_opt[@] $_freefoam_to_coord_opt[@] \
1094    $_freefoam_case_opt[@] $_freefoam_std_opt[@]
1097 (( $+functions[_freefoam-surfaceMeshImport] )) ||
1098 _freefoam-surfaceMeshImport() {
1099    _arguments -S ':input surface file:_files -g'$_freefoam_surface_read_ex \
1100    '-name[specify alternative surface name for writing]:surface name:' \
1101    $_freefoam_coord_dict_opt[@] $_freefoam_clean_opt[@] \
1102    $_freefoam_scale_in_opt[@] $_freefoam_from_coord_opt[@] \
1103    $_freefoam_scale_out_opt[@] $_freefoam_to_coord_opt[@] \
1104    $_freefoam_case_opt[@] $_freefoam_std_opt[@]
1107 (( $+functions[_freefoam-surfaceRedistributePar] )) ||
1108 _freefoam-surfaceRedistributePar() {
1109    _arguments -S ':input triSurfaceMesh file:_files -g'$_freefoam_surface_read_ex \
1110    ':distribution type:' \
1111    '-keepNonMapped[preserve surface outside of mesh bounds]' \
1112    $_freefoam_common_opt[@]
1115 (( $+functions[_freefoam-uncoupledKinematicParcel] )) ||
1116 _freefoam-uncoupledKinematicParcel() {
1117    _arguments -S \
1118    '-cloudName[use an alternative cloude name to kinematicCloud]:cloud name:' \
1119    $_freefoam_common_opt[@]
1122 (( $+functions[_freefoam-upgradeFvSolution] )) ||
1123 _freefoam-upgradeFvSolution() {
1124    _arguments -S \
1125    '-test[suppress writing the updated fvSolution file]' \
1126    $_freefoam_case_opt[@] $_freefoam_std_opt[@]
1129 local curcontext=$curcontext ret=1
1130 local state line
1131 declare -A opt_args
1133 # handle arguments to the 'freefoam' command
1134 _arguments -C -S \
1135 '-b[FreeFOAM base directory]::directory:_directories' \
1136 '-P[also use the system PATH variable]' \
1137 '-p[print command line instead of executing it]' \
1138 '(-h -help)'{-h,-help}'[display help message]' \
1139 '(-v -version)'{-v,-version}'[display version information]' \
1140 '*::arg:->cmd_or_options' && return
1141 # if we have a sub-command, invoke its respective completer
1142 case $state in
1143    (cmd_or_options)
1144       if (( CURRENT == 1 )); then
1145          # list the available commands
1146          _freefoam_applications
1147       else
1148          curcontext="${curcontext%:*:*}:freefoam-$words[1]:"
1149          # if we defined a specific completer for the command, invoke it
1150          if (( $+functions[_freefoam-$words[1]] )); then
1151             _call_function ret _freefoam-$words[1]
1152          fi
1153       fi
1154       ;;
1155 esac
1157 return ret
1161 _freefoam
1163 # ------------------------- vim: set sw=3 sts=3 et: --------------- end-of-file