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

Contents of /trunk/finley/src/Mesh_line3.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 964 - (show annotations)
Tue Feb 13 05:10:26 2007 UTC (12 years, 7 months ago) by gross
File MIME type: text/plain
File size: 20467 byte(s)
The set/getRefVal functions of Data objects have been removed (mainly to avoid later problems with MPI).
Moreover, a faster access to the reference id of samples has been introduced. I don't think that anybody will
profit form this at this stage but it will allow a faster dump of data objects.


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: generates rectangular meshes */
16
17 /* Generates numElements[0] mesh with second order elements (Line3) in the interval */
18 /* [0,Length[0]]. order is the desired accuracy of the integration scheme. */
19
20 /**************************************************************/
21
22 /* Author: gross@access.edu.au */
23 /* Version: $Id$ */
24
25 /**************************************************************/
26
27 #include "RectangularMesh.h"
28
29 #ifdef PASO_MPI
30 /* get the number of nodes/elements for domain with rank=rank, of size processors
31 where n is the total number of nodes/elements in the global domain */
32 static index_t domain_MODdim( index_t rank, index_t size, index_t n )
33 {
34 rank = size-rank-1;
35
36 if( rank < n%size )
37 return (index_t)floor(n/size)+1;
38 return (index_t)floor(n/size);
39 }
40
41
42 /* Determines the number of nodes/elements etc along an axis which is numElementsGlobal long for domain rank */
43 /* A bit messy, but it only has to be done once... */
44 static void domain_calculateDimension( index_t rank, dim_t size, dim_t numElementsGlobal, bool_t periodic, dim_t *numNodesLocal, dim_t *numDOFLocal, dim_t *numElementsLocal, dim_t *numElementsInternal, dim_t *firstNode, dim_t *nodesExternal, dim_t *DOFExternal, dim_t *numNodesExternal, bool_t *periodicLocal, dim_t *DOFBoundary )
45 {
46 index_t i0;
47 dim_t numNodesGlobal = numElementsGlobal+1;
48
49 (*numNodesLocal) = 2*domain_MODdim( rank, size, numNodesGlobal ) - 1;
50 if( rank<size-1 ) // add on node for right hand boundary
51 (*numNodesLocal) += 1;
52
53 numElementsLocal[0] = domain_MODdim( rank, size, numNodesGlobal )+1;
54 periodicLocal[0] = periodicLocal[1] = FALSE;
55 nodesExternal[0] = nodesExternal[1] = 1;
56 if( periodic )
57 {
58 if( size==1 )
59 {
60 numElementsLocal[0] = numElementsGlobal;
61 nodesExternal[0] = nodesExternal[1] = 0;
62 periodicLocal[0] = periodicLocal[1] = TRUE;
63 }
64 else
65 {
66 if( rank==0 )
67 {
68 periodicLocal[0] = TRUE;
69 numNodesLocal[0]++;
70 }
71 if( rank==(size-1) )
72 {
73 periodicLocal[1] = TRUE;
74 numNodesLocal[0]--;
75 numElementsLocal[0]--;
76 }
77 }
78 }
79 else if( !periodic )
80 {
81 if( rank==0 ){
82 nodesExternal[0]--;
83 numElementsLocal[0]--;
84 }
85 if( rank==(size-1) )
86 {
87 nodesExternal[1]--;
88 numElementsLocal[0]--;
89 }
90 }
91 nodesExternal[0]*=2;
92 numNodesExternal[0] = nodesExternal[0]+nodesExternal[1];
93
94 numElementsInternal[0] = numElementsLocal[0];
95 if( (rank==0) && (rank==size-1) );
96
97 else if( !periodic && ( (rank==0) ^ (rank==size-1) ) )
98 numElementsInternal[0] -= 1;
99 else
100 numElementsInternal[0] -= 2;
101
102 firstNode[0] = 0;
103 for( i0=0; i0<rank; i0++ )
104 firstNode[0] += domain_MODdim( i0, size, numNodesGlobal );
105 firstNode[0] *= 2;
106
107 numDOFLocal[0] = numNodesLocal[0];
108 if( periodicLocal[0] )
109 numDOFLocal[0]--;
110
111 DOFExternal[0] = nodesExternal[0];
112 DOFExternal[1] = nodesExternal[1];
113
114 if( size>1 )
115 {
116 DOFBoundary[0] = periodicLocal[0]*1 + (rank>0)*1;
117 DOFBoundary[1] = periodicLocal[1]*2 + (rank<(size-1))*2;
118 }
119 else
120 {
121 DOFBoundary[0] = DOFBoundary[1] = 0;
122 }
123 }
124 #endif
125
126
127 #ifdef PASO_MPI
128 Finley_Mesh* Finley_RectangularMesh_Line3_singleCPU(dim_t* numElements,double* Length,bool_t* periodic,index_t order,bool_t useElementsOnFace,Paso_MPIInfo *mpi_info)
129 #else
130 Finley_Mesh* Finley_RectangularMesh_Line3(dim_t* numElements,double* Length,bool_t* periodic,index_t order,bool_t useElementsOnFace)
131 #endif
132 {
133 dim_t N0,NE0,i0,NDOF0,NFaceElements,NUMNODES;
134 index_t k,node0;
135 Finley_Mesh* out;
136 char name[50];
137 double time0=Finley_timer();
138 NE0=MAX(1,numElements[0]);
139 N0=2*NE0+1;
140 if (!periodic[0]) {
141 NDOF0=N0;
142 NFaceElements=2;
143 } else {
144 NDOF0=N0-1;
145 NFaceElements=0;
146 }
147
148 /* allocate mesh: */
149
150 sprintf(name,"Rectangular mesh with %d nodes",N0);
151 #ifdef PASO_MPI
152 out=Finley_Mesh_alloc(name,1,order,mpi_info);
153 if (! Finley_noError()) return NULL;
154
155 out->Elements=Finley_ElementFile_alloc(Line3,out->order,mpi_info);
156 if (useElementsOnFace) {
157 out->FaceElements=Finley_ElementFile_alloc(Line3Face,out->order,mpi_info);
158 out->ContactElements=Finley_ElementFile_alloc(Line3Face_Contact,out->order,mpi_info);
159 } else {
160 out->FaceElements=Finley_ElementFile_alloc(Point1,out->order,mpi_info);
161 out->ContactElements=Finley_ElementFile_alloc(Point1_Contact,out->order,mpi_info);
162 }
163 out->Points=Finley_ElementFile_alloc(Point1,out->order,mpi_info);
164 if (! Finley_noError()) {
165 Finley_Mesh_dealloc(out);
166 return NULL;
167 }
168
169 /* allocate tables: */
170
171 Finley_NodeFile_allocTable(out->Nodes,N0);
172 Finley_NodeDistribution_allocTable( out->Nodes->degreeOfFreedomDistribution, N0, 0, 0);
173 Finley_ElementFile_allocTable(out->Elements,NE0);
174 Finley_ElementFile_allocTable(out->FaceElements,NFaceElements);
175 Finley_ElementDistribution_allocTable( out->Elements->elementDistribution, NE0, 0 );
176 Finley_ElementDistribution_allocTable( out->FaceElements->elementDistribution, NFaceElements, 0 );
177 #else
178 out=Finley_Mesh_alloc(name,1,order);
179 if (! Finley_noError()) return NULL;
180
181 out->Elements=Finley_ElementFile_alloc(Line3,out->order);
182 if (useElementsOnFace) {
183 out->FaceElements=Finley_ElementFile_alloc(Line3Face,out->order);
184 out->ContactElements=Finley_ElementFile_alloc(Line3Face_Contact,out->order);
185 } else {
186 out->FaceElements=Finley_ElementFile_alloc(Point1,out->order);
187 out->ContactElements=Finley_ElementFile_alloc(Point1_Contact,out->order);
188 }
189 out->Points=Finley_ElementFile_alloc(Point1,out->order);
190 if (! Finley_noError()) {
191 Finley_Mesh_dealloc(out);
192 return NULL;
193 }
194
195 /* allocate tables: */
196
197 Finley_NodeFile_allocTable(out->Nodes,N0);
198
199 Finley_ElementFile_allocTable(out->Elements,NE0);
200 Finley_ElementFile_allocTable(out->FaceElements,NFaceElements);
201 #endif
202 if (! Finley_noError()) {
203 Finley_Mesh_dealloc(out);
204 return NULL;
205 }
206
207 /* set nodes: */
208
209 #pragma omp parallel for private(i0,k)
210 for (i0=0;i0<N0;i0++) {
211 k=i0;
212 out->Nodes->Coordinates[INDEX2(0,k,1)]=DBLE(i0)/DBLE(N0-1)*Length[0];
213 out->Nodes->Id[k]=k;
214 out->Nodes->Tag[k]=0;
215 out->Nodes->degreeOfFreedom[k]=(i0%NDOF0);
216 #ifdef PASO_MPI
217 out->Nodes->Dom[k] = NODE_INTERNAL;
218 #endif
219 }
220 if (!periodic[0]) {
221 out->Nodes->Tag[0]=1;
222 out->Nodes->Tag[N0-1]=2;
223 }
224
225 /* set the elements: */
226
227 #pragma omp parallel for private(i0,k,node0)
228 for (i0=0;i0<NE0;i0++) {
229 k=i0;
230 node0=2*i0;
231
232 out->Elements->Id[k]=k;
233 out->Elements->Tag[k]=0;
234 out->Elements->Color[k]=COLOR_MOD(i0);
235 #ifdef PASO_MPI
236 out->Elements->Dom[k] = ELEMENT_INTERNAL;
237 #endif
238
239 out->Elements->Nodes[INDEX2(0,k,3)]=node0;
240 out->Elements->Nodes[INDEX2(1,k,3)]=node0+2;
241 out->Elements->Nodes[INDEX2(2,k,3)]=node0+1;
242 }
243 out->Elements->minColor=0;
244 out->Elements->maxColor=COLOR_MOD(0);
245
246 /* face elements: */
247 if (useElementsOnFace) {
248 NUMNODES=3;
249 } else {
250 NUMNODES=1;
251 }
252
253 if (!periodic[0]) {
254 out->FaceElements->Id[0]=NE0;
255 out->FaceElements->Tag[0]=1;
256 out->FaceElements->Color[0]=0;
257 #ifdef PASO_MPI
258 out->FaceElements->Dom[0] = ELEMENT_INTERNAL;
259 #endif
260 if (useElementsOnFace) {
261 out->FaceElements->Nodes[INDEX2(0,0,NUMNODES)]=0;
262 out->FaceElements->Nodes[INDEX2(1,0,NUMNODES)]=2;
263 out->FaceElements->Nodes[INDEX2(2,0,NUMNODES)]=1;
264 } else {
265 out->FaceElements->Nodes[INDEX2(0,0,NUMNODES)]=0;
266 }
267
268 out->FaceElements->Id[1]=NE0+1;
269 out->FaceElements->Tag[1]=2;
270 out->FaceElements->Color[1]=1;
271 #ifdef PASO_MPI
272 out->FaceElements->Dom[1] = ELEMENT_INTERNAL;
273 #endif
274 if (useElementsOnFace) {
275 out->FaceElements->Nodes[INDEX2(0,1,NUMNODES)]=N0-1;
276 out->FaceElements->Nodes[INDEX2(1,1,NUMNODES)]=N0-3;
277 out->FaceElements->Nodes[INDEX2(2,1,NUMNODES)]=N0-2;
278 } else {
279 out->FaceElements->Nodes[INDEX2(0,1,NUMNODES)]=N0-1;
280 }
281 }
282 out->FaceElements->minColor=0;
283 out->FaceElements->maxColor=1;
284
285 #ifdef PASO_MPI
286 Finley_ElementFile_setDomainFlags( out->Elements );
287 Finley_ElementFile_setDomainFlags( out->FaceElements );
288 Finley_ElementFile_setDomainFlags( out->ContactElements );
289 Finley_ElementFile_setDomainFlags( out->Points );
290
291 /* reorder the degrees of freedom */
292 Finley_Mesh_resolveDegreeOfFreedomOrder( out, TRUE );
293 #endif
294
295 /* condense the nodes: */
296 Finley_Mesh_resolveNodeIds(out);
297
298 /* prepare mesh for further calculations:*/
299 Finley_Mesh_prepare(out) ;
300
301 #ifdef Finley_TRACE
302 printf("timing: mesh generation: %.4e sec\n",Finley_timer()-time0);
303 #endif
304
305 if (Finley_noError()) {
306 if ( ! Finley_Mesh_isPrepared(out) ) {
307 Finley_setError(SYSTEM_ERROR,"Mesh is not prepared for calculation. Contact the programmers.");
308 }
309 } else {
310 Finley_Mesh_dealloc(out);
311 }
312 return out;
313 }
314 /* MPI version */
315 #ifdef PASO_MPI
316 Finley_Mesh* Finley_RectangularMesh_Line3(dim_t* numElements,double* Length,bool_t* periodic,index_t order,bool_t useElementsOnFace)
317 {
318 dim_t N0, NE0, NE0_local, i0, NDOF0, NFaceElements, numNodesLocal, numDOFLocal, numElementsLocal, numElementsInternal, nodesExternal[2], DOFExternal[2], numNodesExternal, DOFBoundary[2], N0t, NDOF0t;
319 index_t *numForward=NULL, *numBackward=NULL;
320 index_t NUMNODES, node0,k, i,firstNode=0, DOFcount=0, forwardDOF[4], backwardDOF[4], firstNodeConstruct;
321 index_t targetDomain=-1;
322 bool_t periodicLocal[2], domLeft=FALSE, domRight=FALSE, domInternal=FALSE, boundaryLeft, boundaryRight;
323 Finley_Mesh* out=NULL;
324 char name[50];
325 double time0=Finley_timer();
326 Paso_MPIInfo *mpi_info = NULL;
327
328 /* dimensions the global domain */
329 NE0=MAX(1,numElements[0]);
330 N0=2*NE0+1;
331 NDOF0=N0;
332 if( periodic[0] )
333 NDOF0--;
334
335 /* get MPI information */
336 mpi_info = Paso_MPIInfo_alloc( MPI_COMM_WORLD );
337 if (! Finley_noError()) {
338 Finley_Mesh_dealloc(out);
339 return NULL;
340 }
341
342 /* use the serial code to generate the mesh in the 1-CPU case */
343 if( mpi_info->size==1 ){
344 out = Finley_RectangularMesh_Line3_singleCPU(numElements,Length,periodic,order,useElementsOnFace,mpi_info);
345 return out;
346 }
347
348 if( mpi_info->rank==0 )
349 domLeft = TRUE;
350 if( mpi_info->rank==mpi_info->size-1 )
351 domRight = TRUE;
352 if( mpi_info->rank>0 && mpi_info->rank<mpi_info->size-1 )
353 domInternal = TRUE;
354
355 /* dimensions of the local subdomain */
356 domain_calculateDimension( mpi_info->rank, mpi_info->size, NE0, periodic[0], &numNodesLocal, &numDOFLocal, &numElementsLocal, &numElementsInternal, &firstNode, nodesExternal, DOFExternal, &numNodesExternal, periodicLocal, DOFBoundary );
357
358 /* form face element if the local domain contains a periodic boundary */
359 NFaceElements = 0;
360 if( !periodic[0] )
361 {
362 if(domLeft)
363 NFaceElements++;
364 if(domRight)
365 NFaceElements++;
366 }
367
368 boundaryLeft = !domLeft || periodicLocal[0];
369 boundaryRight = !domRight || periodicLocal[1];
370 N0t = numNodesLocal + boundaryRight + 2*boundaryLeft;
371 NDOF0t = numDOFLocal + boundaryRight + 2*boundaryLeft;
372 firstNodeConstruct = firstNode - 2*boundaryLeft;
373 firstNodeConstruct = firstNodeConstruct<0 ? N0-3 : firstNodeConstruct;
374
375 /* allocate mesh: */
376 sprintf(name,"Rectangular mesh with %d nodes",N0);
377 out=Finley_Mesh_alloc(name,1,order,mpi_info);
378 if (! Finley_noError()) return NULL;
379
380 out->Elements=Finley_ElementFile_alloc(Line3,out->order,mpi_info);
381 if (useElementsOnFace) {
382 out->FaceElements=Finley_ElementFile_alloc(Line3Face,out->order,mpi_info);
383 out->ContactElements=Finley_ElementFile_alloc(Line3Face_Contact,out->order,mpi_info);
384 } else {
385 out->FaceElements=Finley_ElementFile_alloc(Point1,out->order,mpi_info);
386 out->ContactElements=Finley_ElementFile_alloc(Point1_Contact,out->order,mpi_info);
387 }
388 out->Points=Finley_ElementFile_alloc(Point1,out->order,mpi_info);
389 if (! Finley_noError()) {
390 Finley_Mesh_dealloc(out);
391 return NULL;
392 }
393
394 /* allocate tables: */
395 Finley_NodeFile_allocTable(out->Nodes,numNodesLocal+numNodesExternal);
396 Finley_NodeDistribution_allocTable( out->Nodes->degreeOfFreedomDistribution, numDOFLocal, 3, 0 );
397 Finley_ElementFile_allocTable(out->Elements,numElementsLocal);
398 Finley_ElementFile_allocTable(out->FaceElements,NFaceElements);
399 Finley_ElementDistribution_allocTable( out->Elements->elementDistribution, numElementsLocal, domRight);
400 Finley_ElementDistribution_allocTable( out->FaceElements->elementDistribution, NFaceElements, 0 );
401 if (! Finley_noError()) {
402 Finley_Mesh_dealloc(out);
403 return NULL;
404 }
405
406 /* set nodes: */
407 #pragma omp parallel for private(i0,k)
408 for (i0=0;i0<N0t;i0++) {
409 k=i0;
410 out->Nodes->Coordinates[INDEX2(0,k,1)]=DBLE((i0+firstNodeConstruct) % N0)/DBLE(N0-1)*Length[0];
411 out->Nodes->Id[k]=k;
412 out->Nodes->Tag[k]=0;
413 out->Nodes->degreeOfFreedom[k]=k;
414 out->Nodes->Dom[k]=NODE_INTERNAL;
415 }
416
417 /* setup boundary DOF data */
418 if( boundaryLeft ){
419 out->Nodes->Dom[0]= out->Nodes->Dom[1] = NODE_EXTERNAL;
420 out->Nodes->Dom[2] = NODE_BOUNDARY;
421 }
422 else
423 out->Nodes->Tag[0] += 1;
424 if( boundaryRight ){
425 out->Nodes->Dom[N0t-1] = NODE_EXTERNAL;
426 out->Nodes->Dom[N0t-2] = out->Nodes->Dom[N0t-3] = NODE_BOUNDARY;
427 }
428 else
429 out->Nodes->Tag[N0t-1] += 2;
430 if( periodicLocal[0] ){
431 out->Nodes->degreeOfFreedom[3] = out->Nodes->degreeOfFreedom[2];
432 out->Nodes->Dom[3] = NODE_BOUNDARY;
433 }
434
435 if( !(mpi_info->size==2 && periodicLocal[0])){
436 if( boundaryLeft ) {
437 targetDomain = mpi_info->rank-1 < 0 ? mpi_info->size-1 : mpi_info->rank-1;
438 forwardDOF[0] = out->Nodes->degreeOfFreedom[2];
439 backwardDOF[0] = out->Nodes->degreeOfFreedom[0];
440 backwardDOF[1] = out->Nodes->degreeOfFreedom[1];
441 Finley_NodeDistribution_addForward( out->Nodes->degreeOfFreedomDistribution, targetDomain, 1, forwardDOF );
442 Finley_NodeDistribution_addBackward( out->Nodes->degreeOfFreedomDistribution, targetDomain, 2, backwardDOF );
443 }
444 if( boundaryRight ) {
445 targetDomain = mpi_info->rank+1 > mpi_info->size-1 ? 0 : mpi_info->rank+1;
446 forwardDOF[0] = out->Nodes->degreeOfFreedom[N0t-3];
447 forwardDOF[1] = out->Nodes->degreeOfFreedom[N0t-2];
448 backwardDOF[0] = out->Nodes->degreeOfFreedom[N0t-1];
449 Finley_NodeDistribution_addForward( out->Nodes->degreeOfFreedomDistribution, targetDomain, 2, forwardDOF );
450 Finley_NodeDistribution_addBackward( out->Nodes->degreeOfFreedomDistribution, targetDomain, 1, backwardDOF );
451 }
452 } else{
453 /* periodic boundary conditions with 2 domains, need to change the order in which domain 0 passes boundary data */
454 targetDomain = 1;
455
456 forwardDOF[0] = out->Nodes->degreeOfFreedom[N0t-3];
457 forwardDOF[1] = out->Nodes->degreeOfFreedom[N0t-2];
458 backwardDOF[0] = out->Nodes->degreeOfFreedom[N0t-1];
459 Finley_NodeDistribution_addForward( out->Nodes->degreeOfFreedomDistribution, targetDomain, 2, forwardDOF );
460 Finley_NodeDistribution_addBackward( out->Nodes->degreeOfFreedomDistribution, targetDomain, 1, backwardDOF );
461
462 forwardDOF[0] = out->Nodes->degreeOfFreedom[2];
463 backwardDOF[0] = out->Nodes->degreeOfFreedom[0];
464 backwardDOF[1] = out->Nodes->degreeOfFreedom[1];
465 Finley_NodeDistribution_addForward( out->Nodes->degreeOfFreedomDistribution, targetDomain, 1, forwardDOF );
466 Finley_NodeDistribution_addBackward( out->Nodes->degreeOfFreedomDistribution, targetDomain, 2, backwardDOF );
467 }
468
469 /* set the elements: */
470 /* form internal elements */
471 #pragma omp parallel for private(i0,k)
472 for (i0=0;i0<numElementsLocal;i0++)
473 {
474 k=i0;
475 node0 = (periodicLocal[0] && !i0) ? 0 : 2*i0 + periodicLocal[0];
476 out->Elements->Id[k]=(i0+firstNodeConstruct/2)%NE0;
477 out->Elements->Tag[k]=0;
478 out->Elements->Color[k]=COLOR_MOD(i0);
479 out->Elements->Dom[k]=ELEMENT_INTERNAL;
480
481 out->Elements->Nodes[INDEX2(0,k,3)]=node0;
482 out->Elements->Nodes[INDEX2(1,k,3)]=node0+2;
483 out->Elements->Nodes[INDEX2(2,k,3)]=node0+1;
484 }
485
486 if( boundaryLeft )
487 out->Elements->Dom[0] = ELEMENT_BOUNDARY;
488 if( boundaryRight )
489 out->Elements->Dom[numElementsLocal-1] = ELEMENT_BOUNDARY;
490
491 out->Elements->minColor=0;
492 out->Elements->maxColor=COLOR_MOD(0);
493
494 Finley_ElementFile_setDomainFlags( out->Elements );
495
496 /* face elements: */
497 if (useElementsOnFace) {
498 NUMNODES=3;
499 } else {
500 NUMNODES=1;
501 }
502 if ( domLeft && !periodicLocal[0] )
503 {
504 out->FaceElements->Id[0]=NE0;
505 out->FaceElements->Tag[0]=1;
506 out->FaceElements->Color[0]=0;
507 out->FaceElements->Dom[0]=ELEMENT_INTERNAL;
508 if (useElementsOnFace) {
509 out->FaceElements->Nodes[INDEX2(0,0,NUMNODES)]=0;
510 out->FaceElements->Nodes[INDEX2(1,0,NUMNODES)]=2;
511 out->FaceElements->Nodes[INDEX2(2,0,NUMNODES)]=1;
512 } else {
513 out->FaceElements->Nodes[INDEX2(0,0,NUMNODES)]=0;
514 }
515 }
516 if( domRight && !periodicLocal[1])
517 {
518 out->FaceElements->Id[domLeft]=NE0+1;
519 out->FaceElements->Tag[domLeft]=2;
520 out->FaceElements->Color[domLeft]=1;
521 out->FaceElements->Dom[domLeft]=ELEMENT_INTERNAL;
522 if (useElementsOnFace) {
523 out->FaceElements->Nodes[INDEX2(0,domLeft,NUMNODES)]=N0t-1;
524 out->FaceElements->Nodes[INDEX2(1,domLeft,NUMNODES)]=N0t-3;
525 out->FaceElements->Nodes[INDEX2(2,domLeft,NUMNODES)]=N0t-2;
526 } else {
527 out->FaceElements->Nodes[INDEX2(0,domLeft,NUMNODES)]=N0t-1;
528 }
529 }
530 out->FaceElements->numElements=NFaceElements;
531 out->FaceElements->maxColor=0;
532 out->FaceElements->minColor=1;
533
534 Finley_ElementFile_setDomainFlags( out->FaceElements );
535
536 /* setup distribution info for other elements */
537 Finley_ElementFile_setDomainFlags( out->ContactElements );
538 Finley_ElementFile_setDomainFlags( out->Points );
539
540 Finley_Mesh_prepareElementDistribution( out );
541
542 /* reorder the degrees of freedom */
543 Finley_Mesh_resolveDegreeOfFreedomOrder( out, TRUE );
544
545 /* condense the nodes: */
546 Finley_Mesh_resolveNodeIds(out);
547 if( !Finley_MPI_noError(mpi_info) )
548 {
549 Paso_MPIInfo_dealloc( mpi_info );
550 Finley_Mesh_dealloc(out);
551 return NULL;
552 }
553
554 /* setup the CommBuffer */
555 Finley_NodeDistribution_formCommBuffer( out->Nodes->degreeOfFreedomDistribution, out->Nodes->CommBuffer );
556 if ( !Finley_MPI_noError( mpi_info )) {
557 Paso_MPIInfo_dealloc( mpi_info );
558 Finley_Mesh_dealloc(out);
559 return NULL;
560 }
561
562 Finley_NodeDistribution_calculateIndexExternal( out->Nodes->degreeOfFreedomDistribution, out->Nodes->CommBuffer );
563 if( !Finley_MPI_noError(mpi_info) )
564 {
565 Paso_MPIInfo_dealloc( mpi_info );
566 Finley_Mesh_dealloc(out);
567 return NULL;
568 }
569
570 /* prepare mesh for further calculatuions:*/
571 Finley_Mesh_prepare(out);
572 if( !Finley_MPI_noError(mpi_info) )
573 {
574 Paso_MPIInfo_dealloc( mpi_info );
575 Finley_Mesh_dealloc(out);
576 return NULL;
577 }
578
579 /* free up memory */
580 Paso_MPIInfo_dealloc( mpi_info );
581
582 //print_mesh_statistics( out, TRUE );
583
584 #ifdef Finley_TRACE
585 printf("timing: mesh generation: %.4e sec\n",Finley_timer()-time0);
586 #endif
587 if (Finley_noError()) {
588 if (! Finley_Mesh_isPrepared(out) ) {
589 Finley_setError(SYSTEM_ERROR,"Mesh is not prepared for calculation. Contact the programmers.");
590 }
591 }
592 return out;
593 }
594 #endif
595
596 /*
597 * Revision 1.3 2005/09/01 03:31:36 jgs
598 * Merge of development branch dev-02 back to main trunk on 2005-09-01
599 *
600 * Revision 1.2.2.2 2005/09/07 06:26:19 gross
601 * the solver from finley are put into the standalone package paso now
602 *
603 * Revision 1.2.2.1 2005/08/24 02:02:18 gross
604 * timing output switched off. solver output can be swiched through getSolution(verbose=True) now.
605 *
606 * Revision 1.2 2005/07/08 04:07:53 jgs
607 * Merge of development branch back to main trunk on 2005-07-08
608 *
609 * Revision 1.1.1.1.2.1 2005/06/29 02:34:52 gross
610 * some changes towards 64 integers in finley
611 *
612 * Revision 1.1.1.1 2004/10/26 06:53:57 jgs
613 * initial import of project esys2
614 *
615 * Revision 1.1.1.1 2004/06/24 04:00:40 johng
616 * Initial version of eys using boost-python.
617 *
618 *
619 */
620

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26