/[escript]/temp/finley/src/Mesh_findMatchingFaces.c
ViewVC logotype

Diff of /temp/finley/src/Mesh_findMatchingFaces.c

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

revision 1028 by gross, Wed Mar 14 00:15:24 2007 UTC revision 1377 by gross, Wed Jan 9 03:45:59 2008 UTC
# Line 1  Line 1 
1  /*  
2   ************************************************************  /* $Id$ */
3   *          Copyright 2006 by ACcESS MNRF                   *  
4   *                                                          *  /*******************************************************
5   *              http://www.access.edu.au                    *   *
6   *       Primary Business: Queensland, Australia            *   *           Copyright 2003-2007 by ACceSS MNRF
7   *  Licensed under the Open Software License version 3.0    *   *       Copyright 2007 by University of Queensland
8   *     http://www.opensource.org/licenses/osl-3.0.php       *   *
9   *                                                          *   *                http://esscc.uq.edu.au
10   ************************************************************   *        Primary Business: Queensland, Australia
11  */   *  Licensed under the Open Software License version 3.0
12     *     http://www.opensource.org/licenses/osl-3.0.php
13     *
14     *******************************************************/
15    
16  /**************************************************************/  /**************************************************************/
17    
# Line 18  Line 21 
21    
22  /**************************************************************/  /**************************************************************/
23    
 /*  Author: gross@access.edu.au */  
 /*  Version: $Id$  
   
 /**************************************************************/  
   
24  #include "Util.h"  #include "Util.h"
25  #include "Mesh.h"  #include "Mesh.h"
26  /**************************************************************/  /**************************************************************/
# Line 46  int Finley_Mesh_findMatchingFaces_compar Line 44  int Finley_Mesh_findMatchingFaces_compar
44     if ( e1->refId < e2->refId ) {     if ( e1->refId < e2->refId ) {
45         return -1;         return -1;
46     } else if ( e1->refId > e2->refId ) {     } else if ( e1->refId > e2->refId ) {
47         return -1;         return 1;
48     } else {     } else {
49         return 0;         return 0;
50     }     }
# Line 60  void Finley_Mesh_findMatchingFaces(Finle Line 58  void Finley_Mesh_findMatchingFaces(Finle
58        for (i=0;i<numDim;i++) _dist_=MAX(_dist_,ABS(X[INDEX3(i,_i0_,_e0_,numDim,NN)]-X[INDEX3(i,_i1_,_e1_,numDim,NN)])); \        for (i=0;i<numDim;i++) _dist_=MAX(_dist_,ABS(X[INDEX3(i,_i0_,_e0_,numDim,NN)]-X[INDEX3(i,_i1_,_e1_,numDim,NN)])); \
59        }        }
60    
 #define SWAP(_i1_,_i2_) \  
             {index_t* i;  \  
               i=(_i2_); \  
               (_i2_)=(_i1_); \  
               (_i1_)=i; \  
              }  
   
