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

Diff of /trunk-mpi-branch/finley/src/Mesh_merge.c

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

revision 1222 by ksteube, Tue May 15 03:23:17 2007 UTC revision 1223 by gross, Fri Aug 3 02:40:39 2007 UTC
# Line 32  Line 32 
32  static double  Finley_Mesh_lockingGridSize=0;  static double  Finley_Mesh_lockingGridSize=0;
33    
34  Finley_Mesh* Finley_Mesh_merge(dim_t numMsh, Finley_Mesh** msh) {  Finley_Mesh* Finley_Mesh_merge(dim_t numMsh, Finley_Mesh** msh) {
35      Paso_MPIInfo *mpi_info=NULL;
36    Finley_Mesh* out=NULL;    Finley_Mesh* out=NULL;
37    dim_t numNodes=0;    dim_t numNodes=0;
38    dim_t numElements=0;    dim_t numElements=0;
# Line 51  Finley_Mesh* Finley_Mesh_merge(dim_t num Line 52  Finley_Mesh* Finley_Mesh_merge(dim_t num
52    index_t maxElementID2=0;    index_t maxElementID2=0;
53    char newName[LenString_MAX];    char newName[LenString_MAX];
54    if (numMsh==0) {    if (numMsh==0) {
55       Finley_setError(VALUE_ERROR,"__FILE__: Empty mesh list");       Finley_setError(VALUE_ERROR,"Finley_Mesh_merge: Empty mesh list");
56    } else {    } else {
57      order=msh[0]->order;      order=msh[0]->order;
58      reduced_order=msh[0]->reduced_order;      reduced_order=msh[0]->reduced_order;
59      numDim=msh[0]->Nodes->numDim;      numDim=msh[0]->Nodes->numDim;
60        mpi_info=msh[0]->MPIInfo;
61        if (mpi_info->size > 1) {
62             Finley_setError(TYPE_ERROR,"Finley_Mesh_merge: more than processor is not supported yet.");
63             return NULL;
64        }
65      strcpy(newName,"");      strcpy(newName,"");
66      for (i=0;i<numMsh;i++) {      for (i=0;i<numMsh;i++) {
67         /* check if all mesh have the same type and dimensions */         /* check if all mesh have the same type and dimensions */
68         order=MAX(order,msh[i]->order);         order=MAX(order,msh[i]->order);
69         reduced_order=MIN(reduced_order,msh[i]->reduced_order);         reduced_order=MIN(reduced_order,msh[i]->reduced_order);
70         numNodes+=msh[i]->Nodes->numNodes;         numNodes+=msh[i]->Nodes->numNodes;
71           if (mpi_info->comm!=msh[i]->MPIInfo->comm) {
72              Finley_setError(TYPE_ERROR,"Finley_Mesh_merge: MPI communicators of meshes don't match.");
73           }
74         if (numDim!=msh[i]->Nodes->numDim) {         if (numDim!=msh[i]->Nodes->numDim) {
75            Finley_setError(TYPE_ERROR,"__FILE__: Spatial dimensions of meshes don't match.");            Finley_setError(TYPE_ERROR,"Finley_Mesh_merge: Spatial dimensions of meshes don't match.");
76         }         }
77    
78         if (msh[i]->Elements!=NULL) {         if (msh[i]->Elements!=NULL) {
# Line 72  Finley_Mesh* Finley_Mesh_merge(dim_t num Line 81  Finley_Mesh* Finley_Mesh_merge(dim_t num
81               elementTypeId=msh[i]->Elements->ReferenceElement->Type->TypeId;               elementTypeId=msh[i]->Elements->ReferenceElement->Type->TypeId;
82        } else {        } else {
83               if (elementTypeId!=msh[i]->Elements->ReferenceElement->Type->TypeId ) {               if (elementTypeId!=msh[i]->Elements->ReferenceElement->Type->TypeId ) {
84                 Finley_setError(TYPE_ERROR,"__FILE__: element types of meshes don't match.");                 Finley_setError(TYPE_ERROR,"Finley_Mesh_merge: element types of meshes don't match.");
85               }               }
86            }            }
87         }         }
# Line 83  Finley_Mesh* Finley_Mesh_merge(dim_t num Line 92  Finley_Mesh* Finley_Mesh_merge(dim_t num
92               faceElementTypeId=msh[i]->FaceElements->ReferenceElement->Type->TypeId;               faceElementTypeId=msh[i]->FaceElements->ReferenceElement->Type->TypeId;
93        } else {        } else {
94               if (faceElementTypeId!=msh[i]->FaceElements->ReferenceElement->Type->TypeId ) {               if (faceElementTypeId!=msh[i]->FaceElements->ReferenceElement->Type->TypeId ) {
95                 Finley_setError(TYPE_ERROR,"__FILE__: face element types of meshes don't match.");                 Finley_setError(TYPE_ERROR,"Finley_Mesh_merge: face element types of meshes don't match.");
96               }               }
97            }            }
98         }         }
# Line 94  Finley_Mesh* Finley_Mesh_merge(dim_t num Line 103  Finley_Mesh* Finley_Mesh_merge(dim_t num
103               contactTypeId=msh[i]->ContactElements->ReferenceElement->Type->TypeId;               contactTypeId=msh[i]->ContactElements->ReferenceElement->Type->TypeId;
104        } else {        } else {
105               if (contactTypeId!=msh[i]->ContactElements->ReferenceElement->Type->TypeId ) {               if (contactTypeId!=msh[i]->ContactElements->ReferenceElement->Type->TypeId ) {
106                 Finley_setError(TYPE_ERROR,"__FILE__: contact element types of meshes don't match.");                 Finley_setError(TYPE_ERROR,"Finley_Mesh_merge: contact element types of meshes don't match.");
107               }               }
108            }            }
109         }         }
# Line 105  Finley_Mesh* Finley_Mesh_merge(dim_t num Line 114  Finley_Mesh* Finley_Mesh_merge(dim_t num
114               pointTypeId=msh[i]->Points->ReferenceElement->Type->TypeId;               pointTypeId=msh[i]->Points->ReferenceElement->Type->TypeId;
115        } else {        } else {
116               if (pointTypeId!=msh[i]->Points->ReferenceElement->Type->TypeId ) {               if (pointTypeId!=msh[i]->Points->ReferenceElement->Type->TypeId ) {
117                 Finley_setError(TYPE_ERROR,"__FILE__: point element types of meshes don't match.");                 Finley_setError(TYPE_ERROR,"Finley_Mesh_merge: point element types of meshes don't match.");
118               }               }
119            }            }
120         }         }
# Line 114  Finley_Mesh* Finley_Mesh_merge(dim_t num Line 123  Finley_Mesh* Finley_Mesh_merge(dim_t num
123         strncat(newName,msh[i]->Name,LenString_MAX-strlen(newName)-1);         strncat(newName,msh[i]->Name,LenString_MAX-strlen(newName)-1);
124      }      }
125    
126        if (mpi_info->size >1 ) {
127            Finley_setError(TYPE_ERROR,"Finley_Mesh_merge: only single processor runs are supported.");
128        }
129      /* allocate */      /* allocate */
130    
 #ifndef PASO_MPI  
