Posts

Showing posts from October, 2006

QT 3.0 简明安装、使用指南

编译 QT。 编辑 /etc/profile 文件,输入: QTDIR=”/usr/local/qt” PATH=”$QTDIR/bin:$PATH” LD_LIBRARY_PATH=”$LD_LIBRARY_PATH” QMAKESPEC=”linux-g++” export QTIDR PATH LD_LIBRARY_PATH QMAKESPEC QMAKESPEC 环境变量可参考 $QTDIR/mkspec 目录中的名字,各位可根据自己的系统编译环境进行设置。 比如你用 Microsoft Visual Studio 编译程序,那么就要设置如下环境变量: QMAKESPEC=”win32-msvc” 用 Linux 就这样设置: QMAKESPEC=”linux-g++” 2. 编译 QT。 cd /usr/local/qt ./configure make 美美地睡 N 个小时… qmake 3. 用 QT 3.0 编译程序。 这里假设你已经用 QT Designer 做好一个窗体并已写好了相关事件的响应代码,下面在 QT Designer 中选择 File|New 菜单并选择 “C++ Main-File (main.cpp)” 项,然后保存。 切换到命令行方式,输入: qmake make 第二次编译时就不必再输入 qmake 了,因为 make 会为你代劳。 OK! 事情就是这样了的了,要想知道更具体的使用方法请看 QT 的帮助文件。Enjoy!

define parameter

we'll run it at every 0.6 time units (about 10 times per period) via (at-every 0.6 output-efield-z).(run-until 200 (at-beginning output-epsilon) (to-appended "ez" (at-every 0.6 output-efield-z))) we often want to explore many different values of such parameters. For example, we may want to change the size of the cell, so we'll define it as: (define-param sx 16) ; size of cell in X direction (define-param sy 32) ; size of cell in Y direction (set! geometry-lattice (make lattice (size sx sy no-size))) define-param is a libctl feature to define variables that can be overridden from the command line. We could now do meep sx=17 tut-wvg-bend-trans.ctl to change the X size to 17, without editing the ctl file, for example. We'll also define a couple of parameters to set the width of the waveguide and the "padding" between it and the edge of the computational cell:
Moreover, since c = 1 in Meep units, a (or a / c) is our unit of time as well. In particular, the frequency ω in Meep (corresponding to a time dependence e − iωt) is always specified in units of 2πc / a, which is equivalent to specifying ω as 1 / T: the inverse of the optical period T in units of a / c. This, in turn, is equivalent to specifying ω as a / λ where λ is the vacuum wavelength. (A similar scheme is used in MPB.) For example, suppose we are describing some nanophotonic structure at infrared frequencies, where it is convenient to specify distances in microns. Thus, we let a = 1μm. Then, if we want to specify a source corresponding to λ = 1.55μm, we specify the frequency ω as 1/1.55 = 0.6452. If we want to run our simulation for 100 periods, we then run it for 155 time units (= 100 / ω). On a computer, we can only simulate a finite region of space, which means that we must terminate our simulation with some boundary conditions. Three basic types of terminations are supported i
The MIT Photonic-Bands ( MPB ) package is a free program for computing the band structures (dispersion relations) and electromagnetic modes of periodic dielectric structures, on both serial and parallel computers. This program computes definite-frequency eigenstates (harmonic modes) of Maxwell's equations in periodic dielectric structures for arbitrary wavevectors, using fully-vectorial and three-dimensional methods. It is especially designed for the study of photonic crystals (a.k.a. photonic band-gap materials), but is also applicable to many other problems in optics, such as waveguides and resonator systems. (For example, it can solve for the modes of waveguides with arbitrary cross-sections.) As complementary Meep package works for time-domain simulations, reflection/transmission spectra, etc. (MPB is frequency-domain; Meep is Time-domain.) There are two common computational approaches to studying dielectric structures such as photonic crystals: frequency-domain and time-domai

在Redhat Linux上安装 GCC 编译器过程

2004年4月20日最新版本的GCC编译器3.4.0发布了。目前,GCC可以用来编译C/C++、FORTRAN、JAVA、OBJC、ADA等语言的程序,可根据需要选择安装支持的语言。GCC 3.4.0比以前版本更好地支持了C++标准。本文以在Redhat Linux上安装GCC3.4.0为例,介绍了GCC的安装过程。 安装之前,系统中必须要有cc或者gcc等编译器,并且是可用的,或者用环境变量CC指定系统上的编译器。如果系统上没有编译器,不能安装源代码形式的GCC 3.4.0。如果是这种情况,可以在网上找一个与你系统相适应的如RPM等二进制形式的GCC软件包来安装使用。本文介绍的是以源代码形式提供的GCC软件包的安装过程,软件包本身和其安装过程同样适用于其它Linux和Unix系统。 系统上原来的GCC编译器可能是把gcc等命令文件、库文件、头文件等分别存放到系统中的不同目录下的。与此不同,现在GCC建议我们将一个版本的GCC安装在一个单独的目录下。这样做的好处是将来不需要它的时候可以方便地删除整个目录即可(因为GCC没有uninstall功能);缺点是在安装完成后要做一些设置工作才能使编译器工作正常。在本文中我采用这个方案安装GCC 3.4.0,并且在安装完成后,仍然能够使用原来低版本的GCC编译器,即一个系统上可以同时存在并使用多个版本的GCC编译器。 按照本文提供的步骤和设置选项,即使以前没有安装过GCC,也可以在系统上安装上一个可工作的新版本的GCC编译器。 1. 下载 在GCC网站上(http://gcc.gnu.org/)或者通过网上搜索可以查找到下载资源。目前GCC的最新版本为 3.4.0。可供下载的文件一般有两种形式:gcc-3.4.0.tar.gz和gcc-3.4.0.tar.bz2,只是压缩格式不一样,内容完全一致,下载其中一种即可。 2. 解压缩 根据压缩格式,选择下面相应的一种方式解包(以下的“%”表示命令行提示符): % tar xzvf gcc-3.4.0.tar.gz 或者 % bzcat gcc-3.4.0.tar.bz2 | tar xvf - 新生成的gcc-3.4.0这个目录被称为源目录,用${srcdir}表示它。以后在出现${srcdir}的地方,应该用真实的路径来替换它。用pwd命令可以查看当前路径。 在${srcdir}

REDHAT AS 3.0下安装 GCC

安装gcc后,你的系统就具有编译c/c++等源码的功能,我的安装过程如下 注意:要把安装过程中所用到的软件包复制到相关的目录 1. 输入命令rpm -i gcc-3.2.3-34.i386.rpm error: Failed dependencies: cpp = 3.2.3-34 is needed by gcc-3.2.3-34 glibc-devel >= 2.2.90-12 is needed by gcc-3.2.3-34 libgcc >= 3.2.3-34 is needed by gcc-3.2.3-34 Suggested resolutions: glibc-devel-2.3.2-95.3.i386.rpm 2. 输入命令rpm -i gcc-3.2.3-34.i386.rpm glibc-devel-2.3.2-95.20.i386.rpm libgcc-3.2.3-34.i386.rpm cpp-3.2.3-34.i386.rpm error: Failed dependencies: glibc-headers is needed by glibc-devel-2.3.2-95.20 glibc-headers = 2.3.2 is needed by glibc-devel-2.3.2-95.20 Suggested resolutions: glibc-headers-2.3.2-95.3.i386.rpm 3. 输入命令rpm -i gcc-3.2.3-34.i386.rpm glibc-devel-2.3.2-95.20.i386.rpm libgcc-3.2.3-34.i386.rpm cpp-3.2.3-34.i386.rpm glibc-headers-2.3.2-95.20.i386.rpm error: Failed dependencies: kernel-headers is needed by glibc-headers-2.3.2-95.20 kernel-headers >= 2.2.1 is needed by glibc-heade