61      char error_msg[LenErrorMsg_MAX];      char error_msg[LenErrorMsg_MAX];
62      double h=DBLE(HUGE_VAL),h_local,dist,*X=NULL;      double h=DBLE(HUGE_VAL),h_local,dist,*X=NULL;
63      dim_t NN=faces->ReferenceElement->Type->numNodes;      dim_t NN=faces->ReferenceElement->Type->numNodes;
64      dim_t numDim=nodes->numDim;      dim_t numDim=nodes->numDim;
65      Finley_Mesh_findMatchingFaces_center *center;      Finley_Mesh_findMatchingFaces_center *center;
66      index_t e_0,e_1,*a1=NULL,*a2=NULL,*perm=NULL,*perm_tmp=NULL;      index_t e_0,e_1,*a1=NULL,*a2=NULL,*perm=NULL,*perm_tmp=NULL,*itmp_ptr=NULL;
67      dim_t e,i,i0,i1,n;      dim_t e,i,i0,i1,n;
68    
69      X=TMPMEMALLOC(NN*numDim*faces->numElements,double);      X=TMPMEMALLOC(NN*numDim*faces->numElements,double);
# Line 128  void Finley_Mesh_findMatchingFaces(Finle Line 119  void Finley_Mesh_findMatchingFaces(Finle
119                   if (dist<=h*tolerance) break;                   if (dist<=h*tolerance) break;
120                   if (faces->ReferenceElement->Type->shiftNodes[0]>=0) {                   if (faces->ReferenceElement->Type->shiftNodes[0]>=0) {
121                      /* rotate the nodes */                      /* rotate the nodes */
122                      for (i=0;i<NN;i++) perm_tmp[i]=perm[faces->ReferenceElement->Type->shiftNodes[i]];                      itmp_ptr=perm;
123                      SWAP(perm,perm_tmp);                      perm=perm_tmp;
124                        perm_tmp=itmp_ptr;
125                        #pragma ivdep
126                        for (i=0;i<NN;i++) perm[i]=perm_tmp[faces->ReferenceElement->Type->shiftNodes[i]];
127                   }                   }
128                   /* if the permutation is back at the identity, ie. perm[0]=0, the faces don't match: */                   /* if the permutation is back at the identity, ie. perm[0]=0, the faces don't match: */
129                   if (perm[0]==0) {                   if (perm[0]==0) {
# Line 148  void Finley_Mesh_findMatchingFaces(Finle Line 142  void Finley_Mesh_findMatchingFaces(Finle
142                               sprintf(error_msg,"Mesh_findMatchingFaces:couldn't match the second node of element %d to touching element %d",e_0,e_1);                               sprintf(error_msg,"Mesh_findMatchingFaces:couldn't match the second node of element %d to touching element %d",e_0,e_1);
143                               Finley_setError(VALUE_ERROR,error_msg);                               Finley_setError(VALUE_ERROR,error_msg);
144                            } else {                            } else {
145                               for (i=0;i<NN;i++) perm_tmp[i]=perm[faces->ReferenceElement->Type->reverseNodes[i]];                               itmp_ptr=perm;
146                               SWAP(perm,perm_tmp);                               perm=perm_tmp;
147                                 perm_tmp=itmp_ptr;
148                                 #pragma ivdep
149                                 for (i=0;i<NN;i++) perm[i]=perm_tmp[faces->ReferenceElement->Type->reverseNodes[i]];
150                               getDist(dist,e_0,1,e_1,perm[faces->ReferenceElement->Type->faceNode[1]]);                               getDist(dist,e_0,1,e_1,perm[faces->ReferenceElement->Type->faceNode[1]]);
151                               if (dist>h*tolerance) {                               if (dist>h*tolerance) {
152                                   sprintf(error_msg,"Mesh_findMatchingFaces:couldn't match the second node of element %d to touching element %d",e_0,e_1);                                   sprintf(error_msg,"Mesh_findMatchingFaces:couldn't match the second node of element %d to touching element %d",e_0,e_1);
# Line 189  void Finley_Mesh_findMatchingFaces(Finle Line 186  void Finley_Mesh_findMatchingFaces(Finle
186      TMPMEMFREE(a1);      TMPMEMFREE(a1);
187    
188  #undef getDist  #undef getDist
 #undef SWAP  
189  }  }
   
 /*  
 * $Log$  
 * Revision 1.6  2005/09/15 03:44:22  jgs  
 * Merge of development branch dev-02 back to main trunk on 2005-09-15  
 *  
 * Revision 1.5.2.1  2005/09/07 06:26:19  gross  
 * the solver from finley are put into the standalone package paso now  
 *  
 * Revision 1.5  2005/07/08 04:07:51  jgs  
 * Merge of development branch back to main trunk on 2005-07-08  
 *  
 * Revision 1.4  2004/12/15 07:08:32  jgs  
 * *** empty log message ***  
 * Revision 1.1.1.1.2.2  2005/06/29 02:34:51  gross  
 * some changes towards 64 integers in finley  
 *  
 * Revision 1.1.1.1.2.1  2004/11/24 01:37:14  gross  
 * some changes dealing with the integer overflow in memory allocation. Finley solves 4M unknowns now  
 *  
 *  
 *  
 */  
   

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

  ViewVC Help
Powered by ViewVC 1.1.26