/[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 149 by jgs, Fri Jul 8 04:08:13 2005 UTC revision 150 by jgs, Thu Sep 15 03:44:45 2005 UTC
# Line 1  Line 1 
1    /*
2     ******************************************************************************
3     *                                                                            *
4     *       COPYRIGHT  ACcESS 2003,2004,2005 -  All Rights Reserved              *
5     *                                                                            *
6     * This software is the property of ACcESS. No part of this code              *
7     * may be copied in any form or by any means without the expressed written    *
8     * consent of ACcESS.  Copying, use or modification of this software          *
9     * by any unauthorised person is illegal unless that person has a software    *
10     * license agreement with ACcESS.                                             *
11     *                                                                            *
12     ******************************************************************************
13    */
14    
15  /**************************************************************/  /**************************************************************/
16    
17  /*   Finley: Mesh */  /*   Finley: Mesh */
# Line 6  Line 20 
20    
21  /**************************************************************/  /**************************************************************/
22    
23  /*   Copyrights by ACcESS Australia 2003 */  /*  Author: gross@access.edu.au */
24  /*   Author: gross@access.edu.au */  /*  Version: $Id$ */
 /*   Version: $Id$ */  
25    
26  /**************************************************************/  /**************************************************************/
27    
 #include "Common.h"  
 #include "Finley.h"  
28  #include "Mesh.h"  #include "Mesh.h"
29    
30  /**************************************************************/  /**************************************************************/
31    
32  void Finley_Mesh_joinFaces(Finley_Mesh* self,double safety_factor,double tolerance) {  void Finley_Mesh_joinFaces(Finley_Mesh* self,double safety_factor,double tolerance) {
33    
34       char error_msg[LenErrorMsg_MAX];
35     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;
36     Finley_ElementFile *newFaceElementsFile=NULL,*newContactElementsFile=NULL;     Finley_ElementFile *newFaceElementsFile=NULL,*newContactElementsFile=NULL;
37     dim_t e,i,numPairs;     dim_t e,i,numPairs;
38     if (self->FaceElements==NULL) return;     if (self->FaceElements==NULL) return;
39    
40     if (self->FaceElements->ReferenceElement->Type->numNodesOnFace<=0) {     if (self->FaceElements->ReferenceElement->Type->numNodesOnFace<=0) {
41       Finley_ErrorCode=TYPE_ERROR;       sprintf(error_msg,"__FILE__:joining faces cannot be applied to face elements of type %s",self->FaceElements->ReferenceElement->Type->Name);
42       sprintf(Finley_ErrorMsg,"joining faces cannot be applied to face elements of type %s",self->FaceElements->ReferenceElement->Type->Name);       Finley_setError(TYPE_ERROR,error_msg);
43       return;       return;
44     }     }
45     if (self->ContactElements==NULL) {     if (self->ContactElements==NULL) {
46       Finley_ErrorCode=TYPE_ERROR;       Finley_setError(TYPE_ERROR,"__FILE__: no contact element file present.");
      sprintf(Finley_ErrorMsg,"no contact element file present.");  
47       return;       return;
48     }     }
49    
# Line 40  void Finley_Mesh_joinFaces(Finley_Mesh* Line 51  void Finley_Mesh_joinFaces(Finley_Mesh*
51     int NN_Contact=self->ContactElements->ReferenceElement->Type->numNodes;     int NN_Contact=self->ContactElements->ReferenceElement->Type->numNodes;
52    
53     if (2*NN!=NN_Contact) {     if (2*NN!=NN_Contact) {
54       Finley_ErrorCode=TYPE_ERROR;       sprintf(error_msg,"__FILE__:contact element file for %s cannot hold elements created from face elements %s",
      sprintf(Finley_ErrorMsg,"contact element file for %s cannot hold elements created from face elements %s",  
55             self->ContactElements->ReferenceElement->Type->Name,self->FaceElements->ReferenceElement->Type->Name);             self->ContactElements->ReferenceElement->Type->Name,self->FaceElements->ReferenceElement->Type->Name);
56         Finley_setError(TYPE_ERROR,error_msg);
57       return;       return;
58     }     }
59    
# Line 55  void Finley_Mesh_joinFaces(Finley_Mesh* Line 66  void Finley_Mesh_joinFaces(Finley_Mesh*
66     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)))  {
67        /* find the matching face elements */        /* find the matching face elements */
68        Finley_Mesh_findMatchingFaces(self->Nodes,self->FaceElements,safety_factor,tolerance,&numPairs,elem0,elem1,matching_nodes_in_elem1);        Finley_Mesh_findMatchingFaces(self->Nodes,self->FaceElements,safety_factor,tolerance,&numPairs,elem0,elem1,matching_nodes_in_elem1);
69        if (Finley_ErrorCode==NO_ERROR) {        if (Finley_noError()) {
70           /* get a list of the face elements to be kept */           /* get a list of the face elements to be kept */
71           #pragma omp parallel for private(e) schedule(static)           #pragma omp parallel for private(e) schedule(static)
72           for(e=0;e<self->FaceElements->numElements;e++) elem_mask[e]=1;           for(e=0;e<self->FaceElements->numElements;e++) elem_mask[e]=1;
# Line 74  void Finley_Mesh_joinFaces(Finley_Mesh* Line 85  void Finley_Mesh_joinFaces(Finley_Mesh*
85           /*  allocate new face element and Contact element files */           /*  allocate new face element and Contact element files */
86           newContactElementsFile=Finley_ElementFile_alloc(self->ContactElements->ReferenceElement->Type->TypeId,self->ContactElements->order);           newContactElementsFile=Finley_ElementFile_alloc(self->ContactElements->ReferenceElement->Type->TypeId,self->ContactElements->order);
87           newFaceElementsFile=Finley_ElementFile_alloc(self->FaceElements->ReferenceElement->Type->TypeId,self->FaceElements->order);           newFaceElementsFile=Finley_ElementFile_alloc(self->FaceElements->ReferenceElement->Type->TypeId,self->FaceElements->order);
88           if (Finley_ErrorCode==NO_ERROR) {           if (Finley_noError()) {
89                 Finley_ElementFile_allocTable(newContactElementsFile,numPairs+self->ContactElements->numElements);                 Finley_ElementFile_allocTable(newContactElementsFile,numPairs+self->ContactElements->numElements);
90                 Finley_ElementFile_allocTable(newFaceElementsFile,new_numFaceElements);                 Finley_ElementFile_allocTable(newFaceElementsFile,new_numFaceElements);
91           }           }
92           /* copy the old elements over */           /* copy the old elements over */
93           if (Finley_ErrorCode==NO_ERROR) {           if (Finley_noError()) {
94              /* get the face elements which are still in use:*/              /* get the face elements which are still in use:*/
95              Finley_ElementFile_gather(elem_mask,self->FaceElements,newFaceElementsFile);              Finley_ElementFile_gather(elem_mask,self->FaceElements,newFaceElementsFile);
96              /* get the Contact elements which are still in use:*/              /* get the Contact elements which are still in use:*/
# Line 100  void Finley_Mesh_joinFaces(Finley_Mesh* Line 111  void Finley_Mesh_joinFaces(Finley_Mesh*
111              newContactElementsFile->maxColor=numPairs-1;              newContactElementsFile->maxColor=numPairs-1;
112           }           }
113           /* set new face and Contact elements */           /* set new face and Contact elements */
114           if (Finley_ErrorCode==NO_ERROR) {           if (Finley_noError()) {
115    
116              Finley_ElementFile_dealloc(self->FaceElements);              Finley_ElementFile_dealloc(self->FaceElements);
117              self->FaceElements=newFaceElementsFile;              self->FaceElements=newFaceElementsFile;
# Line 126  void Finley_Mesh_joinFaces(Finley_Mesh* Line 137  void Finley_Mesh_joinFaces(Finley_Mesh*
137    
138  /*  /*
139  * $Log$  * $Log$
140    * Revision 1.6  2005/09/15 03:44:22  jgs
141    * Merge of development branch dev-02 back to main trunk on 2005-09-15
142    *
143    * Revision 1.5.2.1  2005/09/07 06:26:19  gross
144    * the solver from finley are put into the standalone package paso now
145    *
146  * Revision 1.5  2005/07/08 04:07:52  jgs  * Revision 1.5  2005/07/08 04:07:52  jgs
147  * Merge of development branch back to main trunk on 2005-07-08  * Merge of development branch back to main trunk on 2005-07-08
148  *  *

Legend:
Removed from v.149  
changed lines
  Added in v.150

  ViewVC Help
Powered by ViewVC 1.1.26