From: <cd...@us...> - 2012-09-02 18:00:56
|
Revision: 10951 http://octave.svn.sourceforge.net/octave/?rev=10951&view=rev Author: cdf Date: 2012-09-02 18:00:49 +0000 (Sun, 02 Sep 2012) Log Message: ----------- prepare for release Modified Paths: -------------- trunk/octave-forge/extra/msh/DESCRIPTION trunk/octave-forge/extra/msh/inst/msh3m_gmsh.m trunk/octave-forge/extra/msh/inst/msh3m_structured_mesh.m Modified: trunk/octave-forge/extra/msh/DESCRIPTION =================================================================== --- trunk/octave-forge/extra/msh/DESCRIPTION 2012-09-02 03:52:17 UTC (rev 10950) +++ trunk/octave-forge/extra/msh/DESCRIPTION 2012-09-02 18:00:49 UTC (rev 10951) @@ -1,13 +1,12 @@ Name: msh -Version: 1.0.2 -Date: 2010-04-04 +Version: 1.0.4 +Date: 2012-08-2 Author: Carlo de Falco, Massimiliano Culpo Maintainer: Carlo de Falco, Massimiliano Culpo Title: MeSHing software package for octave Description: Create and manage triangular and tetrahedral meshes for Finite Element or Finite Volume PDE solvers. Use a mesh data structure compatible with PDEtool. Rely on gmsh for unstructured mesh generation. Depends: octave (>= 3.0), splines -SystemRequirements: gmsh (>= 1.6.5), awk +SystemRequirements: gmsh (>= 1.6.5 (optional)), awk (optional) Autoload: no License: GPL version 2 or later Url: http://octave.sf.net, http://www.geuz.org/gmsh -SVNRelease: 7154 \ No newline at end of file Modified: trunk/octave-forge/extra/msh/inst/msh3m_gmsh.m =================================================================== --- trunk/octave-forge/extra/msh/inst/msh3m_gmsh.m 2012-09-02 03:52:17 UTC (rev 10950) +++ trunk/octave-forge/extra/msh/inst/msh3m_gmsh.m 2012-09-02 18:00:49 UTC (rev 10951) @@ -21,7 +21,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {[@var{mesh}]} = @ -## msh3m_gmsh(@var{geometry},@var{option},@var{value},...) +## msh3m_gmsh(@var{geometry}, @var{option}, @var{value}, ...) ## ## Construct an unstructured tetrahedral 3D mesh making use of the free ## software gmsh. @@ -39,11 +39,11 @@ ## @seealso{msh3m_structured_mesh, msh2m_gmsh, msh2m_mesh_along_spline} ## @end deftypefn -function [mesh] = msh3m_gmsh(geometry,varargin) +function mesh = msh3m_gmsh (geometry, varargin) ## Check input ## Number of input - if !mod(nargin,2) + if !(mod (nargin,2)) warning("WRONG NUMBER OF INPUT."); print_usage; endif Modified: trunk/octave-forge/extra/msh/inst/msh3m_structured_mesh.m =================================================================== --- trunk/octave-forge/extra/msh/inst/msh3m_structured_mesh.m 2012-09-02 03:52:17 UTC (rev 10950) +++ trunk/octave-forge/extra/msh/inst/msh3m_structured_mesh.m 2012-09-02 18:00:49 UTC (rev 10951) @@ -73,14 +73,14 @@ ## msh3m_join_structured_mesh, msh3m_submesh} ## @end deftypefn -function [mesh] = msh3m_structured_mesh(x,y,z,region,sides) +function mesh = msh3m_structured_mesh (x, y, z, region, sides) ## Check input if (nargin != 5) # Number of input parameters - error("msh3m_structured_mesh: wrong number of input parameters."); - elseif !(isvector(x) && isnumeric(x) && - isvector(y) && isnumeric(y) && - isvector(z) && isnumeric(z) ) + print_usage (); + elseif !(isvector(x) && isnumeric(x) + && isvector(y) && isnumeric(y) + && isvector(z) && isnumeric(z)) error("msh3m_structured_mesh: X, Y, Z must be valid numeric vectors."); elseif !isscalar(region) error("msh3m_structured_mesh: REGION must be a valid scalar."); @@ -90,86 +90,94 @@ ## Build mesh ## Sort point coordinates - x = sort(x); - y = sort(y); - z = sort(z); + x = sort (x); + y = sort (y); + z = sort (z); ## Compute # of points in each direction - nx = length(x); - ny = length(y); - nz = length(z); + nx = length (x); + ny = length (y); + nz = length (z); ## Generate vertices - [XX,YY,ZZ] = meshgrid(x,y,z); - p = [XX(:),YY(:),ZZ(:)]'; + [XX, YY, ZZ] = meshgrid (x, y, z); + p = [XX(:), YY(:), ZZ(:)]'; - iiv (ny,nx,nz)=0; - iiv(:)=1:nx*ny*nz; - iiv(end,:,:)=[]; - iiv(:,end,:)=[]; - iiv(:,:,end)=[]; - iiv=iiv(:)'; + [t, e] = __t6_connections__ (nx, ny, nz); + ## Assemble structure + mesh = struct ('p', p, 'e', e, 't', t); + mesh.e (9,:) = region; + mesh.t (5,:) = region; + +endfunction + +function [t, e] = __t6_connections__ (nx, ny, nz) + ## Generate connections: + iiv = reshape (1:nx*ny*nz, [ny, nx, nz]); + iiv(end,:,:) = []; + iiv(:,end,:) = []; + iiv(:,:,end) = []; + iiv = iiv(:)'; + n1 = iiv; # bottom faces n2 = iiv + 1; n3 = iiv + ny; n4 = iiv + ny + 1; - + N1 = iiv + nx * ny; # top faces N2 = N1 + 1; N3 = N1 + ny; N4 = N3 + 1; - t = [... - [n1; n3; n2; N2],... + t = [[n1; n3; n2; N2],... [N1; N2; N3; n3],... [N1; N2; n3; n1],... [N2; n3; n2; n4],... [N3; n3; N2; N4],... - [N4; n3; N2; n4],... - ]; + [N4; n3; N2; n4]]; ## Generate boundary face list ## left - T = t; - T(:) = p(1,t)'==x(1); - [ignore,order] = sort(T,1); - ii = (find(sum(T,1)==3)); + T = t; + T(:) = p(1, t)' == x(1); + [~, order] = sort (T, 1); + ii = (find(sum(T,1)==3)); order(1,:) = []; - for jj=1:length(ii) - e1(:,jj) = t(order(:,ii(jj)),ii(jj)); + for jj=1:length (ii) + e1(:,jj) = t(order(:,ii(jj)),ii(jj)); endfor - e1(10,:) = sides(1); + e1(10,:) = sides (1); ## right - T(:) = p(1,t)'==x(end); - [ignore,order] = sort(T,1); - ii = (find(sum(T,1)==3)); + T(:) = p(1,t)' == x(end); + [~, order] = sort(T,1); + ii = (find(sum(T,1)==3)); order(1,:) = []; - for jj=1:length(ii) - e2(:,jj) = t(order(:,ii(jj)),ii(jj)); + for jj=1:length (ii) + e2(:,jj) = t(order(:,ii(jj)),ii(jj)); end e2(10,:) = sides(2); ## front - T(:) = p(2,t)'==y(1); - [ignore,order] = sort(T,1); - ii = (find(sum(T,1)==3)); + T(:) = p(2,t)' == y(1); + [~, order] = sort(T,1); + ii = (find (sum (T,1) == 3)); order(1,:) = []; - for jj=1:length(ii) - e3(:,jj) = t(order(:,ii(jj)),ii(jj)); + for jj=1:length (ii) + e3(:,jj) = t(order(:,ii(jj)),ii(jj)); endfor e3(10,:) = sides(3); ## back - T(:) = p(2,t)'==y(end); - [ignore,order] = sort(T,1); - ii = (find(sum(T,1)==3)); + T(:) = p(2,t)' == y(end); + [~,order] = sort (T,1); + ii = (find (sum (T,1) == 3)); order(1,:) = []; - for jj=1:length(ii) - e4(:,jj) = t(order(:,ii(jj)),ii(jj)); + for jj=1:length (ii) + e4(:,jj) = t(order(:,ii(jj)),ii(jj)); endfor e4(10,:) = sides(4); @@ -177,7 +185,7 @@ T = t; T(:) = p(3,t)'==z(1); [ignore,order] = sort(T,1); - ii = (find(sum(T,1)==3)); + ii = (find (sum (T,1)==3)); order(1,:) = []; for jj=1:length(ii) e5(:,jj) = t(order(:,ii(jj)),ii(jj)); @@ -188,43 +196,40 @@ T = t; T(:) = p(3,t)'==z(end); [ignore,order] = sort(T,1); - ii = (find(sum(T,1)==3)); + ii = (find (sum (T,1) == 3)); order(1,:) = []; for jj=1:length(ii) e6(:,jj) = t(order(:,ii(jj)),ii(jj)); endfor e6(10,:) = sides(6); - ## Assemble structure - mesh.e = [e1,e2,e3,e4,e5,e6]; - mesh.t = t; - mesh.e (9,:) = region; - mesh.t (5,:) = region; - mesh.p = p; + e = [e1, e2, e3, e4, e5, e6]; endfunction + + %!test -% x = y = z = linspace(0,1,2) -% [mesh] = msh3m_structured_mesh(x,y,z,1,1:6) -% assert = (columns(mesh.p),8) -% assert = (columns(mesh.t),6) -% assert = (columns(mesh.e),12) +% x = y = z = linspace (0,1,2) +% [mesh] = msh3m_structured_mesh (x, y, z, 1, 1:6) +% assert = (columns (mesh.p), 8) +% assert = (columns (mesh.t), 6) +% assert = (columns (mesh.e), 12) %!test -% x = y = z = linspace(0,1,3) -% [mesh] = msh3m_structured_mesh(x,y,z,1,1:6) -% assert = (columns(mesh.p),27) -% assert = (columns(mesh.t),48) -% assert = (columns(mesh.e),48) +% x = y = z = linspace (0,1,3) +% [mesh] = msh3m_structured_mesh (x, y, z, 1, 1:6) +% assert = (columns (mesh.p), 27) +% assert = (columns (mesh.t), 48) +% assert = (columns (mesh.e), 48) %!test -% x = y = z = linspace(0,1,4) -% [mesh] = msh3m_structured_mesh(x,y,z,1,1:6) -% assert = (columns(mesh.p),64) -% assert = (columns(mesh.t),162) -% assert = (columns(mesh.e),108) +% x = y = z = linspace (0,1,4) +% [mesh] = msh3m_structured_mesh (x, y, z, 1, 1:6) +% assert = (columns (mesh.p), 64) +% assert = (columns (mesh.t), 162) +% assert = (columns (mesh.e), 108) %!test -% x = y = z = linspace(0,1,1) -% fail([mesh] = msh3m_structured_mesh(x,y,z,1,1:6),"warning","x, y, z cannot be scalar numbers!") +% x = y = z = linspace (0,1,1) +% fail([mesh] = msh3m_structured_mesh (x, y, z, 1, 1:6), "warning", "x, y, z cannot be scalar numbers!") %!test % x = y = z = eye(2) -% fail([mesh] = msh3m_structured_mesh(x,y,z,1,1:6),"warning","x, y, z cannot be matrices!") \ No newline at end of file +% fail([mesh] = msh3m_structured_mesh (x, y, z, 1, 1:6),"warning", "x, y, z cannot be matrices!") \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |