📄 installation.html
字号:
are shipped with QMG. But you may use your system's built-inLapack/BLAS or just BLAS alone, which may be more efficient. In thiscase, you should customize the file named <code>custom</code> accordingto the instructions in that file.<h3>Special note for Visual C++ users</h3>Itis recommended that you updatethe standard header files for Visual C++ 5.0 according to the <a href="http://www.dinkumware.com/vc_fixes.html">Dinkumware website</a> before compiling QMG. This fixes many bugs in the versionsof the standard headers shipped with VC++ 5.0. It is not clear whetherthese bugs are fixed in VC++ 6.0.<p>In addition, there is one more patch that is not reportedon the Dinkumware website. The followingcode using standard class <code>ostringstream</code>requires O(n<sup>2</sup>) time in VC++5.0:<blockquote><code>using std::ostringstream;<br>ostringstream os;<br>for (int i = 0; i < n; ++i)<br> os << i;</code></blockquote>This severely impacts the performanceof conversion-to-string of breps andmeshes in Tcl/QMG. It affects several other operationsas well. To reduce the running time to O(n), makethe following change to include-file <code>SSTREAM</code>.Replace the line<blockquote><code> size_t _Ns = _Os + _Alsize;</code></blockquote>with<blockquote><code> size_t _Ns = (_Alsize > _Os)? _Os + _Alsize : 2 * _Os + 1;</code></blockquote><p><strong>Note: changing standard headers will affect all your C++ development (not just QMG). Any changes you make to standard headers are ENTIRELY AT YOUR OWN RISK. It is possible that the changesproposed above will cause other software to malfunction.The author of QMG, Cornell Universityand other organizations involved with QMG offer NO WARRANTYconcerning patches to Visual C++ mentioned here(or anything else mentioned in this documentation) anddisclaim all liability.See the <a href="copyright.html">license terms</a> accompanying QMG for information about disclaimers.</strong><h2> General hints on customization</h2>You may have to spend someeffort in getting a working makefile. In general, it will beeasier to compile the software for Tcl/Tk than for forMatlab. There aretwo stumbling blocks in compiling QMG for Matlab.<p>The QMG source code uses a feature of the C++ language called“templates.”A template is a parameterized type and is associated with several parameterized functions. These parameterized functionsmust get instantiated by the C++ compiler into actual linkablefunctions. The instantiated template functions then must get storedin a .o file somewhere that the C++ compiler knows about. DifferentC++ compilers handle this in different ways. For example, for the Mips-Pro 7.3 C++ compiler, the flag<code>-ptused</code> is needed when compiling QMG for Matlab.<p>The second stumbling block in linking C++ object files to Matlabconcerns libraries. A typical C++ compiler will link in one or moredifferent libraries whose names you may have to figure out.Many Unix C++ compilers (not egcs though)link a file called libC.a, so it is likely that youwill need -lC as an option to the link command.<p>Many C++ compilers have a option (possibly named -v)to display the steps of compilation.This will help you figure out which libraries are involved in linkingC++ code. The mex command also has a -v option; this option willshould you what the default libraries used by mex are. By experimentingwith these, you can probably figure out what additional -l and -L options togive the link command.<h2> Customizing the source code </h2>It should not necessary to customize the source code itself forvarious platforms because the C++ used is fully standard-conforming. There are some bugs in some of the compilerswhich required special #ifdef/#endifpairs in the source code.The source code uses templates, the standard template library,streams, inheritance, namespaces,and exceptions. It also uses a very simple form of member templates.Exceptions can be turned off (under Matlab)by not defining ENABLE_EXCEPTIONS in the Makefile. In this case,when an error occurs and control isreturned back to Matlab,QMG will not release memory allocated to it, and some filesmay not be closed. (Memory is released and files will be closedwhen you exit Matlab.)<p>QMG 2.0 does not use RTTI, multiple inheritance, template specialization, default template arguments,function templates.On some platforms, you must enable RTTI eventhough QMG does not use it because exception-handling may require RTTI.<p>QMG assume that unsigned ints have at least 32 bits. If your systemuses fewer bits for unsigned ints, try modifying the <strong>typedef</strong> statementfor UInt32 in $QMG_ROOT/src/common/qnamesp.h. Note: this has not beentested. Similarly, QMG assumes IEEE-conforming double-precisionarithmetic. If your system uses some other kind of arithmetic, pleasemodify the constants BIG_REAL and MACHINE_EPS in that file. Pleasealso change the global variable <code>gm_default_tol</code>accordingly.<h1><a name="env"> Setting up your environment</a> </h1>For viewing 3D breps and surface meshes in Tcl QMG, you need a VRML viewerinstalled in your web browser. For information about VRML includingbrowsers,see the <a href="http://www.web3d.org/vrml/">repository</a>. You needa viewer that can handle VRML 1.0. Note: VRML 2.0 is not upwardcompatible with VRML 1.0, but many VRML 2.0 viewers also support VRML 1.0.<p>You also need to set some environment variables. These aredescribed in a readme file that is unpacked in the$QMG_ROOT directory. In particular, <ul><li>if you download source code, see <code>readme_src</code>.<li>if you download Windows/Matlab executables, see <code>readme_matlab</code>.<li>if you download Windows/Tcl executables, see <code>readme_tcl</code>.</ul> For example,the environment variable QMG_ROOT should be set to the directorywhere the software is installed.<h1>Running QMG</h1>Once the environment variables are set, you can run QMG.To run the Matlab version of QMG, start matlab from the directory$QMG_ROOT/ex. This directory has a <code>startup.m</code> file that sets allthe paths correctly. To run the Tcl/Tk version of QMG, change tothe <code>unixtcl</code> or <code>windowstcl</code> subdirectory$QMG_ROOT/build. In that directory there is an executable called<code>qmg</code>. Running this executable (no arguments) startsQMG.<h2>Testing</h2>There are 11 tests shipped with QMG.To run through all the tests at once,execute the statement <blockquote><code>alltests</code></blockquote> in Matlab or<blockquote><code>source $qmg_library2/alltests.tcl</code></blockquote> in Tcl/Tk. This willleave a series of files test1.di,...,test11.di that you can compare to the di files shipped with QMGin directories $QMG_ROOT/tcl2 and $QMG_ROOT/mfiles2.Running this command will take at least 5 minutes,and possibly more than an hour, depending on the speedof your computer. The Matlab version takes slightly longerbecause test7 solves a finite element problem in Matlab butnot in Tcl.<p>After <code>alltests</code> is done on either scripting language, there are twoglobal variables set, <code>meshsizesum</code>, which is the sum ofthe number of vertices in each mesh generated by each test, and<code>aspprod</code>, which isthe product of the worst-case aspect ratios of each mesh. These numbers should come out to 8473 and approximately 8.822e18.If so, then you have successfully installed QMG.<p>The tests can also be run individually. In Matlab, this isaccomplished by typing <code>test1</code>, then <code>test2</code>, and so on. In Matlab you can first issue an <strong>echo on</strong> or <strong>diary</strong> command.To run the tests underTcl/Tk, you can type either <blockquote><code>source $qmg_library2/test1.tcl</code></blockquote> or<blockquote><code>gmevallog $qmg_library2/test1.tcl</code></blockquote> and so on up to <code>test11.</code>The <code>source</code> command does not echo commands as they are executed, whereasthe <a href="ref.html#gmevallog"><code>gmevallog</code></a> command does.<p>If you are running the tests interactively, you can set the globalvariable <code>interactive</code> to 1. In Matlab this is done by:<blockquote><code>global interactive<br> interactive=1</code></blockquote>In Tcl/Tk this is done by: <code>set interactive 1</code> fromthe QMG shell. Setting this variable causes the tests togenerate plots and pause as they execute.Finally, there is an interactive script called testviz to test the graphics capabilities ofQMG. Type <code>testviz</code> in matlab or<code>source $qmg_library2/testviz.tcl</code> in Tcl/Tk.<hr><p>This documentation is written by <a href="http://www.cs.cornell.edu/home/vavasis/vavasis.html">Stephen A. Vavasis</a> and iscopyright ©1999 by <a href="http://www.info.cornell.edu/CUHomePage.html">Cornell University</a>.Permission to reproduce this documentation is granted provided thisnotice remains attached. There is no warranty of any kind onthis 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>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -