Compile METIS-5.1.0/ParMETIS-4.0.3 in mingw64 gcc 5.2.0

Following three modifications are needed to compile METIS-5.1.0:

1.  Modify line 4 of CMakelists.txt from
set(GKLIB_PATH "GKlib" CACHE PATH "path to GKlib")
    to
set(GKLIB_PATH "${CMAKE_SOURCE_DIR}/GKlib" CACHE PATH "path to GKlib")

2. Delete POSIX include file #include <sys/resource.h> in gk_arch.h. Seems allright.

3.  Exclude
--------------
extern int gk_getopt(int __argc, char **__argv, char *__shortopts);
extern int gk_getopt_long(int __argc, char **__argv, char *__shortopts,
              struct gk_option *__longopts, int *__longind);
extern int gk_getopt_long_only (int __argc, char **__argv,
              char *__shortopts, struct gk_option *__longopts, int *__longind);
--------------
in file gk_getopt.h by, e.g.

#if !defined _MINGW64
extern int gk_getopt(int __argc, char **__argv, char *__shortopts);
extern int gk_getopt_long(int __argc, char **__argv, char *__shortopts,
              struct gk_option *__longopts, int *__longind);
extern int gk_getopt_long_only (int __argc, char **__argv,
              char *__shortopts, struct gk_option *__longopts, int *__longind);
#endif


To compile ParMETIS-4.0.3
1. Set GKLIB_PATH like
set(GKLIB_PATH "${CMAKE_SOURCE_DIR}/metis/GKlib" CACHE PATH "path to GKlib")

2.  Add a line "include( findMPI )" in front of  "include_directories(${MPI_INCLUDE_PATH})" inside CMAKElistx.txt
     For those who use MSMPI, you should be include <_mingw.h> in mpi.h of MSMPI. Otherwise there should be undefined data type errors.

3. Do above modification 2,3 for metis compile.

Code::Blocks + GLUT + FLTK

Code::Blocks provides project templates for both GLUT and FLTK, but no for GLUT + FLTK. Here is a procedure to build a simple GLUT + FLTK program in Code::Blocks.


1.  Build up a new project for GLUT by using the Code::Blocks' template.
2.  Add search directories setting to the include and library directories of FLTK.
3.  Modify #include <GL/glut.h> in main.cpp to #include<FL/glut.H>
4.  Modify the Linker settings as follows
   1)  Add other linker options:  -mwindows
   2)  Link libraries as: fltk_images, fltk_gl, fltk, fltk_png, fltk_z, fltk_jpeg, glu32, opengl32, ole32, uuid, comctl32. Pay attention to that the sequential order of those libraries is important.


The project would be rebuilt successfully. You can then add FLTK functions as you like.

How to install GLUT for mingw

There are some binary distribution of glut in windows available, such as here. But it is not sure if they are available for your system, the version of your gcc compiler on your mingw32 or mingw64 etc. On the other hand, it is not easy to compile its sourcecode in mingw. However, freeglut provides cmake support for cross platform compiling. It is therefore suggested that freeglut, which provides binary distribution also, be adopted.


1. Compile freeglut by using cmake.


2. Keeping the include, library  and dll file of freeglut available and compile like:
    g++ -Os -Wall test.cc -o test -mwindows -lfreeglut -lopengl32 -lglu32


That's all.

如何将windows的dll库文件转换为mingw库文件

1  下载gendef
http://sourceforge.net/projects/mingw/files/MinGW/Extension/gendef/gendef-1.0.1346/


2.  执行gendef dll库文件名产生def文件
   如  gendef msmpi.dll 将产生 msmpi.def


3   执行dlltool -d msmpi.def -l libmpi.def -l libmsmpi.a -D msmpi.dll 将库文件名产生libmsmpi.a


如果要在64位机上使用msmpi,除此以外还需
1)  在/Inc/mpi.h文件的第128行,加上
     #include <stdint.h>
2) 如果使用非intel编译器,如gfortran,还需将/Inc/mpif.h文件用用mpich中的相关文件替代。

Build Trilinos in VS+intel compiler

Following software are used:
1). Trilinos 11.14.1
2). Visual studio 2012
3). Intel compiler Composer XE2013
4). cmake 3.2.1


1.  Begin with intel Command Prompt Visual Studio 2012 mode
2.  Type in : cmake-gui to open cmake gui
3.  First configure in cmake
     Specif the generate for this project: " Visual studio 11 2012 Win64"
     Speify native compiler: Here you set CMAKE_C_COMPILER.  CAMKE_CXX_COMPILER and CMAKE_FORTRAN_COMPILER to icl, ifort respectively.


4.  Afetr first configuration, Turn off Tilinos_ENABLE_OPTIONAL_PACKAGES because most libraries in trilinos cannot be compiled in windows. Turn on Trilinos_ENABLE_Epetra, Trilinos_ENABLE_Epetraext, Trilinos_ENABLE_ML. Turn on Triluinos_ENABLE_Fortran, TPL_ENABLE_MPI if needed.


5. Do configure


6. Libraries like BLAS, LAPACK, MPI maybe missing. Set
   BLAS_LIBRARIES_DIRS = /pahto/mkl/lib/intel64
   BLAS_LIBRARIE_MAKE = mkl_intel_lp64


   LAPACK_LIBRARIES_DIRS = /pahto/mkl/lib/intel64
   LAPACK_LIBRARIE_MAKE = mkl_intel_lp64


  MPI_BASE_DIR = C:/Program Files/Microsoft HPC Pack2012/
  ........
by hand.


