?? howto.tex
字號(hào):
\documentclass{article}\usepackage{listings}\newcommand{\exmp}[1]{\textsf{Ex#1}}\newcommand{\code}[1]{\texttt{#1}}\parindent0ex\oddsidemargin 0in\evensidemargin 0in\headheight 2\baselineskip\textwidth 6.5in\textheight 9.0in\begin{document}\lstset{language=C++}\title{Libmesh HOWTO}\author{\texttt{libmesh-users@lists.sourceforge.net} \\ $$Revision: 2501 $$}\maketitle\section{General usage}\label{sec:usage-tips}\subsection{Debug / Profile mode}\label{sec:debug-profile}Debugging and profiler modes can be switched on with \code{make METHOD=dbg}and \code{make METHOD=pro}. For syntax checking use \code{make METHOD=syn}.\subsection{Performance logging}\label{sec:performance-logging}\begin{itemize}\item Create a logger: \code{PerfLog perf\_log ("Matrix Assembly")} \exmp{4}.\item Start logging: \code{perf\_log.start\_event("elem init")}\item Stop logging: \code{perf\_log.stop\_event("elem init");}\end{itemize}\subsection{Petsc-Tools}\label{sec:petsc-tools}Use the Petsc tools as command line parameters to the program invocation,e.g.~\code{./myTestProgram -log\_summary}. Frequently used options are\begin{itemize}\item -log\_summary: show setup and performance\item -log\_info: show setup\item -ksp\_monitor: show convergence\end{itemize}\section{Basic tasks}\label{sec:basic-tasks}\subsection{Restart a model}\label{sec:restart}Restarting a model is done by loading a simulation, that has been stored with \code{equation\_systems.write}. It is stored either in a ASCII-File or in theHDF format. It is read with \code{equation\_systems.read}. (\exmp{2}).\subsection{Translate / deform / rotate a mesh}\label{sec:translate}A mesh object can be translated, deformed or rotated with\begin{lstlisting} MeshTools::Modification::translate(mesh, 10., 1.); MeshTools::Modification::rotate(mesh, 90., 10. 0.);\end{lstlisting}\subsection{Equation system parameters}\label{sec:EQSParameter}Equation system parameters are set with the following methods\\[1ex]\lstinline!es.parameters.set<Real> ("myParam") = 42.;!. \\\lstinline!es.parameters.set<unsigned int> ("linear solver maximum iterations") = 250;! \\[1ex]Their values can later be obtained with \\[1ex]\lstinline!Real answer = es.parameters.get<Real> ("myParam");!. \\\subsection{Write to postprocessing file}\label{sec:postprocessing}Libmesh supports many post-processing file types. Writing the mesh is as easy as\\[1ex]\lstinline!GMVIO(mesh).write("out.gmv");!\\[1ex]Writing a the mesh together with the current solution is equally simple\\[1ex]\lstinline!GMVIO(mesh).write_equation_systems ("out.gmv", es);!\subsection{Add an additional vector, and project it on refined meshes}\label{sec:add_vector}Add a new vector to a system with \code{system.add\_vector("myvec");}. \\ Uponmesh refinement, the vector can be projected onto the new mesh with \code{system.project\_vector(system.get\_vector("myvec"));}.\section{Programming tips}\label{sec:programming-tips}\subsection{Autopointer}\label{sec:autopointer}Automatically take care of a pointer (safely delete it when it goes out ofscope) \code{AutoPtr<FEBase>} (\exmp{5})\subsection{Scopes}\label{sec:scopes}Even in a very simple main program the there need to be scopes so thatthe variables go out of scope before ending PetSc.\begin{lstlisting}libMesh::init (argc, argv); { Mesh mesh(3); } return libMesh::close();\end{lstlisting}\end{document}%%% Local Variables: %%% mode: latex%%% TeX-master: t%%% End:
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -