SwitchPartitioning

PURPOSE ^

INPUT function new_u_g=SwitchPartitioning(u_g,destination,part,tpart,doflist);

SYNOPSIS ^

function new_u_g=SwitchPartitioning(u_g,destination,part,tpart,doflist);

DESCRIPTION ^

INPUT function new_u_g=SwitchPartitioning(u_g,destination,part,tpart,doflist);

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function new_u_g=SwitchPartitioning(u_g,destination,part,tpart,doflist);
0002 %INPUT function new_u_g=SwitchPartitioning(u_g,destination,part,tpart,doflist);
0003 
0004 gsize=length(u_g);
0005 if strcmpi(destination,'workspace'),
0006     %g-size vector u_g is ordered according to a parallel partition. REorder it
0007     %so that u_g correspondgs to the workspace partition (ie: the initial grid
0008     %partition)
0009     new_u_g=zeros(gsize,1);
0010     
0011     %go through list of degrees of freedom that need repartitioning
0012     for i=1:length(doflist),
0013         dof=doflist(i);
0014         ind=dof:6:gsize; ind=ind(tpart);
0015         new_u_g(dof:6:gsize)=u_g(ind);
0016     end
0017 elseif strcmpi(destination,'cluster'),
0018     %g size  vector u_g is ordered according to the matlab workspace. We need to
0019     %reorder it so that u_g is now ordered in the parallel partition.
0020 
0021     new_u_g=zeros(gsize,1);
0022 
0023     for i=1:length(doflist), 
0024         dof=doflist(i);
0025         ind=dof:6:gsize; vector=u_g(ind);
0026         new_u_g(dof:6:gsize)=vector(part);
0027     end
0028 else
0029     error('SwitchPartitioning error message: only types of destination allowed are ''workspace'' or ''cluster''!');
0030 end

Generated on Sun 29-Mar-2009 20:22:55 by m2html © 2003