131      if (Finley_noError())      if (Finley_noError())
132        out=Finley_Mesh_alloc(newName,numDim,order,reduced_order);        out=Finley_Mesh_alloc(newName,numDim,order,reduced_order,mpi_info);
133    
134      out->Elements=Finley_ElementFile_alloc(elementTypeId,out->order, out->reduced_order);      out->Elements=Finley_ElementFile_alloc(elementTypeId,out->order, out->reduced_order,mpi_info);
135      out->FaceElements=Finley_ElementFile_alloc(faceElementTypeId,out->order, out->reduced_order);      out->FaceElements=Finley_ElementFile_alloc(faceElementTypeId,out->order, out->reduced_order,mpi_info);
136      out->Points=Finley_ElementFile_alloc(pointTypeId,out->order, out->reduced_order);      out->Points=Finley_ElementFile_alloc(pointTypeId,out->order, out->reduced_order,mpi_info);
137      out->ContactElements=Finley_ElementFile_alloc(contactTypeId,out->order, out->reduced_order);      out->ContactElements=Finley_ElementFile_alloc(contactTypeId,out->order, out->reduced_order,mpi_info);
138    
139      /* allocate new tables */      /* allocate new tables */
140    
# Line 135  Finley_Mesh* Finley_Mesh_merge(dim_t num Line 146  Finley_Mesh* Finley_Mesh_merge(dim_t num
146          Finley_ElementFile_allocTable(out->ContactElements,numContactElements);          Finley_ElementFile_allocTable(out->ContactElements,numContactElements);
147          Finley_ElementFile_allocTable(out->Points,numPoints);          Finley_ElementFile_allocTable(out->Points,numPoints);
148      }      }
 #else  
 /* TODO */  
 #endif  
