0%

安装 neper 多晶体网格生成软件

概述:安装 neper 前需要安装的组件包括
gcc, g++; cmake; gsl; nlopt; povray; gmsh; imagemagick
这里记录了两种环境安装 neper 的过程(基本相同):
1.桌面发行版 Deepin
2.Win10(1809以上) 的 Linux ubuntu 子系统 (WSL)

Deepin 下安装 neper

在安装neper之前, 需要安装 GSL(GNU Scientific Library) NLOPT (不需下载)。下载 Neper

安装编译器

1
2
3
sudo apt-get update
sudo apt install gcc
sudo apt install g++

安装 GSLcdGSL 目录下

1
2
3
sudo ./configure
sudo make
sudo make install

安装 NLOPT

1
sudo apt-get install libnlopt.dev

安装 CMAKE

1
sudo apt install cmake

安装 neper

cdneper 下的 src 文件中

1
2
3
4
cd Build
cmake ..
make
sudo make install

安装 Gmsh

1
sudo apt-get install libgmsh-dev

安装 PoV-Ray

1
sudo apt-get install povray

测试安装,在 neperbuild 目录下

1
make test

WSL ubuntu 安装 neper

安装环境

1
2
3
4
5
6
7
sudo apt install cmake
sudo apt install g++
sudo apt install gcc
sudo apt-get install libnlopt.dev
sudo apt-get install povray
sudo apt-get install libgmsh-dev
sudo apt-get install imagemagick

安装 GSL ,在 GSL 目录下

1
2
3
sudo ./configure
sudo make
sudo make install

编译安装 neper

下载 neper ,解压,进入 neper/src/ 目录,执行编译

1
2
3
mkdir build && cd buid && cmake ..
make -j
sudo make install

build 目录下执行 make test 进行测试,可以在 build 目录下找到相应的生成文件

运行例子

来源 neper 官网

保存以下例子为 gene_gene.sh,执行 sudo sh ./gene_gene.sh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/bash

NEPER="neper --rcfile none"

$NEPER -T -n 1000 -domain "cube(1,1,1)" -o gene_gene_1
$NEPER -T -n 1000 -domain "cylinder(1,1,200)" -o gene_gene_2
$NEPER -T -n 1000 -domain "sphere(1,1000)" -o gene_gene_3

C="-datacellcol id -datacelltrs 0.5 -cameraangle 12 -imagesize 600:600"
$NEPER -V gene_gene_1.tess $C -print gene_gene_1
$NEPER -V gene_gene_2.tess $C -showedge "cyl==0" -cameraangle 11 -print gene_gene_2
$NEPER -V gene_gene_3.tess $C -showedge "polynb>1" -cameraangle 9 -print gene_gene_3

convert +append gene_gene_?.png gene_gene.png

exit 0

可能出现的错误以及解决方案

No CMAKE_CXX_COMPILER could be found.
Tell CMake where to find the compiler by setting either the environment variable “CXX” or the CMake cache entry CMAKE_CXX_COMPILER to the full path to the compiler, or to the compiler name if it is in the PATH.

需要安装 cmake

FindGSL.cmake: gsl-config/pkg-config gsl not found. Please set
it manually. GSL_CONFIG=GSL_CONFIG-NOTFOUND
CMake Error at cmake/FindGSL.cmake:178 (MESSAGE):
GSL required, please specify it’s location.
Call Stack (most recent call first):
contrib/ut/CMakeLists.txt:94 (find_package)

需要安装 GSL

CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find NLOPT (missing: NLOPT_LIBRARY NLOPT_INCLUDE_DIRS)
Call Stack (most recent call first):
/usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
cmake/FindNLOPT.cmake:35 (find_package_handle_standard_args)
contrib/orilib/CMakeLists.txt:115 (find_package)

需要安装 NLOPT

Error : Povray not found! Make sure it is available at the command line
then run Neper again.

需要安装 povraygmsh

convert: not found

需要安装 imagemagick


参考链接:Neper 在 Linux(ubuntu)下的安装方法