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

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

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

trunk/esys2/finley/src/finleyC/Mesh_merge.c revision 82 by jgs, Tue Oct 26 06:53:54 2004 UTC trunk/finley/src/Mesh_merge.c revision 616 by elspeth, Wed Mar 22 02:46:56 2006 UTC
# Line 1  Line 1 
1    /*
2     ************************************************************
3     *          Copyright 2006 by ACcESS MNRF                   *
4     *                                                          *
5     *              http://www.access.edu.au                    *
6     *       Primary Business: Queensland, Australia            *
7     *  Licensed under the Open Software License version 3.0    *
8     *     http://www.opensource.org/licenses/osl-3.0.php       *
9     *                                                          *
10     ************************************************************
11    */
12    
13  /**************************************************************/  /**************************************************************/
14    
15  /*   Finley: Mesh */  /*   Finley: Mesh */
# Line 7  Line 19 
19    
20  /**************************************************************/  /**************************************************************/
21    
22  /*   Copyrights by ACcESS Australia 2003/04 */  /*  Author: gross@access.edu.au */
23  /*   Author: gross@access.edu.au */  /*  Version: $Id$ */
 /*   Version: $Id$ */  
24    
25  /**************************************************************/  /**************************************************************/
26    
 #include "Finley.h"  
27  #include "Mesh.h"  #include "Mesh.h"
28  #include "Util.h"  #include "Util.h"
29    
# Line 21  Line 31 
31    
32  static double  Finley_Mesh_lockingGridSize=0;  static double  Finley_Mesh_lockingGridSize=0;
33    
34  Finley_Mesh* Finley_Mesh_merge(int numMsh, Finley_Mesh** msh) {  Finley_Mesh* Finley_Mesh_merge(dim_t numMsh, Finley_Mesh** msh) {
35    Finley_Mesh* out=NULL;    Finley_Mesh* out=NULL;
36    int i;    dim_t i;
37    char newName[LenString_MAX];    char newName[LenString_MAX];
38    if (numMsh==0) {    if (numMsh==0) {
39       Finley_ErrorCode=VALUE_ERROR;       Finley_setError(VALUE_ERROR,"__FILE__: Empty mesh list");
      sprintf(Finley_ErrorMsg,"Empty mesh list");  
40    } else {    } else {
41      int order=msh[0]->order;      index_t order=msh[0]->order;
42      int numDim=msh[0]->Nodes->numDim;      dim_t numDim=msh[0]->Nodes->numDim;
43      ElementTypeId elementTypeId=NoType;      ElementTypeId elementTypeId=NoType;
44      ElementTypeId faceElementTypeId=NoType;      ElementTypeId faceElementTypeId=NoType;
45      ElementTypeId pointTypeId=NoType;      ElementTypeId pointTypeId=NoType;
46      ElementTypeId contactTypeId=NoType;      ElementTypeId contactTypeId=NoType;
47      strcpy(newName,"");      strcpy(newName,"");
48      int numNodes=0;      dim_t numNodes=0;
49      int numElements=0;      dim_t numElements=0;
50      int numFaceElements=0;      dim_t numFaceElements=0;
51      int numContactElements=0;      dim_t numContactElements=0;
52      int numPoints=0;      dim_t numPoints=0;
53      for (i=0;i<numMsh;i++) {      for (i=0;i<numMsh;i++) {
54         /* check if all mesh have the same type and dimensions */         /* check if all mesh have the same type and dimensions */
55         order=MAX(order,msh[i]->order);         order=MAX(order,msh[i]->order);
56         numNodes+=msh[i]->Nodes->numNodes;         numNodes+=msh[i]->Nodes->numNodes;
57         if (numDim!=msh[i]->Nodes->numDim) {         if (numDim!=msh[i]->Nodes->numDim) {
58            Finley_ErrorCode=TYPE_ERROR;            Finley_setError(TYPE_ERROR,"__FILE__: Spatial dimensions of meshes don't match.");
           sprintf(Finley_ErrorMsg,"Spatial dimensions of meshes don't match.");  
59         }         }
60    
61         if (msh[i]->Elements!=NULL) {         if (msh[i]->Elements!=NULL) {
# Line 56  Finley_Mesh* Finley_Mesh_merge(int numMs Line 64  Finley_Mesh* Finley_Mesh_merge(int numMs
64               elementTypeId=msh[i]->Elements->ReferenceElement->Type->TypeId;               elementTypeId=msh[i]->Elements->ReferenceElement->Type->TypeId;
65        } else {        } else {
66               if (elementTypeId!=msh[i]->Elements->ReferenceElement->Type->TypeId ) {               if (elementTypeId!=msh[i]->Elements->ReferenceElement->Type->TypeId ) {
67                 Finley_ErrorCode=TYPE_ERROR;                 Finley_setError(TYPE_ERROR,"__FILE__: element types of meshes don't match.");
                sprintf(Finley_ErrorMsg,"element types of meshes don't match.");  
68               }               }
69            }            }
70         }         }
# Line 68  Finley_Mesh* Finley_Mesh_merge(int numMs Line 75  Finley_Mesh* Finley_Mesh_merge(int numMs
75               faceElementTypeId=msh[i]->FaceElements->ReferenceElement->Type->TypeId;               faceElementTypeId=msh[i]->FaceElements->ReferenceElement->Type->TypeId;
76        } else {        } else {
77               if (faceElementTypeId!=msh[i]->FaceElements->ReferenceElement->Type->TypeId ) {               if (faceElementTypeId!=msh[i]->FaceElements->ReferenceElement->Type->TypeId ) {
78                 Finley_ErrorCode=TYPE_ERROR;                 Finley_setError(TYPE_ERROR,"__FILE__: face element types of meshes don't match.");
                sprintf(Finley_ErrorMsg,"face element types of meshes don't match.");  
79               }               }
80            }            }
81         }         }
# Line 80  Finley_Mesh* Finley_Mesh_merge(int numMs Line 86  Finley_Mesh* Finley_Mesh_merge(int numMs
86               contactTypeId=msh[i]->ContactElements->ReferenceElement->Type->TypeId;               contactTypeId=msh[i]->ContactElements->ReferenceElement->Type->TypeId;
87        } else {        } else {
88               if (contactTypeId!=msh[i]->ContactElements->ReferenceElement->Type->TypeId ) {               if (contactTypeId!=msh[i]->ContactElements->ReferenceElement->Type->TypeId ) {
89                 Finley_ErrorCode=TYPE_ERROR;                 Finley_setError(TYPE_ERROR,"__FILE__: contact element types of meshes don't match.");
                sprintf(Finley_ErrorMsg,"contact element types of meshes don't match.");  
90               }               }
91            }            }
92         }         }
# Line 92  Finley_Mesh* Finley_Mesh_merge(int numMs Line 97  Finley_Mesh* Finley_Mesh_merge(int numMs
97               pointTypeId=msh[i]->Points->ReferenceElement->Type->TypeId;               pointTypeId=msh[i]->Points->ReferenceElement->Type->TypeId;
98        } else {        } else {
99               if (pointTypeId!=msh[i]->Points->ReferenceElement->Type->TypeId ) {               if (pointTypeId!=msh[i]->Points->ReferenceElement->Type->TypeId ) {
100                 Finley_ErrorCode=TYPE_ERROR;                 Finley_setError(TYPE_ERROR,"__FILE__: point element types of meshes don't match.");
                sprintf(Finley_ErrorMsg,"point element types of meshes don't match.");  
101               }               }
102            }            }
103         }         }
# Line 104  Finley_Mesh* Finley_Mesh_merge(int numMs Line 108  Finley_Mesh* Finley_Mesh_merge(int numMs
108    
109      /* allocate */      /* allocate */
110    
111      if (Finley_ErrorCode == NO_ERROR) out=Finley_Mesh_alloc(newName,numDim,order);      if (Finley_noError()) out=Finley_Mesh_alloc(newName,numDim,order);
112    
113      out->Elements=Finley_ElementFile_alloc(elementTypeId,out->order);      out->Elements=Finley_ElementFile_alloc(elementTypeId,out->order);
114      out->FaceElements=Finley_ElementFile_alloc(faceElementTypeId,out->order);      out->FaceElements=Finley_ElementFile_alloc(faceElementTypeId,out->order);
# Line 113  Finley_Mesh* Finley_Mesh_merge(int numMs Line 117  Finley_Mesh* Finley_Mesh_merge(int numMs
117    
118      /* allocate new tables */      /* allocate new tables */
119    
120      if (Finley_ErrorCode == NO_ERROR) {      if (Finley_noError()) {
121          Finley_NodeFile_allocTable(out->Nodes,numNodes);          Finley_NodeFile_allocTable(out->Nodes,numNodes);
122          Finley_ElementFile_allocTable(out->Elements,numElements);          Finley_ElementFile_allocTable(out->Elements,numElements);
123          Finley_ElementFile_allocTable(out->FaceElements,numFaceElements);          Finley_ElementFile_allocTable(out->FaceElements,numFaceElements);
# Line 123  Finley_Mesh* Finley_Mesh_merge(int numMs Line 127  Finley_Mesh* Finley_Mesh_merge(int numMs
127    
128      /* copy tables :*/      /* copy tables :*/
129    
130      if (Finley_ErrorCode == NO_ERROR) {      if (Finley_noError()) {
131    
132          int numNodes=0;          dim_t numNodes=0;
133          int numElements=0;          dim_t numElements=0;
134          int numFaceElements=0;          dim_t numFaceElements=0;
135          int numContactElements=0;          dim_t numContactElements=0;
136          int numPoints=0;          dim_t numPoints=0;
137          int maxNodeID=0;          index_t maxNodeID=0;
138          int maxDOF=0;          index_t maxDOF=0;
139          int maxElementID=0;          index_t maxElementID=0;
140          int maxElementID2=0;          index_t maxElementID2=0;
141    
142          for (i=0;i<numMsh;i++) {          for (i=0;i<numMsh;i++) {
143    
# Line 166  Finley_Mesh* Finley_Mesh_merge(int numMs Line 170  Finley_Mesh* Finley_Mesh_merge(int numMs
170      }      }
171      /* all done  */      /* all done  */
172    
173      if (Finley_ErrorCode != NO_ERROR) {      if (! Finley_noError()) {
174         Finley_Mesh_dealloc(out);         Finley_Mesh_dealloc(out);
175      } else {      } else {
176         Finley_Mesh_prepare(out);         Finley_Mesh_prepare(out);
# Line 180  Finley_Mesh* Finley_Mesh_merge(int numMs Line 184  Finley_Mesh* Finley_Mesh_merge(int numMs
184    
185  /*  /*
186  * $Log$  * $Log$
187  * Revision 1.1  2004/10/26 06:53:57  jgs  * Revision 1.3  2005/09/15 03:44:22  jgs
188  * Initial revision  * Merge of development branch dev-02 back to main trunk on 2005-09-15
189    *
190    * Revision 1.2.2.1  2005/09/07 06:26:19  gross
191    * the solver from finley are put into the standalone package paso now
192    *
193    * Revision 1.2  2005/07/08 04:07:53  jgs
194    * Merge of development branch back to main trunk on 2005-07-08
195    *
196    * Revision 1.1.1.1.2.1  2005/06/29 02:34:52  gross
197    * some changes towards 64 integers in finley
198    *
199    * Revision 1.1.1.1  2004/10/26 06:53:57  jgs
200    * initial import of project esys2
201  *  *
202  * Revision 1.2  2004/07/30 04:37:06  gross  * Revision 1.2  2004/07/30 04:37:06  gross
203  * escript and finley are linking now and RecMeshTest.py has been passed  * escript and finley are linking now and RecMeshTest.py has been passed

Legend:
Removed from v.82  
changed lines
  Added in v.616

  ViewVC Help
Powered by ViewVC 1.1.26