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

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

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

revision 730 by bcumming, Mon May 15 04:03:49 2006 UTC revision 1028 by gross, Wed Mar 14 00:15:24 2007 UTC
# Line 32  void Finley_Mesh_joinFaces(Finley_Mesh* Line 32  void Finley_Mesh_joinFaces(Finley_Mesh*
32     char error_msg[LenErrorMsg_MAX];     char error_msg[LenErrorMsg_MAX];
33     index_t e0,e1,*elem1=NULL,*elem0=NULL,*elem_mask=NULL,*matching_nodes_in_elem1=NULL;     index_t e0,e1,*elem1=NULL,*elem0=NULL,*elem_mask=NULL,*matching_nodes_in_elem1=NULL;
34     Finley_ElementFile *newFaceElementsFile=NULL,*newContactElementsFile=NULL;     Finley_ElementFile *newFaceElementsFile=NULL,*newContactElementsFile=NULL;
35     dim_t e,i,numPairs;     dim_t e,i,numPairs, NN, NN_Contact,c, new_numFaceElements;
36     if (self->FaceElements==NULL) return;     if (self->FaceElements==NULL) return;
37    
38     if (self->FaceElements->ReferenceElement->Type->numNodesOnFace<=0) {     if (self->FaceElements->ReferenceElement->Type->numNodesOnFace<=0) {
# Line 45  void Finley_Mesh_joinFaces(Finley_Mesh* Line 45  void Finley_Mesh_joinFaces(Finley_Mesh*
45       return;       return;
46     }     }
47    
48     int NN=self->FaceElements->ReferenceElement->Type->numNodes;     NN=self->FaceElements->ReferenceElement->Type->numNodes;
49     int NN_Contact=self->ContactElements->ReferenceElement->Type->numNodes;     NN_Contact=self->ContactElements->ReferenceElement->Type->numNodes;
50    
51     if (2*NN!=NN_Contact) {     if (2*NN!=NN_Contact) {
52       sprintf(error_msg,"Finley_Mesh_joinFaces:contact element file for %s cannot hold elements created from face elements %s",       sprintf(error_msg,"Finley_Mesh_joinFaces:contact element file for %s cannot hold elements created from face elements %s",
# Line 72  void Finley_Mesh_joinFaces(Finley_Mesh* Line 72  void Finley_Mesh_joinFaces(Finley_Mesh*
72               elem_mask[elem0[e]]=0;               elem_mask[elem0[e]]=0;
73               elem_mask[elem1[e]]=0;               elem_mask[elem1[e]]=0;
74           }           }
75           dim_t new_numFaceElements=0;           new_numFaceElements=0;
76           /* OMP */           /* OMP */
77           for(e=0;e<self->FaceElements->numElements;e++) {           for(e=0;e<self->FaceElements->numElements;e++) {
78               if (elem_mask[e]>0) {               if (elem_mask[e]>0) {
# Line 98  void Finley_Mesh_joinFaces(Finley_Mesh* Line 98  void Finley_Mesh_joinFaces(Finley_Mesh*
98              Finley_ElementFile_gather(elem_mask,self->FaceElements,newFaceElementsFile);              Finley_ElementFile_gather(elem_mask,self->FaceElements,newFaceElementsFile);
99              /* get the Contact elements which are still in use:*/              /* get the Contact elements which are still in use:*/
100              Finley_ElementFile_copyTable(0,newContactElementsFile,0,0,self->ContactElements);              Finley_ElementFile_copyTable(0,newContactElementsFile,0,0,self->ContactElements);
101              dim_t c=self->ContactElements->numElements;              c=self->ContactElements->numElements;
102              /* OMP */              /* OMP */
103              for (e=0;e<numPairs;e++) {              for (e=0;e<numPairs;e++) {
104                   e0=elem0[e];                   e0=elem0[e];
# Line 112  void Finley_Mesh_joinFaces(Finley_Mesh* Line 112  void Finley_Mesh_joinFaces(Finley_Mesh*
112              }              }
113              newContactElementsFile->minColor=0;              newContactElementsFile->minColor=0;
114              newContactElementsFile->maxColor=numPairs-1;              newContactElementsFile->maxColor=numPairs-1;
115                newContactElementsFile->isPrepared=self->FaceElements->isPrepared;
116           }           }
117           /* set new face and Contact elements */           /* set new face and Contact elements */
118           if (Finley_noError()) {           if (Finley_noError()) {
# Line 136  void Finley_Mesh_joinFaces(Finley_Mesh* Line 137  void Finley_Mesh_joinFaces(Finley_Mesh*
137     TMPMEMFREE(elem0);     TMPMEMFREE(elem0);
138     TMPMEMFREE(matching_nodes_in_elem1);     TMPMEMFREE(matching_nodes_in_elem1);
139     TMPMEMFREE(elem_mask);     TMPMEMFREE(elem_mask);
140       if (Finley_noError()) {
141           if ( ! Finley_Mesh_isPrepared(self) ) {
142              Finley_setError(SYSTEM_ERROR,"Mesh is not prepared for calculation. Contact the programmers.");
143           }
144      }
145  }  }

Legend:
Removed from v.730  
changed lines
  Added in v.1028

  ViewVC Help
Powered by ViewVC 1.1.26