?? standalone.html
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Invoking QMG from the shell</title>
</head>
<body BGCOLOR="#E0FFE0" TEXT="#000000" LINK = "#0080C0" VLINK = "#004060" ALINK = "#FF0000" >
<center>
<table>
<tr>
<td>
<a href="qmg2_0_home.html"><img src=logo1.jpg alt="QMG logo"></a></td>
<td>
<h1>
Invoking QMG from the shell
</h1>
</td>
</table>
</center>
Although most of this documentation covers the use of QMG
from within the Matlab or Tcl/Tk scripting environments,
it is also possible to invoke QMG functions directly from the Unix
or Windows shell. Only a subset of QMG functionality
is available from the shell, namely:
<ul>
<li>
<a href="#meshgen">mesh generation</a>,
<li>
<a href="#checktri">checking a triangulation</a>,
<li>
<a href="#double">doubling internal boundaries</a>,
<li>
<a href="#translate">translating between Ascii and XDR</a>.
</ul>
Note that you could extend this list to make more
functions available from the shell by rewriting the
file $QMG_ROOT/tcl/qmg_batch_init.tcl to incorporate
more functionality.
<p>
To install QMG, follow the
<a href="installation.html">instructions</a> for Tcl/Tk
installation.
<p>
Once installation is complete, you should move or copy
the binary to a location on your path.
You also need to set the environment variables
as documented in the readme file shipped with QMG.
<p>
You can test shell-command invocation of QMG using
the command <code>testshellqmg</code>, which is a
script file. (In Windows, the file is named
<code>testshellqmg.bat</code>.) This command is in
both the <code>unixtcl</code> and <code>windowstcl</code>
subdirectories of QMGROOT/build. The printout from this
command looks something like this.
<blockquote>
<pre>
<code>
... generating a mesh for the hexobj 3D geo
qmg -meshgen -show 0 -fileformat ascii -logfile /dev/null -orientation 2 -curvecontrol "(const 1)" -tol 1e-12 ../../data/hexobj.geo hexobj.msh
... mesh has been generated; doubling internal boundaries
qmg -double2 -fileformat ascii ../../data/hexobj.geo hexobj.msh hexobj_d.geo hexobj_d.msh \*
... internal boundary has been doubled; checking the mesh
qmg -checktri -fileformat ascii -orientation 2 -tol 1e-12 hexobj_d.geo hexobj_d.msh
Maximum aspect ratio = 72.4505 achieved in
simplex #1125 of topological entity hexnutcrack (3:0) which has vertices 314 3 442 445
Maximum global side length = 0.780871
Minimum global altitude = 0.00196405
Number of nodes = 758 number of elements = 3182
... checktri has finished; removing files created by this script
</code>
</pre>
</blockquote>
<p>
Invoking QMG with
no arguments like this
<blockquote>
<code>
qmg
</code>
</blockquote>
starts the interactive Tcl console.
Specific qmg functions are obtained directly in the shell by
additional arguments on the command line according to the
following list.
In this list,
italicized curly braces indicate optional arguments,
and vertical lines indicate either-or choices.
<p>
<strong>SPECIAL NOTE FOR WINDOWS USERS:</strong> Many of QMG's
shell commands take
file names as arguments. Use forward slashes to separate
directories, not
backward slashes.
<h3><a name = "meshgen">Mesh generation</a></h3>
To generate a mesh, use
<blockquote>
<strong>
qmg -meshgen <em>{</em>-fileformat ascii|xdr<em>}</em> <em>{</em>-sizecontrol <em>sizecontrolfunction}</em>
<em>{</em>-curvecontrol <em>curvecontrolfunction}</em>
<em>{</em>-show 0|1<em>} </em>
<em>{</em>-orientation 1|2<em>}</em>
<em>{</em>-tol <em>tolerance</em>}</em>
<em> infile outfile </em>
</strong>
</blockquote>
Here <em>infile</em> is the name of a file
holding a brep and <em>outfile</em> is the name of
a file that will hold
the mesh. If this file already exists, an error message is
issued.
<p>
Command options are:
<blockquote>
<table cellpadding=6>
<tr>
<td valign = top>
<strong> -fileformat <em>format</em></strong>
</td>
<td>
Controls the file format for both input and output: <em>format</em>
is either ascii or xdr. The default is xdr.
</tr>
<tr>
<td valign = top>
<strong> -sizecontrol <em>functionname</em>
</strong>
</td>
<td>
Sets <a href="meshgen.html#sizecontrol">size control function</a>.
For instance, -sizecontrol "(const 1)"
sets a global upper bound on element size of 1.0. The default
value is "(const 1e307)", i.e., no upper bound on the element size.
Note that the quotes are needed by the Windows and most Unix
shells so that the entire string is regarded as a single argument.
</td>
</tr>
<tr>
<td valign = top>
<strong>
-curvecontrol <em>curvecontrolfunction</em>
</strong>
</td>
<td>
Tells the mesh generator how closely to follow the
<a href="meshgen.html#curvecontrol">curvature</a> of the
boundary. The default is "(const .5)", which allows normals to
diverge by as much as about 20-30 degrees over an element. A looser
setting, say "(const 1)", yields meshes with fewer elements but
possibly with worse aspect ratio. It's theoretically possible that
the aspect ratio could be far worse when the curvature control setting
is raised.
Note that the quotes are needed by the Windows and most Unix
shells so that the entire string is regarded as a single argument.
</td>
<tr>
<td valign = top>
<strong>
-show 0|1
</strong>
</td>
<td>
Controls whether a panel showing mesh generation progress should be
displayed on your screen. If the setting is 0 (the default), no panel
is displayed; if the setting is 1, then the panel is displayed and
updated about once per second (although there is sometimes a lengthy
delay right at the beginning of mesh generation). You must set
environment variable DISPLAY if you choose to show the panel. When
<strong>-show 1</strong>
is selected, this command does not exit until you click the
"dismiss" button in the panel. Therefore, if you are running in batch
mode or from a script then you should pick -show 0.
</td>
<tr>
<td valign = top>
<strong>
-orientation 1|2
</strong>
</td>
<td>
Controls the orientation of the simplices generated by the
mesh-generator. Orientation 1 (default) means right-handed;
orientation 2 means left-handed.
</td>
<tr>
<td valign = top>
<strong>
-tol <em>tolerance</em>
</strong>
</td>
<td>
Controls the tolerance used by geometric operations in the
mesh generator. The default is 1e-14.
</td>
<tr>
<td valign = top>
<strong>
-logfile <em>filename</em>
</strong>
</td>
<td>
Specifies the filename to write the mesh generation log.
The default is mglogXXX, where XXX is the number of the process.
Use <code>/dev/null</code> under Unix or <code>nul</code> under
Windows to discard the log.
</td>
</table>
</blockquote>
The <strong>qmg -meshgen</strong>
command leaves a log file in the current working
directory called mglogXXX, where XXX is the process ID.
So you must have write-access to
the CWD when this command is executed.
<h3><a name="checktri">Checking a mesh</a></h3>
To check mesh quality, use
<blockquote>
<strong>
qmg -checktri <em>{</em>-fileformat ascii|xdr<em>}</em>
<em>{</em>-checkorientation 0|1|2<em>}</em>
<em>{</em>-tol <em>tolerance}</em>
<em>brepfile meshfile</em>
</strong>
</blockquote>
This command checks correctness of a mesh, and also computes the
aspect ratio of the worst element. It prints the results to stdout.
The <em>brepfile</em>
argument is the name of a file holding a brep, and the
<em>meshfile</em> argument holds a mesh for that brep.
Command options are:
<blockquote>
<table cellpadding = 6>
<tr>
<td valign = top>
<strong>
-fileformat <em>format</em>
</strong>
<td>
Controls the file format for input, either ascii or xdr. The default
is xdr.
</tr>
<tr>
<td valign = top>
<strong>
-checkorientation 0|1|2
</strong>
<td>
If this is set to 1 (default), then the routine checks that all
elements have right-handed orientation (the default orientation
produced by QMG). If this is set to 2, then every element is checked
for left-handed orientation. Finally, if this is 0, then orientation
is not checked.
</tr>
<tr>
<td valign = top>
<strong>
-tol <em>tolerance</em>
</strong>
<td>
Relative tolerance for how close mesh nodes must lie on faces.
Default is 1e-14.
</td>
</tr>
</table>
</blockquote>
<h3><a name="double">Doubling the internal boundaries of a
brep</a></h3>
There are two calling formats for doubling.
To double the internal boundaries of a brep, use
<blockquote>
<strong>
qmg -double1 <em>{</em>-fileformat ascii|xdr<em>}</em>
<em>{</em>-tol tolerance<em>}</em> <em>brepinfile</em>
<em>brepoutfile</em>
<em>"facename1 facename2 ... facenamek"</em>
</strong>
</blockquote>
This command replaces internal boundaries with two copies of that
internal boundary. The <em>brepinfile</em> argument is the
name of the file holding the
input brep. After doubling, the brep is rewritten to
a file named <em>brepoutfile</em>,
which must be a file that doesn't already exist. The last argument is
the list of names of topological surfaces that are to be doubled.
Each surface in this list must be an internal boundary, i.e., it must
occur twice in the "child" list of a region.
<p>
This routine also reorients boundaries so that all patches have the
correct orientation.
<p>
The list of facenames may be empty "", in which case the routine simply
reorients patches. It may also be *, meaning double every internal
boundary. Note: in many shells, you must proceed
the * with a backslash to prevent the shell from interpreting it.
<p>
The second calling format is:
<blockquote>
<strong>
qmg -double2 <em>{</em>-fileformat ascii|xdr<em>}</em>
<em>{</em>-tol <em>tolerance} brepinfile
meshinfile brepoutfile meshoutfile
"facename1 facename2 ... facenamek"</em>
</strong>
</blockquote>
This command replaces an internal boundary with two copies of that
internal boundary and replaces mesh nodes along that boundary with two
copies, one for either side. The <em>brepinfile</em>
argument is the file
holding the input brep, and <em>meshinfile</em>
is a file holding a mesh for
that brep. After doubling, the brep and mesh are rewritten to files
<em>brepoutfile</em> and <em>meshoutfile</em>,
which must be files that don't already
exist. The last argument is the list of names of topological surfaces
that are to be doubled and was described above.
<p>
This routine also reorients boundaries so that all patches have the
correct orientation.
For more information, see the <a href="fe.html#double">
section</a> on doubling in the finite element page.
<p>
The options are as follows:
<p>
<blockquote>
<table cellpadding = 6>
<tr>
<td valign = top>
<strong> -fileformat <em>format</em></strong>
</td>
<td>
Controls the file format for both input and output: <em>format</em>
is either ascii or xdr. The default is xdr.
</tr>
<tr>
<td valign = top>
<strong>
-tol <em>tolerance</em>
</strong>
<td>
Relative tolerance for how close mesh nodes must lie on faces.
Default is 1e-14.
</td>
</tr>
</table>
</blockquote>
<h3><a name="translate">Translating file formats</a></h3>
To translate from xdr to ascii or back, use the command
<blockquote>
<strong>
qmg -translate toascii|toxdr <em> infile outfile</em>
</strong>
</blockquote>
The first argument after <strong>-translate</strong>
controls the direction of translation,
either <strong>toascii</strong> (i.e., from xdr to Ascii)
or <strong>toxdr</strong> (i.e., from Ascii to xdr). The
<em>infile</em> argument is the name of a file
with the object to be translated, and the result is written
to a file named <em>outfile</em>.
This file must not already exist.
<hr>
<p>
This documentation is written by
<a href="http://www.cs.cornell.edu/home/vavasis/vavasis.html">Stephen A.
Vavasis</a> and is
copyright ©1999 by <a href="http://www.info.cornell.edu/CUHomePage.html">Cornell
University</a>.
Permission to reproduce this documentation is granted provided this
notice remains attached. There is no warranty of any kind on
this software or its documentation. See the accompanying file
<a href="copyright.html">'copyright'</a>
for a full statement of the copyright.
<p>
<address>
Stephen A. Vavasis, Computer Science Department, Cornell University,
Ithaca, NY 14853, vavasis@cs.cornell.edu
</address>
</body>
</html>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -