/[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 757 by woo409, Mon Jun 26 13:12:56 2006 UTC revision 888 by gross, Tue Nov 7 08:31:26 2006 UTC
# Line 43  int Finley_Mesh_findMatchingFaces_compar Line 43  int Finley_Mesh_findMatchingFaces_compar
43          if (g) return 1;          if (g) return 1;
44       }       }
45     }     }
46     return 0;     if ( e1->refId < e2->refId ) {
47           return -1;
48       } else if ( e1->refId > e2->refId ) {
49           return -1;
50       } else {
51           return 0;
52       }
53  }  }
54    
55  void Finley_Mesh_findMatchingFaces(Finley_NodeFile *nodes, Finley_ElementFile *faces, double safety_factor,double tolerance,  void Finley_Mesh_findMatchingFaces(Finley_NodeFile *nodes, Finley_ElementFile *faces, double safety_factor,double tolerance,
# Line 95  void Finley_Mesh_findMatchingFaces(Finle Line 101  void Finley_Mesh_findMatchingFaces(Finle
101         Finley_Mesh_lockingGridSize=h*MAX(safety_factor,0);         Finley_Mesh_lockingGridSize=h*MAX(safety_factor,0);
102         #ifdef Finley_TRACE         #ifdef Finley_TRACE
103         printf("locking grid size is %e\n",Finley_Mesh_lockingGridSize);         printf("locking grid size is %e\n",Finley_Mesh_lockingGridSize);
104           printf("absolute tolerance is %e.\n",h * tolerance);
105         #endif         #endif
106         /* sort the elements by center center coordinates (lexigraphical)*/         /* sort the elements by center center coordinates (lexigraphical)*/
107         qsort(center,faces->numElements,sizeof(Finley_Mesh_findMatchingFaces_center),Finley_Mesh_findMatchingFaces_compar);         qsort(center,faces->numElements,sizeof(Finley_Mesh_findMatchingFaces_center),Finley_Mesh_findMatchingFaces_compar);
# Line 102  void Finley_Mesh_findMatchingFaces(Finle Line 109  void Finley_Mesh_findMatchingFaces(Finle
109         *numPairs=0;         *numPairs=0;
110         /* OMP */         /* OMP */
111         for (e=0;e<faces->numElements-1 && Finley_noError();e++) {         for (e=0;e<faces->numElements-1 && Finley_noError();e++) {
112            if (Finley_Mesh_findMatchingFaces_compar((void*) &(center[e]),(void*) &(center[e+1]))==0) {            dist=0;
113              for (i=0;i<numDim;i++) dist=MAX(dist,ABS(center[e].x[i]-center[e+1].x[i]));
114              if (dist < h * tolerance) {
115                e_0=center[e].refId;                e_0=center[e].refId;
116                e_1=center[e+1].refId;                e_1=center[e+1].refId;
117                elem0[*numPairs]=e_0;                elem0[*numPairs]=e_0;
# Line 122  void Finley_Mesh_findMatchingFaces(Finle Line 131  void Finley_Mesh_findMatchingFaces(Finle
131                   }                   }
132                   /* 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: */
133                   if (perm[0]==0) {                   if (perm[0]==0) {
134                         sprintf(error_msg,"__FILE__:couldn't match first node of element %d to touching element %d",e_0,e_1);                         sprintf(error_msg,"Mesh_findMatchingFaces:couldn't match first node of element %d to touching element %d",e_0,e_1);
135                         Finley_setError(VALUE_ERROR,error_msg);                         Finley_setError(VALUE_ERROR,error_msg);
136                   }                   }
137                }                }
# Line 134  void Finley_Mesh_findMatchingFaces(Finle Line 143  void Finley_Mesh_findMatchingFaces(Finle
143                      if (dist>h*tolerance) {                      if (dist>h*tolerance) {
144                            /* rotate the nodes */                            /* rotate the nodes */
145                            if (faces->ReferenceElement->Type->reverseNodes[0]<0) {                            if (faces->ReferenceElement->Type->reverseNodes[0]<0) {
146                               sprintf(error_msg,"__FILE__: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);
147                               Finley_setError(VALUE_ERROR,error_msg);                               Finley_setError(VALUE_ERROR,error_msg);
148                            } else {                            } else {
149                               for (i=0;i<NN;i++) perm_tmp[i]=perm[faces->ReferenceElement->Type->reverseNodes[i]];                               for (i=0;i<NN;i++) perm_tmp[i]=perm[faces->ReferenceElement->Type->reverseNodes[i]];
150                               SWAP(perm,perm_tmp);                               SWAP(perm,perm_tmp);
151                               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]]);
152                               if (dist>h*tolerance) {                               if (dist>h*tolerance) {
153                                   sprintf(error_msg,"__FILE__: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);
154                                   Finley_setError(VALUE_ERROR,error_msg);                                   Finley_setError(VALUE_ERROR,error_msg);
155                               }                               }
156                            }                            }
# Line 154  void Finley_Mesh_findMatchingFaces(Finle Line 163  void Finley_Mesh_findMatchingFaces(Finle
163                      n=faces->ReferenceElement->Type->faceNode[i];                      n=faces->ReferenceElement->Type->faceNode[i];
164                      getDist(dist,e_0,n,e_1,perm[n]);                      getDist(dist,e_0,n,e_1,perm[n]);
165                      if (dist>h*tolerance) {                      if (dist>h*tolerance) {
166                         sprintf(error_msg,"__FILE__:couldn't match the %d-th node of element %d to touching element %d",i,e_0,e_1);                         sprintf(error_msg,"Mesh_findMatchingFaces:couldn't match the %d-th node of element %d to touching element %d",i,e_0,e_1);
167                         Finley_setError(VALUE_ERROR,error_msg);                         Finley_setError(VALUE_ERROR,error_msg);
168                         break;                         break;
169                      }                      }

Legend:
Removed from v.757  
changed lines
  Added in v.888

  ViewVC Help
Powered by ViewVC 1.1.26