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

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

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

revision 2747 by jfenwick, Mon Jul 20 06:20:06 2009 UTC revision 2748 by gross, Tue Nov 17 07:32:59 2009 UTC
# Line 30  void Finley_Mesh_glueFaces(Finley_Mesh* Line 30  void Finley_Mesh_glueFaces(Finley_Mesh*
30     Finley_NodeFile *newNodeFile=NULL;     Finley_NodeFile *newNodeFile=NULL;
31     Finley_ElementFile *newFaceElementsFile=NULL;     Finley_ElementFile *newFaceElementsFile=NULL;
32     dim_t numPairs,e,i,n, NNFace, NN, numDim, new_numFaceElements, newNumNodes;     dim_t numPairs,e,i,n, NNFace, NN, numDim, new_numFaceElements, newNumNodes;
33     index_t face_node, *elem1=NULL,*elem0=NULL,*elem_mask=NULL,*new_node_label=NULL,*new_node_list=NULL,*new_node_mask=NULL,*matching_nodes_in_elem1=NULL;     index_t face_node, *elem1=NULL,*elem0=NULL,*elem_mask=NULL,*new_node_label=NULL,*new_node_list=NULL,*new_node_mask=NULL,*matching_nodes_in_elem1=NULL, *faceNodes=NULL;
34       Finley_ReferenceElement*  faceRefElement=NULL;
35      
36     if (self->MPIInfo->size>1) {     if (self->MPIInfo->size>1) {
37       Finley_setError(TYPE_ERROR,"Finley_Mesh_glueFaces: MPI is not supported yet.");       Finley_setError(TYPE_ERROR,"Finley_Mesh_glueFaces: MPI is not supported yet.");
38       return;       return;
39     }     }
40                
41     if (self->FaceElements==NULL) return;     if (self->FaceElements==NULL) return;
42       faceRefElement= Finley_ReferenceElementSet_borrowReferenceElement(self->FaceElements->referenceElementSet, FALSE);
43     if (self->FaceElements->ReferenceElement->Type->numNodesOnFace<=0) {     NNFace=faceRefElement->Type->numNodesOnFace;
44       sprintf(error_msg,"Finley_Mesh_glueFaces:glueing faces cannot be applied to face elements of type %s",self->FaceElements->ReferenceElement->Type->Name);     NN=self->FaceElements->numNodes;
45       numDim=self->Nodes->numDim;
46       faceNodes=faceRefElement->Type->faceNodes;
47      
48       if (NNFace<=0) {
49         sprintf(error_msg,"Finley_Mesh_glueFaces:glueing faces cannot be applied to face elements of type %s",faceRefElement->Type->Name);
50       Finley_setError(TYPE_ERROR,error_msg);       Finley_setError(TYPE_ERROR,error_msg);
51       return;       return;
52     }     }
53    
    NNFace=self->FaceElements->ReferenceElement->Type->numNodesOnFace;  
    NN=self->FaceElements->ReferenceElement->Type->numNodes;  
    numDim=self->Nodes->numDim;  
54     /* allocate work arrays */     /* allocate work arrays */
55     elem1=TMPMEMALLOC(self->FaceElements->numElements,index_t);     elem1=TMPMEMALLOC(self->FaceElements->numElements,index_t);
56     elem0=TMPMEMALLOC(self->FaceElements->numElements,index_t);     elem0=TMPMEMALLOC(self->FaceElements->numElements,index_t);
# Line 67  void Finley_Mesh_glueFaces(Finley_Mesh* Line 70  void Finley_Mesh_glueFaces(Finley_Mesh*
70               elem_mask[elem0[e]]=1;               elem_mask[elem0[e]]=1;
71               elem_mask[elem1[e]]=1;               elem_mask[elem1[e]]=1;
72               for (i=0;i<NNFace;i++) {               for (i=0;i<NNFace;i++) {
73                  face_node=self->FaceElements->ReferenceElement->Type->faceNode[i];                  face_node=faceNodes[i];
74                  new_node_label[matching_nodes_in_elem1[INDEX2(face_node,e,NN)]]=self->FaceElements->Nodes[INDEX2(face_node,elem0[e],NN)];                  new_node_label[matching_nodes_in_elem1[INDEX2(face_node,e,NN)]]=self->FaceElements->Nodes[INDEX2(face_node,elem0[e],NN)];
75               }               }
76           }           }
# Line 97  void Finley_Mesh_glueFaces(Finley_Mesh* Line 100  void Finley_Mesh_glueFaces(Finley_Mesh*
100           if (Finley_noError()) {           if (Finley_noError()) {
101               Finley_NodeFile_allocTable(newNodeFile,newNumNodes);               Finley_NodeFile_allocTable(newNodeFile,newNumNodes);
102               if (Finley_noError()) {               if (Finley_noError()) {
103                  newFaceElementsFile=Finley_ElementFile_alloc(self->FaceElements->ReferenceElement->Type->TypeId,                  newFaceElementsFile=Finley_ElementFile_alloc(self->FaceElements->referenceElementSet, self->MPIInfo);
                                                              self->FaceElements->order,  
                                                              self->FaceElements->reduced_order,  
                                                              self->MPIInfo);  
104                  if (Finley_noError()) {                  if (Finley_noError()) {
105                     Finley_ElementFile_allocTable(newFaceElementsFile,new_numFaceElements);                     Finley_ElementFile_allocTable(newFaceElementsFile,new_numFaceElements);
106                   }                   }

Legend:
Removed from v.2747  
changed lines
  Added in v.2748

  ViewVC Help
Powered by ViewVC 1.1.26