File: fec_demo.sci

package info (click to toggle)
scilab 4.0-12
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k
  • size: 100,640 kB
  • ctags: 57,333
  • sloc: ansic: 377,889; fortran: 242,862; xml: 179,819; tcl: 42,062; sh: 10,593; ml: 9,441; makefile: 4,377; cpp: 1,354; java: 621; csh: 260; yacc: 247; perl: 130; lex: 126; asm: 72; lisp: 30
file content (128 lines) | stat: -rw-r--r-- 3,107 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
function []=emc2(filename)
	
	// Visualise un resultat de type GNU.*
	// generes par NSCK2E 
	// en general un ensemble de segments 
	// Copyright ENPC
	
	xx=read(filename,-1,2);
	x=xx(:,1);
	y=xx(:,2);
	y1=matrix(y,2,prod(size(y))/2);
	x1=matrix(x,2,prod(size(x))/2);
	rect=[mini(x1),mini(y1),maxi(x1),maxi(y1)];
	plot2d(1,1,[1],"031"," ",rect);
	xsegs(x1,y1);
	
endfunction 

function []=amdbaR(File_name)
	
	// Read a file describing a MESH of finite elements 
	// of triangle type 
	// The file is of amdba type 
	
	[lhs,rhs]=argn(0);
	if rhs == 0 ; File_name='MESH'; end
	unit=file('open',File_name,'old');
	x=read(unit,1,2);
	noeuds=x(1);
	triang=x(2);
	noeul=read(unit,x(1),4);
	trianl=read(unit,x(2),5);
	file('close',unit);
	[noeuds,triang,noeul,trianl]=resume(noeuds,triang,noeul,trianl);
	
endfunction 

function []=meshvisu(col,rect)
	
	// Mesh visualisation 
	// uses global variables 
	
	[lhs,rhs]=argn(0);
	if rhs<=0;col=1;end
	if rhs<=1;rect=[mini(noeul(:,2)),mini(noeul(:,3)),maxi(noeul(:,2)),maxi(noeul(:,3))];end
	if rhs<=2;iso='1';end
	plot2d(1,1,[1],"031"," ",rect);
	xset("clipgrf");
	xx=trianl(:,2:4);
	xx=matrix(xx,prod(size(xx)),1);
	x=noeul(xx,2);
	triang=size(x,'*')/3;
	x=matrix(x,triang,3);
	y=noeul(xx,3);
	y=matrix(y,triang,3);
	x=[x,x(:,1)]';
	y=[y,y(:,1)]';
	xpolys(x,y,col*ones(1,triang));
	xset("clipoff");
	
endfunction 

function []=nvisu(rect)
	
	// Visualisation des noeuds 
	
	[lhs,rhs]=argn(0);
	if rhs==0;rect=[mini(noeul(:,2)),mini(noeul(:,3)),maxi(noeul(:,2)),maxi(noeul(:,3))];end
	plot2d(1,1,[1],"031"," ",rect);
	xset("clipgrf");
	bords=noeul(find(noeul(:,4)>0),:);
	[no,ign]=size(bords);
	for i=1:no
		xstring(bords(i,2),bords(i,3),string(bords(i,4)));
	end
	xset("clipoff");
	
endfunction 

function []=emc2V(i,j,k,sa,FN,rect)
	
	// Visualise un champ de vitesse 
	// la taille des vecteur est constante
	// mais on change la couleur suivant l'intensite du champ
	// Les vecteurs sont lus dans les colonnes i et j du fichier 
	// du fichier FN qui continet k colonnes 
	
	[lhs,rhs]=argn(0);
	plot2d(1,1,[1],"031"," ",rect);
	xset("clipgrf");
	if rhs == 0 ; FN='MESH';end
	unit=file('open',FN,'old')
	resu=read(unit,noeuds,k);
	resu=resu(:,[i,j]);
	nm=[];
	for i=1:noeuds;
		nm1=norm(resu(i,:),2);
		nm=[nm,nm1];
		if nm1<>0,resu(i,:)=resu(i,:)/nm1;end
	end
	nmax=maxi(nm);
	if nmax<>0; nm=nm/nmax;end
	xsegs([noeul(:,2)-(1/sa)*resu(:,1),noeul(:,2)+(1/sa)*resu(:,1)]',...
		[noeul(:,3)-(1/sa)*resu(:,2),noeul(:,3)+(1/sa)*resu(:,2)]',...
		16*ones(nm)-16*nm);
	file('close',unit);
	xset("clipoff");
	file("close",unit);
	
endfunction 

function []=emc2C(i,j,FN,rect)
	
	// iso contour de la fonction lineaire sur les 
	// triangles du maillage on lit les valeurs de la fonction 
	// aux noeuds du maillage sur la ieme colonne 
	// du fichier file qui en contient j 
	
	[lhs,rhs]=argn(0);
	unit=file('open',FN,'old');
	resu=read(unit,-1,j);
	resu=resu(:,i);
	file('close',unit);
	if rhs<=3;rect=[mini(noeul(:,2)),mini(noeul(:,3)),maxi(noeul(:,2)),maxi(noeul(:,3))];end
	fec(noeul(:,2),noeul(:,3),trianl,resu,"131"," ",rect);
	file("close",unit);
	
endfunction