File: mesh2d.sci

package info (click to toggle)
scilab 2.4-1
  • links: PTS
  • area: non-free
  • in suites: potato, slink
  • size: 55,196 kB
  • ctags: 38,019
  • sloc: ansic: 231,970; fortran: 148,976; tcl: 7,099; makefile: 4,585; sh: 2,978; csh: 154; cpp: 101; asm: 39; sed: 5
file content (55 lines) | stat: -rw-r--r-- 1,276 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
function [nutr,A]=mesh2d(x,y,front)
// Copyright INRIA
[lhs,rhs]=argn(0)
if (rhs>3|rhs<2) then error(39), end
nbs=size(x,2);n1=size(y,2);
if(nbs <> n1) then 
  error('Incompatible arrays dimensions')
end
if(nbs < 3) then 
  error('Minimum 3 points needed')
end
n6=6*nbs-9;
n4=4*nbs-4;
if (rhs == 2) then
[iadj,iend,nbt,nutr,ierr]=m6deumesh(nbs,n4,n6,x,y);
if ierr<>0 then
    error('all nodes are colinear');
  return;
end
else  
  n6=6*(nbs+nbs-2)
  lfront=size(front,2);
  cr=[x;y];
  tri=zeros(1,n4);
  [nbt,nutr,c,err]=m6mesh2b(nbs,n6,n4,lfront,cr,tri,front);
if err<>0 then
  select err
    case 2
    error('some points are identical');
  case 5
    error('wrong boundary array');
  case 6
    error('crossed boundary');
  case 7 
    error('wrong orientation of the boundary');
  case 8
    error('size limitation');
  case 9
    error('crossed boundary');
  case 10
    error('an interior point is on the boundary');
  case 12
    error('some points are identical or size limitation');
end
end
  ntot=3*nbt;nunu=nutr(1:ntot);
  nutr=matrix(nunu,3,nbt);
end;
ii=find(nutr(1,:)==0); nutr(:,ii)=[];
if lhs==2 then
  jj=[nutr(1,:)' nutr(2,:)';nutr(2,:)' nutr(3,:)';nutr(3,:)' nutr(1,:)'];
  A=sparse(jj,ones(size(jj,1),1));
  A=bool2s((A<>0)|(A'<>0));
  A=A+speye(A);
end