/[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 155 - (hide annotations)
Wed Nov 9 02:02:19 2005 UTC (14 years ago) by jgs
Original Path: trunk/finley/src/finleyC/ElementFile_optimizeDistribution.c
File MIME type: text/plain
File size: 4211 byte(s)
move all directories from trunk/esys2 into trunk and remove esys2

1 jgs 150 /*
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 jgs 82 /**************************************************************/
16     /* */
17     /* Finley: ElementFile */
18     /* */
19     /* reorders the elements in the element file such that the elements are stored close to the nodes */
20     /* */
21     /**************************************************************/
22    
23 jgs 150 /* Author: gross@access.edu.au */
24     /* Version: $Id$ */
25 jgs 82
26     /**************************************************************/
27    
28     #include "Util.h"
29     #include "ElementFile.h"
30    
31     /**************************************************************/
32    
33     void Finley_ElementFile_optimizeDistribution(Finley_ElementFile** in) {
34     Finley_Util_ValueAndIndex* item_list=NULL;
35     Finley_ElementFile* out=NULL;
36 jgs 123 dim_t e,i;
37     index_t *index=NULL;
38 jgs 82
39     if (*in != NULL) {
40     if ((*in)->numElements<1) return;
41 jgs 123 dim_t NN=(*in)->ReferenceElement->Type->numNodes;
42 jgs 102 item_list=TMPMEMALLOC((*in)->numElements,Finley_Util_ValueAndIndex);
43 jgs 123 index=TMPMEMALLOC((*in)->numElements,index_t);
44 jgs 82 if (! (Finley_checkPtr(item_list) || Finley_checkPtr(index)) ) {
45     out=Finley_ElementFile_alloc((*in)->ReferenceElement->Type->TypeId,(*in)->order);
46 jgs 150 if (Finley_noError()) {
47 jgs 82 Finley_ElementFile_allocTable(out,(*in)->numElements);
48 jgs 150 if (Finley_noError()) {
49 jgs 82 #pragma omp parallel for private(e,i) schedule(static)
50     for (e=0;e<(*in)->numElements;e++) {
51     item_list[e].index=e;
52     item_list[e].value=(*in)->Nodes[INDEX2(0,e,NN)];
53     for (i=1;i<NN;i++) item_list[e].value=MIN(item_list[e].value,(*in)->Nodes[INDEX2(i,e,NN)]);
54     }
55     Finley_Util_sortValueAndIndex((*in)->numElements,item_list);
56     #pragma omp parallel for private(e) schedule(static)
57     for (e=0;e<(*in)->numElements;e++) index[e]=item_list[e].index;
58     Finley_ElementFile_gather(index,*in,out);
59     Finley_ElementFile_dealloc(*in);
60     *in=out;
61     } else {
62     Finley_ElementFile_dealloc(out);
63     }
64     }
65     }
66     TMPMEMFREE(item_list);
67     TMPMEMFREE(index);
68     }
69     }
70     /*
71     * $Log$
72 jgs 150 * Revision 1.6 2005/09/15 03:44:22 jgs
73     * Merge of development branch dev-02 back to main trunk on 2005-09-15
74     *
75     * Revision 1.5.2.1 2005/09/07 06:26:18 gross
76     * the solver from finley are put into the standalone package paso now
77     *
78 jgs 123 * Revision 1.5 2005/07/08 04:07:50 jgs
79     * Merge of development branch back to main trunk on 2005-07-08
80     *
81 jgs 102 * Revision 1.4 2004/12/15 07:08:32 jgs
82 jgs 97 * *** empty log message ***
83 jgs 123 * Revision 1.1.1.1.2.2 2005/06/29 02:34:50 gross
84     * some changes towards 64 integers in finley
85 jgs 82 *
86 jgs 123 * Revision 1.1.1.1.2.1 2004/11/24 01:37:13 gross
87     * some changes dealing with the integer overflow in memory allocation. Finley solves 4M unknowns now
88 jgs 97 *
89 jgs 82 *
90 jgs 123 *
91 jgs 82 */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26