/[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 123 by jgs, Fri Jul 8 04:08:13 2005 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 26  Finley_Mesh* Finley_Mesh_merge(dim_t num Line 36  Finley_Mesh* Finley_Mesh_merge(dim_t num
36    dim_t 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      index_t order=msh[0]->order;      index_t order=msh[0]->order;
42      dim_t numDim=msh[0]->Nodes->numDim;      dim_t numDim=msh[0]->Nodes->numDim;
# Line 46  Finley_Mesh* Finley_Mesh_merge(dim_t num Line 55  Finley_Mesh* Finley_Mesh_merge(dim_t num
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(dim_t num Line 64  Finley_Mesh* Finley_Mesh_merge(dim_t num
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(dim_t num Line 75  Finley_Mesh* Finley_Mesh_merge(dim_t num
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(dim_t num Line 86  Finley_Mesh* Finley_Mesh_merge(dim_t num
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(dim_t num Line 97  Finley_Mesh* Finley_Mesh_merge(dim_t num
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(dim_t num Line 108  Finley_Mesh* Finley_Mesh_merge(dim_t num
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(dim_t num Line 117  Finley_Mesh* Finley_Mesh_merge(dim_t num
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(dim_t num Line 127  Finley_Mesh* Finley_Mesh_merge(dim_t num
127    
128      /* copy tables :*/      /* copy tables :*/
129    
130      if (Finley_ErrorCode == NO_ERROR) {      if (Finley_noError()) {
131    
132          dim_t numNodes=0;          dim_t numNodes=0;
133          dim_t numElements=0;          dim_t numElements=0;
# Line 166  Finley_Mesh* Finley_Mesh_merge(dim_t num Line 170  Finley_Mesh* Finley_Mesh_merge(dim_t num
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(dim_t num Line 184  Finley_Mesh* Finley_Mesh_merge(dim_t num
184    
185  /*  /*
186  * $Log$  * $Log$
187    * Revision 1.3  2005/09/15 03:44:22  jgs
188    * 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  * Revision 1.2  2005/07/08 04:07:53  jgs
194  * Merge of development branch back to main trunk on 2005-07-08  * Merge of development branch back to main trunk on 2005-07-08
195  *  *

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

  ViewVC Help
Powered by ViewVC 1.1.26