/[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 102 by jgs, Wed Dec 15 07:08:39 2004 UTC revision 123 by jgs, Fri Jul 8 04:08:13 2005 UTC
# Line 20  Line 20 
20    
21  void Finley_Mesh_joinFaces(Finley_Mesh* self,double safety_factor,double tolerance) {  void Finley_Mesh_joinFaces(Finley_Mesh* self,double safety_factor,double tolerance) {
22    
23     int numPairs,*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;
24     Finley_ElementFile *newFaceElementsFile=NULL,*newContactElementsFile=NULL;     Finley_ElementFile *newFaceElementsFile=NULL,*newContactElementsFile=NULL;
25     int e,i,e0,e1;     dim_t e,i,numPairs;
26     if (self->FaceElements==NULL) return;     if (self->FaceElements==NULL) return;
27    
28     if (self->FaceElements->ReferenceElement->Type->numNodesOnFace<=0) {     if (self->FaceElements->ReferenceElement->Type->numNodesOnFace<=0) {
# Line 47  void Finley_Mesh_joinFaces(Finley_Mesh* Line 47  void Finley_Mesh_joinFaces(Finley_Mesh*
47     }     }
48    
49     /* allocate work arrays */     /* allocate work arrays */
50     elem1=TMPMEMALLOC(self->FaceElements->numElements,int);     elem1=TMPMEMALLOC(self->FaceElements->numElements,index_t);
51     elem0=TMPMEMALLOC(self->FaceElements->numElements,int);     elem0=TMPMEMALLOC(self->FaceElements->numElements,index_t);
52     elem_mask=TMPMEMALLOC(self->FaceElements->numElements,int);     elem_mask=TMPMEMALLOC(self->FaceElements->numElements,index_t);
53     matching_nodes_in_elem1=TMPMEMALLOC(self->FaceElements->numElements*NN,int);     matching_nodes_in_elem1=TMPMEMALLOC(self->FaceElements->numElements*NN,index_t);
54    
55     if (!(Finley_checkPtr(elem1) || Finley_checkPtr(elem0) || Finley_checkPtr(elem_mask) || Finley_checkPtr(matching_nodes_in_elem1)))  {     if (!(Finley_checkPtr(elem1) || Finley_checkPtr(elem0) || Finley_checkPtr(elem_mask) || Finley_checkPtr(matching_nodes_in_elem1)))  {
56        /* find the matching face elements */        /* find the matching face elements */
# Line 63  void Finley_Mesh_joinFaces(Finley_Mesh* Line 63  void Finley_Mesh_joinFaces(Finley_Mesh*
63               elem_mask[elem0[e]]=0;               elem_mask[elem0[e]]=0;
64               elem_mask[elem1[e]]=0;               elem_mask[elem1[e]]=0;
65           }           }
66           int new_numFaceElements=0;           dim_t new_numFaceElements=0;
67           /* OMP */           /* OMP */
68           for(e=0;e<self->FaceElements->numElements;e++) {           for(e=0;e<self->FaceElements->numElements;e++) {
69               if (elem_mask[e]>0) {               if (elem_mask[e]>0) {
# Line 84  void Finley_Mesh_joinFaces(Finley_Mesh* Line 84  void Finley_Mesh_joinFaces(Finley_Mesh*
84              Finley_ElementFile_gather(elem_mask,self->FaceElements,newFaceElementsFile);              Finley_ElementFile_gather(elem_mask,self->FaceElements,newFaceElementsFile);
85              /* get the Contact elements which are still in use:*/              /* get the Contact elements which are still in use:*/
86              Finley_ElementFile_copyTable(0,newContactElementsFile,0,0,self->ContactElements);              Finley_ElementFile_copyTable(0,newContactElementsFile,0,0,self->ContactElements);
87              int c=self->ContactElements->numElements;              dim_t c=self->ContactElements->numElements;
88              /* OMP */              /* OMP */
89              for (e=0;e<numPairs;e++) {              for (e=0;e<numPairs;e++) {
90                   e0=elem0[e];                   e0=elem0[e];
# Line 96  void Finley_Mesh_joinFaces(Finley_Mesh* Line 96  void Finley_Mesh_joinFaces(Finley_Mesh*
96                   for (i=0;i<NN;i++) newContactElementsFile->Nodes[INDEX2(i+NN,c,NN_Contact)]=matching_nodes_in_elem1[INDEX2(i,e,NN)];                   for (i=0;i<NN;i++) newContactElementsFile->Nodes[INDEX2(i+NN,c,NN_Contact)]=matching_nodes_in_elem1[INDEX2(i,e,NN)];
97                   c++;                   c++;
98              }              }
99              newContactElementsFile->numColors=numPairs;              newContactElementsFile->minColor=0;
100                newContactElementsFile->maxColor=numPairs-1;
101           }           }
102           /* set new face and Contact elements */           /* set new face and Contact elements */
103           if (Finley_ErrorCode==NO_ERROR) {           if (Finley_ErrorCode==NO_ERROR) {
# Line 125  void Finley_Mesh_joinFaces(Finley_Mesh* Line 126  void Finley_Mesh_joinFaces(Finley_Mesh*
126    
127  /*  /*
128  * $Log$  * $Log$
129    * Revision 1.5  2005/07/08 04:07:52  jgs
130    * Merge of development branch back to main trunk on 2005-07-08
131    *
132  * Revision 1.4  2004/12/15 07:08:33  jgs  * Revision 1.4  2004/12/15 07:08:33  jgs
133  * *** empty log message ***  * *** empty log message ***
134    * Revision 1.1.1.1.2.2  2005/06/29 02:34:52  gross
135    * some changes towards 64 integers in finley
136    *
137    * Revision 1.1.1.1.2.1  2004/11/24 01:37:14  gross
138    * some changes dealing with the integer overflow in memory allocation. Finley solves 4M unknowns now
139  *  *
140  *  *
141  *  *

Legend:
Removed from v.102  
changed lines
  Added in v.123

  ViewVC Help
Powered by ViewVC 1.1.26