7.  Do configure
8. Do generate. You would get MSVC solution files.
9. Double click Trillinos.sln.
10. Add a preprocessor definition ICL and compile.

Build Opensees in Visual studio 2012

SVN version of Opensees: 5841
OS:  Windows 7
Visual studio 2012

The compileration use the attached Microsoft Visual Studio Solution OpenseesVC6.sln directly.

1. Download and install ActiveTcl 8.5 for x86. ActiveTcl 8.6 deletes some class used by Opensees. 64bit ActiveTcl is also not available, at least without much modification in OpenseesVC6.sln.

2. You need add the position of Tcl include and library folder by hand for compilering some of the Opensees library.

3.  You need close SAFESEH in linker option for compilering some of the Opensees library.

4.  Following files are lost from the compiler list, you must add them by hand.
    Pileto3D.cpp,  FRPConfinedConcrete.cpp, YamamotoBiaxialHDR.cpp

5.  The file /win32/VC2005errno.cpp is also needed to be added in compile list otherwise you would get unrresolved _errono error.

That's all.

逆变基底不能随体变化吗?


有网友指出*两本教科书(参考文献[1],[2])上指出逆变基底不能随体变化。其原文如下






如果这一结论成立,一个很麻烦的结果是你将得不到逆变基矢量的随体微分(convected derivative),而没有这一客观性微分整个涉及逆变基矢量的运算法则都要重写。另一个诡异的结果出自参考文献[1],对应于上面的文字,作者认为参考构型的逆变基底是时间的函数!(图1中的$G^1(t), G^2(t)$: Has to be reformed every moment with a deformation.)


图1


那么问题出在哪里呢?

参考文献[1],[2]的作者都一下面的图来解释逆变基矢量的几何意义, 即将协,逆变基矢都理解为印刻在变形体有长度方向的线段(图2)。当物体变形是,协变基矢$a_1,a_2$随变形体一起变动, 而逆变基矢$a^1,a^2$不能随变形体一起变动。两位作者都是这样解释的。


图2

  问题就出在上述逆变基矢量的几何解释上。对于数学概念,It often seems like there are two types of students of mathematics: those who prefer to learn by studying equations and following derivations, and those who prefer pictures([10]). 学数学的往往是第一类,更由于几何表示逆变基底或变矢量比较复杂,你很少能看到在数学书上看到逆变基底或变矢量的几何表示, 这对希望得到几何图像的第二类型的人造成了不少困惑(如[3-6])** 学工程的则是第二类,你可以在非数学类的教科书中看到图二的解释。这样的解释也许对理解逆变基矢量有所帮助,但是要了解这一解释并不严格,只能用于帮助你理解而并不是严格的定义,否则会如参考文献[1],[2]得出错误的结果
  下面图3关于逆变矢量的几何解释出自文献[6-9]。在这里变矢量被表示为一组面。 这一解释基于逆变矢量和变矢量的对偶关系:一个逆(协)变矢量作用到协(逆)变矢量产生一个实数。这种几何解释也许不太好理解,但这里要强调的是逆变基底不能理解为上述作者所述附在变形体上的线段!在参考文献[6]中,逆变基底被解释为坐标超平面的法线随体变化则表征的该超平面的变化,是存在的。实际上,变矢量的convected derivative可以从其与变矢量的对偶关系中推导出来。
  






图3 逆变矢量的几何解释

  如上所述,正是由于参考文献[1],[2]的作者对逆变矢量几何意义的错误解释导致了逆变基底不随体变化的错误结论。其实我们并不需要对所有的数学概念画图,不信你画一个六维的矢量,四阶的张量试试😀

  最后介绍一个可以直观地表示逆变,变矢量的软件GeoGeobra。也算是给喜欢画图的同学一个交代!





1.  Koichi Hashiguchi, Yuki Yamakawa:  Introduction to Finite Strain Theory for Continuum Elasto-Plasticity, Wiley, 2012
2.  黄克智:  张量分析, 清华大学出版社; 第2版 (2003年7月1日)
3.  Geometric imagine of one forms: http://mathoverflow.net/questions/26939/geometric-imagination-of-differential-forms
4. Physical and geometric interpretation of Differential form:  http://physics.stackexchange.com/questions/55751/physical-and-geometrical-interpretation-of-differential-forms
5. Help with geometric interpretation of 1-form: https://www.physicsforums.com/threads/help-with-geometric-interpretation-of-1-form.376475/
6. Are there pictorial examples that distinguish covariant and contravariant vectors?
https://arxiv.org/pdf/gr-qc/9807044.pdf

7  https://en.wikipedia.org/wiki/Covariance_and_contravariance_of_vectors
8  http://en.wikipedia.org/wiki/Linear_form
9.  B.F. Shutz: A First Course in General Relativity, Cambridge, 2009
10  D. Bachman: A Geometric Approach to Differential Form, Springer Science+Business Media, LLC 2006, 2012
11 https://www.geogebra.org/

:
* 本文问题的提出出自http://forum.simwe.com/thread-1115839-1-1.html
** 张量分析中的逆变矢量,变矢量也有称为矢量(vector)和余矢量或对偶矢量(covector,dual vector)的,在量子力学(狄拉克记号)中被称为ket和bra,在微分几何中则被称为切矢(tangent vector)和余切矢(cotagent),或矢量1形式。

VS Code下cmake, c++编译,调试环境的构成步骤

1   下载必须extension      按[Ctrl+Shift+X]打开extension窗口,选择安装"C/C++", "CMake", "CMake Tools" 2   在VSCode下打开作业目录 ...