/[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

trunk/finley/src/finley/Mesh_joinFaces.c revision 201 by jgs, Wed Nov 23 04:10:21 2005 UTC trunk/finley/src/Mesh_joinFaces.c revision 1028 by gross, Wed Mar 14 00:15:24 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   ******************************************************************************   ************************************************************
3   *                                                                            *   *          Copyright 2006 by ACcESS MNRF                   *
4   *       COPYRIGHT  ACcESS 2003,2004,2005 -  All Rights Reserved              *   *                                                          *
5   *                                                                            *   *              http://www.access.edu.au                    *
6   * This software is the property of ACcESS. No part of this code              *   *       Primary Business: Queensland, Australia            *
7   * may be copied in any form or by any means without the expressed written    *   *  Licensed under the Open Software License version 3.0    *
8   * consent of ACcESS.  Copying, use or modification of this software          *   *     http://www.opensource.org/licenses/osl-3.0.php       *
9   * by any unauthorised person is illegal unless that person has a software    *   *                                                          *
10   * license agreement with ACcESS.                                             *   ************************************************************
  *                                                                            *  
  ******************************************************************************  
11  */  */
12    
13  /**************************************************************/  /**************************************************************/
# Line 34  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 47  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 74  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 83  void Finley_Mesh_joinFaces(Finley_Mesh* Line 81  void Finley_Mesh_joinFaces(Finley_Mesh*
81               }               }
82           }           }
83           /*  allocate new face element and Contact element files */           /*  allocate new face element and Contact element files */
84    #ifndef PASO_MPI
85           newContactElementsFile=Finley_ElementFile_alloc(self->ContactElements->ReferenceElement->Type->TypeId,self->ContactElements->order);           newContactElementsFile=Finley_ElementFile_alloc(self->ContactElements->ReferenceElement->Type->TypeId,self->ContactElements->order);
86           newFaceElementsFile=Finley_ElementFile_alloc(self->FaceElements->ReferenceElement->Type->TypeId,self->FaceElements->order);           newFaceElementsFile=Finley_ElementFile_alloc(self->FaceElements->ReferenceElement->Type->TypeId,self->FaceElements->order);
87    #else
88      /* TODO */
89      PASO_MPI_TODO;
90    #endif
91           if (Finley_noError()) {           if (Finley_noError()) {
92                 Finley_ElementFile_allocTable(newContactElementsFile,numPairs+self->ContactElements->numElements);                 Finley_ElementFile_allocTable(newContactElementsFile,numPairs+self->ContactElements->numElements);
93                 Finley_ElementFile_allocTable(newFaceElementsFile,new_numFaceElements);                 Finley_ElementFile_allocTable(newFaceElementsFile,new_numFaceElements);
# Line 95  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 109  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 133  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.201  
changed lines
  Added in v.1028

  ViewVC Help
Powered by ViewVC 1.1.26