149    
150      /* copy tables :*/      /* copy tables :*/
151    
# Line 164  Finley_Mesh* Finley_Mesh_merge(dim_t num Line 172  Finley_Mesh* Finley_Mesh_merge(dim_t num
172    
173             if (msh[i]->Nodes->numNodes>0)             if (msh[i]->Nodes->numNodes>0)
174                maxNodeID+=Finley_Util_getMaxInt(1,msh[i]->Nodes->numNodes,msh[i]->Nodes->Id)+1;                maxNodeID+=Finley_Util_getMaxInt(1,msh[i]->Nodes->numNodes,msh[i]->Nodes->Id)+1;
175                maxDOF+=Finley_Util_getMaxInt(1,msh[i]->Nodes->numNodes,msh[i]->Nodes->degreeOfFreedom)+1;                maxDOF+=Finley_Util_getMaxInt(1,msh[i]->Nodes->numNodes,msh[i]->Nodes->globalDegreesOfFreedom)+1;
176             maxElementID2=0;             maxElementID2=0;
177             if (msh[i]->Elements->numElements>0)             if (msh[i]->Elements->numElements>0)
178                maxElementID2=MAX(maxElementID2,Finley_Util_getMaxInt(1,msh[i]->Elements->numElements,msh[i]->Elements->Id));                maxElementID2=MAX(maxElementID2,Finley_Util_getMaxInt(1,msh[i]->Elements->numElements,msh[i]->Elements->Id));
# Line 180  Finley_Mesh* Finley_Mesh_merge(dim_t num Line 188  Finley_Mesh* Finley_Mesh_merge(dim_t num
188      /* all done  */      /* all done  */
189    
190      if (! Finley_noError()) {      if (! Finley_noError()) {
191         Finley_Mesh_dealloc(out);         Finley_Mesh_free(out);
192      } else {      } else {
193         Finley_Mesh_prepare(out);         Finley_Mesh_prepare(out);
194         #ifdef Finley_TRACE         #ifdef Finley_TRACE
# Line 190  Finley_Mesh* Finley_Mesh_merge(dim_t num Line 198  Finley_Mesh* Finley_Mesh_merge(dim_t num
198    }    }
199    return out;    return out;
200  }  }
   
 /*  
 * $Log$  
 * Revision 1.3  2005/09/15 03:44:22  jgs  
 * Merge of development branch dev-02 back to main trunk on 2005-09-15  
 *  
 * Revision 1.2.2.1  2005/09/07 06:26:19  gross  
 * the solver from finley are put into the standalone package paso now  
 *  
 * Revision 1.2  2005/07/08 04:07:53  jgs  
 * Merge of development branch back to main trunk on 2005-07-08  
 *  
 * Revision 1.1.1.1.2.1  2005/06/29 02:34:52  gross  
 * some changes towards 64 integers in finley  
 *  
 * Revision 1.1.1.1  2004/10/26 06:53:57  jgs  
 * initial import of project esys2  
 *  
 * Revision 1.2  2004/07/30 04:37:06  gross  
 * escript and finley are linking now and RecMeshTest.py has been passed  
 *  
 * Revision 1.1.1.1  2004/06/24 04:00:40  johng  
 * Initial version of eys using boost-python.  
 *  
 *  
 */  
   

Legend:
Removed from v.1222  
changed lines
  Added in v.1223

  ViewVC Help
Powered by ViewVC 1.1.26