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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1062 - (show annotations)
Mon Mar 26 06:17:53 2007 UTC (12 years, 3 months ago) by gross
File MIME type: text/plain
File size: 4115 byte(s)
reduced integration schemes are implemented now for grad, integrate, etc. Tests still to be added.
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: ElementFile */
16 /* */
17 /* reorders the elements in the element file such that the elements are stored close to the nodes */
18 /* */
19 /**************************************************************/
20
21 /* Author: gross@access.edu.au */
22 /* Version: $Id$ */
23
24 /**************************************************************/
25
26 #include "Util.h"
27 #include "ElementFile.h"
28
29 /**************************************************************/
30
31 void Finley_ElementFile_optimizeDistribution(Finley_ElementFile** in) {
32 #ifdef PASO_MPI
33 /* TODO */
34 /* We will need to take care when reordering elements, because the internal/boundary status of an element is implicit in its
35 ordering. */
36 return;
37 #else
38 Finley_Util_ValueAndIndex* item_list=NULL;
39 Finley_ElementFile* out=NULL;
40 dim_t e,i, NN;
41 index_t *index=NULL;
42 if (*in != NULL) {
43 if ((*in)->numElements<1) return;
44 NN=(*in)->ReferenceElement->Type->numNodes;
45 item_list=TMPMEMALLOC((*in)->numElements,Finley_Util_ValueAndIndex);
46 index=TMPMEMALLOC((*in)->numElements,index_t);
47 if (! (Finley_checkPtr(item_list) || Finley_checkPtr(index)) ) {
48
49 out=Finley_ElementFile_alloc((*in)->ReferenceElement->Type->TypeId,(*in)->order, (*in)->reduced_order);
50 if (Finley_noError()) {
51 Finley_ElementFile_allocTable(out,(*in)->numElements);
52 if (Finley_noError()) {
53 #pragma omp parallel for private(e,i) schedule(static)
54 for (e=0;e<(*in)->numElements;e++) {
55 item_list[e].index=e;
56 item_list[e].value=(*in)->Nodes[INDEX2(0,e,NN)];
57 for (i=1;i<NN;i++) item_list[e].value=MIN(item_list[e].value,(*in)->Nodes[INDEX2(i,e,NN)]);
58 }
59 Finley_Util_sortValueAndIndex((*in)->numElements,item_list);
60 #pragma omp parallel for private(e) schedule(static)
61 for (e=0;e<(*in)->numElements;e++) index[e]=item_list[e].index;
62 Finley_ElementFile_gather(index,*in,out);
63 Finley_ElementFile_dealloc(*in);
64 *in=out;
65 } else {
66 Finley_ElementFile_dealloc(out);
67 }
68 }
69 }
70 TMPMEMFREE(item_list);
71 TMPMEMFREE(index);
72 }
73 #endif
74 }
75 /*
76 * $Log$
77 * Revision 1.6 2005/09/15 03:44:22 jgs
78 * Merge of development branch dev-02 back to main trunk on 2005-09-15
79 *
80 * Revision 1.5.2.1 2005/09/07 06:26:18 gross
81 * the solver from finley are put into the standalone package paso now
82 *
83 * Revision 1.5 2005/07/08 04:07:50 jgs
84 * Merge of development branch back to main trunk on 2005-07-08
85 *
86 * Revision 1.4 2004/12/15 07:08:32 jgs
87 * *** empty log message ***
88 * Revision 1.1.1.1.2.2 2005/06/29 02:34:50 gross
89 * some changes towards 64 integers in finley
90 *
91 * Revision 1.1.1.1.2.1 2004/11/24 01:37:13 gross
92 * some changes dealing with the integer overflow in memory allocation. Finley solves 4M unknowns now
93 *
94 *
95 *
96 */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26