/[escript]/trunk/dudley/src/IndexList.cpp
ViewVC logotype

Contents of /trunk/dudley/src/IndexList.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5148 - (show annotations)
Mon Sep 15 01:25:23 2014 UTC (4 years, 11 months ago) by caltinay
File size: 4691 byte(s)
Merging ripley diagonal storage + CUDA support into trunk.
Options file version has been incremented due to new options
'cuda' and 'nvccflags'.

1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2014 by 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: Converting an element list into a matrix shape */
20
21 /************************************************************************************/
22
23 #include "IndexList.h"
24
25 /* Translate from distributed/local array indices to global indices */
26
27 /************************************************************************************/
28 /* inserts the contributions from the element matrices of elements
29 into the row index col. If symmetric is set, only the upper
30 triangle of the matrix is stored. */
31
32 void Dudley_IndexList_insertElements(IndexList* index_list,
33 Dudley_ElementFile * elements,
34 bool reduce_row_order, index_t* row_map,
35 bool reduce_col_order, index_t* col_map)
36 {
37 /* index_list is an array of linked lists. Each entry is a row (DOF) and contains the indices to the non-zero columns */
38 index_t color;
39 dim_t e, kr, kc, NN_row, NN_col, icol, irow, NN;
40 if (elements != NULL)
41 {
42 NN = elements->numNodes;
43 NN_col = (elements->numShapes);
44 NN_row = (elements->numShapes);
45
46 for (color = elements->minColor; color <= elements->maxColor; color++)
47 {
48 #pragma omp for private(e,irow,kr,kc,icol) schedule(static)
49 for (e = 0; e < elements->numElements; e++)
50 {
51 if (elements->Color[e] == color)
52 {
53 for (kr = 0; kr < NN_row; kr++)
54 {
55 irow = row_map[elements->Nodes[INDEX2(kr, e, NN)]];
56 for (kc = 0; kc < NN_col; kc++)
57 {
58 icol = col_map[elements->Nodes[INDEX2(kc, e, NN)]];
59 index_list[irow].insertIndex(icol);
60 }
61 }
62 }
63 }
64 }
65 }
66 }
67
68 void Dudley_IndexList_insertElementsWithRowRange(IndexList* index_list,
69 index_t firstRow, index_t lastRow, Dudley_ElementFile* elements,
70 index_t* row_map, index_t* col_map)
71 {
72 /* this does not resolve macro elements */
73 index_t color;
74 dim_t e, kr, kc, icol, irow, NN;
75 if (elements != NULL)
76 {
77 NN = elements->numNodes;
78 for (color = elements->minColor; color <= elements->maxColor; color++)
79 {
80 #pragma omp for private(e,irow,kr,kc,icol) schedule(static)
81 for (e = 0; e < elements->numElements; e++)
82 {
83 if (elements->Color[e] == color)
84 {
85 for (kr = 0; kr < NN; kr++)
86 {
87 irow = row_map[elements->Nodes[INDEX2(kr, e, NN)]];
88 if ((firstRow <= irow) && (irow < lastRow))
89 {
90 irow -= firstRow;
91 for (kc = 0; kc < NN; kc++)
92 {
93 icol = col_map[elements->Nodes[INDEX2(kc, e, NN)]];
94 index_list[irow].insertIndex(icol);
95 }
96 }
97 }
98 }
99 }
100 }
101 }
102 }
103
104 void Dudley_IndexList_insertElementsWithRowRangeNoMainDiagonal(
105 IndexList* index_list, index_t firstRow, index_t lastRow,
106 Dudley_ElementFile* elements, index_t* row_map, index_t* col_map)
107 {
108 /* this does not resolve macro elements */
109 index_t color;
110 dim_t e, kr, kc, icol, irow, NN, irow_loc;
111 if (elements != NULL)
112 {
113 NN = elements->numNodes;
114 for (color = elements->minColor; color <= elements->maxColor; color++)
115 {
116 #pragma omp for private(e,irow,kr,kc,icol,irow_loc) schedule(static)
117 for (e = 0; e < elements->numElements; e++)
118 {
119 if (elements->Color[e] == color)
120 {
121 for (kr = 0; kr < NN; kr++)
122 {
123 irow = row_map[elements->Nodes[INDEX2(kr, e, NN)]];
124 if ((firstRow <= irow) && (irow < lastRow))
125 {
126 irow_loc = irow - firstRow;
127 for (kc = 0; kc < NN; kc++)
128 {
129 icol = col_map[elements->Nodes[INDEX2(kc, e, NN)]];
130 if (icol != irow)
131 index_list[irow_loc].insertIndex(icol);
132 }
133 }
134 }
135 }
136 }
137 }
138 }
139 }
140

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision
svn:mergeinfo /branches/diaplayground/dudley/src/IndexList.cpp:4940-5147 /branches/lapack2681/finley/src/IndexList.cpp:2682-2741 /branches/pasowrap/dudley/src/IndexList.cpp:3661-3674 /branches/py3_attempt2/dudley/src/IndexList.cpp:3871-3891 /branches/restext/finley/src/IndexList.cpp:2610-2624 /branches/ripleygmg_from_3668/dudley/src/IndexList.cpp:3669-3791 /branches/stage3.0/finley/src/IndexList.cpp:2569-2590 /branches/symbolic_from_3470/dudley/src/IndexList.cpp:3471-3974 /branches/symbolic_from_3470/ripley/test/python/dudley/src/IndexList.cpp:3517-3974 /release/3.0/finley/src/IndexList.cpp:2591-2601 /trunk/dudley/src/IndexList.cpp:4257-4344 /trunk/ripley/test/python/dudley/src/IndexList.cpp:3480-3515

  ViewVC Help
Powered by ViewVC 1.1.26