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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1028 - (hide annotations)
Wed Mar 14 00:15:24 2007 UTC (12 years, 7 months ago) by gross
File MIME type: text/plain
File size: 4093 byte(s)
modifications to be compliant with _WIN32. The substitutes for asinh, acosh, atanh are still missing (erf will through an exception)
1 jgs 150 /*
2 elspeth 616 ************************************************************
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 jgs 150 */
12    
13 jgs 82 /**************************************************************/
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 jgs 150 /* Author: gross@access.edu.au */
22     /* Version: $Id$ */
23 jgs 82
24     /**************************************************************/
25    
26     #include "Util.h"
27     #include "ElementFile.h"
28    
29     /**************************************************************/
30    
31     void Finley_ElementFile_optimizeDistribution(Finley_ElementFile** in) {
32 bcumming 751 #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 jgs 82 Finley_Util_ValueAndIndex* item_list=NULL;
39     Finley_ElementFile* out=NULL;
40 gross 1028 dim_t e,i, NN;
41 jgs 123 index_t *index=NULL;
42 jgs 82 if (*in != NULL) {
43     if ((*in)->numElements<1) return;
44 gross 1028 NN=(*in)->ReferenceElement->Type->numNodes;
45 jgs 102 item_list=TMPMEMALLOC((*in)->numElements,Finley_Util_ValueAndIndex);
46 jgs 123 index=TMPMEMALLOC((*in)->numElements,index_t);
47 jgs 82 if (! (Finley_checkPtr(item_list) || Finley_checkPtr(index)) ) {
48 bcumming 751
49 jgs 82 out=Finley_ElementFile_alloc((*in)->ReferenceElement->Type->TypeId,(*in)->order);
50 jgs 150 if (Finley_noError()) {
51 jgs 82 Finley_ElementFile_allocTable(out,(*in)->numElements);
52 jgs 150 if (Finley_noError()) {
53 jgs 82 #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 bcumming 751 #endif
74 jgs 82 }
75     /*
76     * $Log$
77 jgs 150 * 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 jgs 123 * 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 jgs 102 * Revision 1.4 2004/12/15 07:08:32 jgs
87 jgs 97 * *** empty log message ***
88 jgs 123 * Revision 1.1.1.1.2.2 2005/06/29 02:34:50 gross
89     * some changes towards 64 integers in finley
90 jgs 82 *
91 jgs 123 * 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 jgs 97 *
94 jgs 82 *
95 jgs 123 *
96 jgs 82 */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26