Changeset 17563


Ignore:
Timestamp:
03/27/14 11:12:51 (11 years ago)
Author:
Mathieu Morlighem
Message:

BUG: fixing some tests now that subclasses are used for md.mesh

Location:
issm/trunk-jpl/src/m/classes
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/classes/model.m

    r17562 r17563  
    421421
    422422                        %Edges
    423                         if size(md2.mesh.edges,2)>1, %do not use ~isnan because there are some NaNs...
    424                                 %renumber first two columns
    425                                 pos=find(md2.mesh.edges(:,4)~=-1);
    426                                 md2.mesh.edges(:  ,1)=Pnode(md2.mesh.edges(:,1));
    427                                 md2.mesh.edges(:  ,2)=Pnode(md2.mesh.edges(:,2));
    428                                 md2.mesh.edges(:  ,3)=Pelem(md2.mesh.edges(:,3));
    429                                 md2.mesh.edges(pos,4)=Pelem(md2.mesh.edges(pos,4));
    430                                 %remove edges when the 2 vertices are not in the domain.
    431                                 md2.mesh.edges=md2.mesh.edges(find(md2.mesh.edges(:,1) & md2.mesh.edges(:,2)),:);
    432                                 %Replace all zeros by -1 in the last two columns
    433                                 pos=find(md2.mesh.edges(:,3)==0);
    434                                 md2.mesh.edges(pos,3)=-1;
    435                                 pos=find(md2.mesh.edges(:,4)==0);
    436                                 md2.mesh.edges(pos,4)=-1;
    437                                 %Invert -1 on the third column with last column (Also invert first two columns!!)
    438                                 pos=find(md2.mesh.edges(:,3)==-1);
    439                                 md2.mesh.edges(pos,3)=md2.mesh.edges(pos,4);
    440                                 md2.mesh.edges(pos,4)=-1;
    441                                 values=md2.mesh.edges(pos,2);
    442                                 md2.mesh.edges(pos,2)=md2.mesh.edges(pos,1);
    443                                 md2.mesh.edges(pos,1)=values;
    444                                 %Finally remove edges that do not belong to any element
    445                                 pos=find(md2.mesh.edges(:,3)==-1 & md2.mesh.edges(:,4)==-1);
    446                                 md2.mesh.edges(pos,:)=[];
     423                        if(strcmp(meshtype(md.mesh),'2Dhorizontal')),
     424                                if size(md2.mesh.edges,2)>1, %do not use ~isnan because there are some NaNs...
     425                                        %renumber first two columns
     426                                        pos=find(md2.mesh.edges(:,4)~=-1);
     427                                        md2.mesh.edges(:  ,1)=Pnode(md2.mesh.edges(:,1));
     428                                        md2.mesh.edges(:  ,2)=Pnode(md2.mesh.edges(:,2));
     429                                        md2.mesh.edges(:  ,3)=Pelem(md2.mesh.edges(:,3));
     430                                        md2.mesh.edges(pos,4)=Pelem(md2.mesh.edges(pos,4));
     431                                        %remove edges when the 2 vertices are not in the domain.
     432                                        md2.mesh.edges=md2.mesh.edges(find(md2.mesh.edges(:,1) & md2.mesh.edges(:,2)),:);
     433                                        %Replace all zeros by -1 in the last two columns
     434                                        pos=find(md2.mesh.edges(:,3)==0);
     435                                        md2.mesh.edges(pos,3)=-1;
     436                                        pos=find(md2.mesh.edges(:,4)==0);
     437                                        md2.mesh.edges(pos,4)=-1;
     438                                        %Invert -1 on the third column with last column (Also invert first two columns!!)
     439                                        pos=find(md2.mesh.edges(:,3)==-1);
     440                                        md2.mesh.edges(pos,3)=md2.mesh.edges(pos,4);
     441                                        md2.mesh.edges(pos,4)=-1;
     442                                        values=md2.mesh.edges(pos,2);
     443                                        md2.mesh.edges(pos,2)=md2.mesh.edges(pos,1);
     444                                        md2.mesh.edges(pos,1)=values;
     445                                        %Finally remove edges that do not belong to any element
     446                                        pos=find(md2.mesh.edges(:,3)==-1 & md2.mesh.edges(:,4)==-1);
     447                                        md2.mesh.edges(pos,:)=[];
     448                                end
    447449                        end
    448450
  • issm/trunk-jpl/src/m/classes/model.py

    r17562 r17563  
    327327
    328328                #Edges
    329                 if numpy.ndim(md2.mesh.edges)>1 and numpy.size(md2.mesh.edges,axis=1)>1:    #do not use ~isnan because there are some NaNs...
    330                         #renumber first two columns
    331                         pos=numpy.nonzero(md2.mesh.edges[:,3]!=-1)[0]
    332                         md2.mesh.edges[:  ,0]=Pnode[md2.mesh.edges[:,0]-1]
    333                         md2.mesh.edges[:  ,1]=Pnode[md2.mesh.edges[:,1]-1]
    334                         md2.mesh.edges[:  ,2]=Pelem[md2.mesh.edges[:,2]-1]
    335                         md2.mesh.edges[pos,3]=Pelem[md2.mesh.edges[pos,3]-1]
    336                         #remove edges when the 2 vertices are not in the domain.
    337                         md2.mesh.edges=md2.mesh.edges[numpy.nonzero(numpy.logical_and(md2.mesh.edges[:,0],md2.mesh.edges[:,1]))[0],:]
    338                         #Replace all zeros by -1 in the last two columns
    339                         pos=numpy.nonzero(md2.mesh.edges[:,2]==0)[0]
    340                         md2.mesh.edges[pos,2]=-1
    341                         pos=numpy.nonzero(md2.mesh.edges[:,3]==0)[0]
    342                         md2.mesh.edges[pos,3]=-1
    343                         #Invert -1 on the third column with last column (Also invert first two columns!!)
    344                         pos=numpy.nonzero(md2.mesh.edges[:,2]==-1)[0]
    345                         md2.mesh.edges[pos,2]=md2.mesh.edges[pos,3]
    346                         md2.mesh.edges[pos,3]=-1
    347                         values=md2.mesh.edges[pos,1]
    348                         md2.mesh.edges[pos,1]=md2.mesh.edges[pos,0]
    349                         md2.mesh.edges[pos,0]=values
    350                         #Finally remove edges that do not belong to any element
    351                         pos=numpy.nonzero(numpy.logical_and(md2.mesh.edges[:,1]==-1,md2.mesh.edges[:,2]==-1))[0]
    352                         md2.mesh.edges=numpy.delete(md2.mesh.edges,pos,axis=0)
     329                if m.strcmp(md.mesh.meshtype(),'2Dhorizontal'):
     330                        if numpy.ndim(md2.mesh.edges)>1 and numpy.size(md2.mesh.edges,axis=1)>1:    #do not use ~isnan because there are some NaNs...
     331                                #renumber first two columns
     332                                pos=numpy.nonzero(md2.mesh.edges[:,3]!=-1)[0]
     333                                md2.mesh.edges[:  ,0]=Pnode[md2.mesh.edges[:,0]-1]
     334                                md2.mesh.edges[:  ,1]=Pnode[md2.mesh.edges[:,1]-1]
     335                                md2.mesh.edges[:  ,2]=Pelem[md2.mesh.edges[:,2]-1]
     336                                md2.mesh.edges[pos,3]=Pelem[md2.mesh.edges[pos,3]-1]
     337                                #remove edges when the 2 vertices are not in the domain.
     338                                md2.mesh.edges=md2.mesh.edges[numpy.nonzero(numpy.logical_and(md2.mesh.edges[:,0],md2.mesh.edges[:,1]))[0],:]
     339                                #Replace all zeros by -1 in the last two columns
     340                                pos=numpy.nonzero(md2.mesh.edges[:,2]==0)[0]
     341                                md2.mesh.edges[pos,2]=-1
     342                                pos=numpy.nonzero(md2.mesh.edges[:,3]==0)[0]
     343                                md2.mesh.edges[pos,3]=-1
     344                                #Invert -1 on the third column with last column (Also invert first two columns!!)
     345                                pos=numpy.nonzero(md2.mesh.edges[:,2]==-1)[0]
     346                                md2.mesh.edges[pos,2]=md2.mesh.edges[pos,3]
     347                                md2.mesh.edges[pos,3]=-1
     348                                values=md2.mesh.edges[pos,1]
     349                                md2.mesh.edges[pos,1]=md2.mesh.edges[pos,0]
     350                                md2.mesh.edges[pos,0]=values
     351                                #Finally remove edges that do not belong to any element
     352                                pos=numpy.nonzero(numpy.logical_and(md2.mesh.edges[:,1]==-1,md2.mesh.edges[:,2]==-1))[0]
     353                                md2.mesh.edges=numpy.delete(md2.mesh.edges,pos,axis=0)
    353354
    354355                #Penalties
  • issm/trunk-jpl/src/m/classes/rifts.py

    r17559 r17563  
    55from WriteData import WriteData
    66from isnans import isnans
     7import MatlabFuncs as m
    78
    89class rifts(object):
  • issm/trunk-jpl/src/m/classes/thermal.py

    r17559 r17563  
    44from checkfield import checkfield
    55from WriteData import WriteData
     6import MatlabFuncs as m
    67
    78class thermal(object):
Note: See TracChangeset for help on using the changeset viewer.