read tetgen file
来源:互联网 发布:企业qq for mac版 编辑:程序博客网 时间:2024/06/05 06:06
function [p,f,t] = read_tetgenmesh( file )% READ_TETGENMESH Reads Tetgen meshes% Reads the native Tetgen format mesh-files into Matlab. The output% [p,f,t] (nodes,faces,tetras) is similar to the output of init/poimesh% of the PDEtool toolbox, which is [p,e,t] (nodes,edges,triangles).% This function loads only the simplest tetrahedral Tetgen meshes% (no volume/facet holes or any fance attributes).%% Tetgen manual: http://tetgen.berlios.de/files/tetgen-manual.pdf% (13.07.2012)%% Let P,F,T be the number of nodes, faces, and tetras, respectively.% % Nodes (p):% This function is designed to read the .node files which do not have% attributes (see Tetgen documentation 4.1.1. on page 31), but have% boundary markers. p is a [4,P] matrix, where 3 first rows are the% coordinates, and the last one the boundary marker (1=boundary node,% 0=inner node)%% Faces (f):% This function is designed to read .face files which do not specify% holes (see Tetgen documentation 4.1.2 on page 33), but have boundary% markers. f is a [4,F] matrix, where 3 first rows are the node indices% (for node matrix p), and the last one the boundary marker (1=boundary% face, 0=inner face). A simply connected, no hole domain which has not% been divided into parts has only boundary faces?%% Tetras (t):% This function is designed to read .ele files which do not specify% regional attributes (see Tetgen documentation 4.1.5 on page 38).% t is a [4,T] matrix where the 4 rows are the node indices (for node% matrix p).%%% SYNTAX: [p,f,t] = readmesh( file )%% IN: file a collection of mesh files created by Tetgen% file.node/face/ele% % OUT: p points by coordinates% f boundary faces by points% t tetras by points%%% Author: Immanuel Anjam, University of Jyvaskyla% Contact: immanuel.anjam@gmail.com% Date: 13.07.2012% Version: 1.1%% nodes for pfid=fopen([file,'.node'], 'rt'); %open the filetitle = fgetl(fid); %read in the headertitle = str2num(title);cols = title(1);rows = title(2) + title(4) + 1;data = fscanf(fid, '%e',[rows,cols]); %read in datap = data(2:rows,1:cols); %ignore the first rowfclose(fid); %close the file% boundary faces for ffid=fopen([file,'.face'], 'rt'); %open the filetitle = fgetl(fid); %read in the headertitle = str2num(title);cols = title(1);rows = title(2) + 4;data = fscanf(fid, '%i',[rows,cols]); %read in dataf = data(2:rows,1:cols); %ignore the first rowfclose(fid); %close the file% elements for tfid=fopen([file,'.ele'], 'rt'); %open the filetitle = fgetl(fid); %read in the headertitle = str2num(title);cols = title(1);rows = title(2) + title(3) + 1;data = fscanf(fid, '%i',[rows,cols]); %read in datat = data(2:rows,1:cols); %ignore the first rowfclose(fid); %close the file% boundary edges for e% these are the corner edges of a domain, not so useful%{fid=fopen([file,'.edge'], 'rt'); %open the filetitle = fgetl(fid); %read in the headertitle = str2num(title);cols = title(1);data = fscanf(fid, '%i',[3,cols]); %read in datae = data(2:3,1:cols); %ignore the first rowfclose(fid); %close the file%}
0 0
- read tetgen file
- fix .mesh file generated by tetgen to fit igllib
- File Read
- read file
- Read .properties file
- Read .XML file
- db file sequential read
- Read cvs file
- Read Resource File
- Java read file
- read and select file
- J2ME read txt file
- db file sequential read
- ksh read file examples
- Read-only File System
- Perl read INI file
- db file sequential read
- db file scattered read
- mybatis缓存
- 机器学习(十):PCA
- linux系统下制作fat32格式windows10 U盘启动盘
- Python3.5配置Selenium
- 51nod 1267 4个数和为0
- read tetgen file
- Java编程题练习2017-02-08
- 开启聊天机器人模式
- Codeforces 764A Taymyr is calling you(水题翻译)
- Git学习使用(三):版本控制
- 关于用webpack并且实现在手机上面测试项目
- .Net基础体系和跨框架开发普及
- 陌兮大魔王带你深入 学习ArrayList(二)
- JZOJ 3366. 【NOI2012】随机数生成器