/[escript]/branches/trilinos_from_5897/dudley/src/ElementFile_optimizeOrdering.cpp
ViewVC logotype

Contents of /branches/trilinos_from_5897/dudley/src/ElementFile_optimizeOrdering.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6009 - (show annotations)
Wed Mar 2 04:13:26 2016 UTC (3 years, 1 month ago) by caltinay
File size: 2282 byte(s)
Much needed sync with trunk...

1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2016 by The University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Open Software License version 3.0
9 * http://www.opensource.org/licenses/osl-3.0.php
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development 2012-2013 by School of Earth Sciences
13 * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 *
15 *****************************************************************************/
16
17 /****************************************************************************
18
19 Dudley: ElementFile
20
21 reorders the elements in the element file such that the elements are
22 stored close to the nodes
23
24 *****************************************************************************/
25
26 #include "ElementFile.h"
27 #include "Util.h"
28
29 namespace dudley {
30
31 void Dudley_ElementFile_optimizeOrdering(Dudley_ElementFile** in)
32 {
33 if (*in != NULL) {
34 if ((*in)->numElements < 1)
35 return;
36
37 Dudley_Util_ValueAndIndex *item_list = NULL;
38 Dudley_ElementFile *out = NULL;
39 dim_t e, i, NN;
40 index_t *index = NULL;
41 NN = (*in)->numNodes;
42 item_list = new Dudley_Util_ValueAndIndex[(*in)->numElements];
43 index = new index_t[(*in)->numElements];
44 out = Dudley_ElementFile_alloc((*in)->etype, (*in)->MPIInfo);
45 Dudley_ElementFile_allocTable(out, (*in)->numElements);
46 #pragma omp parallel for private(e,i) schedule(static)
47 for (e = 0; e < (*in)->numElements; e++) {
48 item_list[e].index = e;
49 item_list[e].value = (*in)->Nodes[INDEX2(0, e, NN)];
50 for (i = 1; i < NN; i++)
51 item_list[e].value = std::min(item_list[e].value, (*in)->Nodes[INDEX2(i, e, NN)]);
52 }
53 Dudley_Util_sortValueAndIndex((*in)->numElements, item_list);
54 #pragma omp parallel for private(e) schedule(static)
55 for (e = 0; e < (*in)->numElements; e++)
56 index[e] = item_list[e].index;
57 Dudley_ElementFile_gather(index, *in, out);
58 Dudley_ElementFile_free(*in);
59 *in = out;
60 delete[] item_list;
61 delete[] index;
62 }
63 }
64
65 } // namespace dudley
66

Properties

Name Value
svn:mergeinfo /branches/4.0fordebian/dudley/src/ElementFile_optimizeOrdering.cpp:5567-5588 /branches/lapack2681/finley/src/ElementFile_optimizeOrdering.cpp:2682-2741 /branches/pasowrap/dudley/src/ElementFile_optimizeOrdering.cpp:3661-3674 /branches/py3_attempt2/dudley/src/ElementFile_optimizeOrdering.cpp:3871-3891 /branches/restext/finley/src/ElementFile_optimizeOrdering.cpp:2610-2624 /branches/ripleygmg_from_3668/dudley/src/ElementFile_optimizeOrdering.cpp:3669-3791 /branches/stage3.0/finley/src/ElementFile_optimizeOrdering.cpp:2569-2590 /branches/symbolic_from_3470/dudley/src/ElementFile_optimizeOrdering.cpp:3471-3974 /branches/symbolic_from_3470/ripley/test/python/dudley/src/ElementFile_optimizeOrdering.cpp:3517-3974 /release/3.0/finley/src/ElementFile_optimizeOrdering.cpp:2591-2601 /release/4.0/dudley/src/ElementFile_optimizeOrdering.cpp:5380-5406 /trunk/dudley/src/ElementFile_optimizeOrdering.cpp:4257-4344,5898-6007 /trunk/ripley/test/python/dudley/src/ElementFile_optimizeOrdering.cpp:3480-3515

  ViewVC Help
Powered by ViewVC 1.1.26