/[escript]/trunk/finley/src/Mesh_findMatchingFaces.c
ViewVC logotype

Diff of /trunk/finley/src/Mesh_findMatchingFaces.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1376 by gross, Wed Jan 9 01:38:18 2008 UTC revision 1377 by gross, Wed Jan 9 03:45:59 2008 UTC
# Line 58  void Finley_Mesh_findMatchingFaces(Finle Line 58  void Finley_Mesh_findMatchingFaces(Finle
58        for (i=0;i<numDim;i++) _dist_=MAX(_dist_,ABS(X[INDEX3(i,_i0_,_e0_,numDim,NN)]-X[INDEX3(i,_i1_,_e1_,numDim,NN)])); \        for (i=0;i<numDim;i++) _dist_=MAX(_dist_,ABS(X[INDEX3(i,_i0_,_e0_,numDim,NN)]-X[INDEX3(i,_i1_,_e1_,numDim,NN)])); \
59        }        }
60    
 #define SWAP(_i1_,_i2_) \  
             {index_t* i;  \  
               i=(_i2_); \  
               (_i2_)=(_i1_); \  
               (_i1_)=i; \  
              }  
   
61      char error_msg[LenErrorMsg_MAX];      char error_msg[LenErrorMsg_MAX];
62      double h=DBLE(HUGE_VAL),h_local,dist,*X=NULL;      double h=DBLE(HUGE_VAL),h_local,dist,*X=NULL;
63      dim_t NN=faces->ReferenceElement->Type->numNodes;      dim_t NN=faces->ReferenceElement->Type->numNodes;
# Line 126  void Finley_Mesh_findMatchingFaces(Finle Line 119  void Finley_Mesh_findMatchingFaces(Finle
119                   if (dist<=h*tolerance) break;                   if (dist<=h*tolerance) break;
120                   if (faces->ReferenceElement->Type->shiftNodes[0]>=0) {                   if (faces->ReferenceElement->Type->shiftNodes[0]>=0) {
121                      /* rotate the nodes */                      /* rotate the nodes */
122                      for (i=0;i<NN;i++) perm_tmp[i]=perm[faces->ReferenceElement->Type->shiftNodes[i]];                      itmp_ptr=perm;
123                      SWAP(perm,perm_tmp);                      perm=perm_tmp;
124                        perm_tmp=itmp_ptr;
125                        #pragma ivdep
126                        for (i=0;i<NN;i++) perm[i]=perm_tmp[faces->ReferenceElement->Type->shiftNodes[i]];
127                   }                   }
128                   /* if the permutation is back at the identity, ie. perm[0]=0, the faces don't match: */                   /* if the permutation is back at the identity, ie. perm[0]=0, the faces don't match: */
129                   if (perm[0]==0) {                   if (perm[0]==0) {
# Line 146  void Finley_Mesh_findMatchingFaces(Finle Line 142  void Finley_Mesh_findMatchingFaces(Finle
142                               sprintf(error_msg,"Mesh_findMatchingFaces:couldn't match the second node of element %d to touching element %d",e_0,e_1);                               sprintf(error_msg,"Mesh_findMatchingFaces:couldn't match the second node of element %d to touching element %d",e_0,e_1);
143                               Finley_setError(VALUE_ERROR,error_msg);                               Finley_setError(VALUE_ERROR,error_msg);
144                            } else {                            } else {
145                               for (i=0;i<NN;i++) perm_tmp[i]=perm[faces->ReferenceElement->Type->reverseNodes[i]];                               itmp_ptr=perm;
146  /* printf("ZZZ: AAAAAAA 3: %d\n",e); */                               perm=perm_tmp;
147                               SWAP(perm,perm_tmp);                               perm_tmp=itmp_ptr;
148                                 #pragma ivdep
149                                 for (i=0;i<NN;i++) perm[i]=perm_tmp[faces->ReferenceElement->Type->reverseNodes[i]];
150                               getDist(dist,e_0,1,e_1,perm[faces->ReferenceElement->Type->faceNode[1]]);                               getDist(dist,e_0,1,e_1,perm[faces->ReferenceElement->Type->faceNode[1]]);
151                               if (dist>h*tolerance) {                               if (dist>h*tolerance) {
152                                   sprintf(error_msg,"Mesh_findMatchingFaces:couldn't match the second node of element %d to touching element %d",e_0,e_1);                                   sprintf(error_msg,"Mesh_findMatchingFaces:couldn't match the second node of element %d to touching element %d",e_0,e_1);
# Line 188  void Finley_Mesh_findMatchingFaces(Finle Line 186  void Finley_Mesh_findMatchingFaces(Finle
186      TMPMEMFREE(a1);      TMPMEMFREE(a1);
187    
188  #undef getDist  #undef getDist
 #undef SWAP  
189  }  }

Legend:
Removed from v.1376  
changed lines
  Added in v.1377

  ViewVC Help
Powered by ViewVC 1.1.26