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

revision 123 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 7  Line 21 
21    
22  /**************************************************************/  /**************************************************************/
23    
24  /*   Copyrights by ACcESS Australia 2003/04 */  /*  Author: gross@access.edu.au */
25  /*   Author: gross@access.edu.au */  /*  Version: $Id$ */
 /*   Version: $Id$ */  
26    
27  /**************************************************************/  /**************************************************************/
28    
 #include "Finley.h"  
29  #include "Mesh.h"  #include "Mesh.h"
30  #include "Util.h"  #include "Util.h"
31    
# Line 26  Finley_Mesh* Finley_Mesh_merge(dim_t num Line 38  Finley_Mesh* Finley_Mesh_merge(dim_t num
38    dim_t i;    dim_t i;
39    char newName[LenString_MAX];    char newName[LenString_MAX];
40    if (numMsh==0) {    if (numMsh==0) {
41       Finley_ErrorCode=VALUE_ERROR;       Finley_setError(VALUE_ERROR,"__FILE__: Empty mesh list");
      sprintf(Finley_ErrorMsg,"Empty mesh list");  
42    } else {    } else {
43      index_t order=msh[0]->order;      index_t order=msh[0]->order;
44      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 57  Finley_Mesh* Finley_Mesh_merge(dim_t num
57         order=MAX(order,msh[i]->order);         order=MAX(order,msh[i]->order);
58         numNodes+=msh[i]->Nodes->numNodes;         numNodes+=msh[i]->Nodes->numNodes;
59         if (numDim!=msh[i]->Nodes->numDim) {         if (numDim!=msh[i]->Nodes->numDim) {
60            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.");  
61         }         }
62    
63         if (msh[i]->Elements!=NULL) {         if (msh[i]->Elements!=NULL) {
# Line 56  Finley_Mesh* Finley_Mesh_merge(dim_t num Line 66  Finley_Mesh* Finley_Mesh_merge(dim_t num
66               elementTypeId=msh[i]->Elements->ReferenceElement->Type->TypeId;               elementTypeId=msh[i]->Elements->ReferenceElement->Type->TypeId;
67        } else {        } else {
68               if (elementTypeId!=msh[i]->Elements->ReferenceElement->Type->TypeId ) {               if (elementTypeId!=msh[i]->Elements->ReferenceElement->Type->TypeId ) {
69                 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.");  
70               }               }
71            }            }
72         }         }
# Line 68  Finley_Mesh* Finley_Mesh_merge(dim_t num Line 77  Finley_Mesh* Finley_Mesh_merge(dim_t num
77               faceElementTypeId=msh[i]->FaceElements->ReferenceElement->Type->TypeId;               faceElementTypeId=msh[i]->FaceElements->ReferenceElement->Type->TypeId;
78        } else {        } else {
79               if (faceElementTypeId!=msh[i]->FaceElements->ReferenceElement->Type->TypeId ) {               if (faceElementTypeId!=msh[i]->FaceElements->ReferenceElement->Type->TypeId ) {
80                 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.");  
81               }               }
82            }            }
83         }         }
# Line 80  Finley_Mesh* Finley_Mesh_merge(dim_t num Line 88  Finley_Mesh* Finley_Mesh_merge(dim_t num
88               contactTypeId=msh[i]->ContactElements->ReferenceElement->Type->TypeId;               contactTypeId=msh[i]->ContactElements->ReferenceElement->Type->TypeId;
89        } else {        } else {
90               if (contactTypeId!=msh[i]->ContactElements->ReferenceElement->Type->TypeId ) {               if (contactTypeId!=msh[i]->ContactElements->ReferenceElement->Type->TypeId ) {
91                 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.");  
92               }               }
93            }            }
94         }         }
# Line 92  Finley_Mesh* Finley_Mesh_merge(dim_t num Line 99  Finley_Mesh* Finley_Mesh_merge(dim_t num
99               pointTypeId=msh[i]->Points->ReferenceElement->Type->TypeId;               pointTypeId=msh[i]->Points->ReferenceElement->Type->TypeId;
100        } else {        } else {
101               if (pointTypeId!=msh[i]->Points->ReferenceElement->Type->TypeId ) {               if (pointTypeId!=msh[i]->Points->ReferenceElement->Type->TypeId ) {
102                 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.");  
103               }               }
104            }            }
105         }         }
# Line 104  Finley_Mesh* Finley_Mesh_merge(dim_t num Line 110  Finley_Mesh* Finley_Mesh_merge(dim_t num
110    
111      /* allocate */      /* allocate */
112    
113      if (Finley_ErrorCode == NO_ERROR) out=Finley_Mesh_alloc(newName,numDim,order);      if (Finley_noError()) out=Finley_Mesh_alloc(newName,numDim,order);
114    
115      out->Elements=Finley_ElementFile_alloc(elementTypeId,out->order);      out->Elements=Finley_ElementFile_alloc(elementTypeId,out->order);
116      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 119  Finley_Mesh* Finley_Mesh_merge(dim_t num
119    
120      /* allocate new tables */      /* allocate new tables */
121    
122      if (Finley_ErrorCode == NO_ERROR) {      if (Finley_noError()) {
123          Finley_NodeFile_allocTable(out->Nodes,numNodes);          Finley_NodeFile_allocTable(out->Nodes,numNodes);
124          Finley_ElementFile_allocTable(out->Elements,numElements);          Finley_ElementFile_allocTable(out->Elements,numElements);
125          Finley_ElementFile_allocTable(out->FaceElements,numFaceElements);          Finley_ElementFile_allocTable(out->FaceElements,numFaceElements);
# Line 123  Finley_Mesh* Finley_Mesh_merge(dim_t num Line 129  Finley_Mesh* Finley_Mesh_merge(dim_t num
129    
130      /* copy tables :*/      /* copy tables :*/
131    
132      if (Finley_ErrorCode == NO_ERROR) {      if (Finley_noError()) {
133    
134          dim_t numNodes=0;          dim_t numNodes=0;
135          dim_t numElements=0;          dim_t numElements=0;
# Line 166  Finley_Mesh* Finley_Mesh_merge(dim_t num Line 172  Finley_Mesh* Finley_Mesh_merge(dim_t num
172      }      }
173      /* all done  */      /* all done  */
174    
175      if (Finley_ErrorCode != NO_ERROR) {      if (! Finley_noError()) {
176         Finley_Mesh_dealloc(out);         Finley_Mesh_dealloc(out);
177      } else {      } else {
178         Finley_Mesh_prepare(out);         Finley_Mesh_prepare(out);
# Line 180  Finley_Mesh* Finley_Mesh_merge(dim_t num Line 186  Finley_Mesh* Finley_Mesh_merge(dim_t num
186    
187  /*  /*
188  * $Log$  * $Log$
189    * Revision 1.3  2005/09/15 03:44:22  jgs
190    * Merge of development branch dev-02 back to main trunk on 2005-09-15
191    *
192    * Revision 1.2.2.1  2005/09/07 06:26:19  gross
193    * the solver from finley are put into the standalone package paso now
194    *
195  * Revision 1.2  2005/07/08 04:07:53  jgs  * Revision 1.2  2005/07/08 04:07:53  jgs
196  * Merge of development branch back to main trunk on 2005-07-08  * Merge of development branch back to main trunk on 2005-07-08
197  *  *

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

  ViewVC Help
Powered by ViewVC 1.1.26