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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6939 - (show annotations)
Mon Jan 20 03:37:18 2020 UTC (4 months, 1 week ago) by uqaeller
File size: 4616 byte(s)
Updated the copyright header.


1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2020 by The University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Apache License, version 2.0
9 * http://www.apache.org/licenses/LICENSE-2.0
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-2017 by Centre for Geoscience Computing (GeoComp)
14 * Development from 2019 by School of Earth and Environmental Sciences
15 **
16 *****************************************************************************/
17
18
19 /****************************************************************************
20
21 Finley: Converting an element list into a matrix shape
22
23 *****************************************************************************/
24
25 #include "IndexList.h"
26 #include "ElementFile.h"
27
28 #include <escript/index.h>
29
30 namespace finley {
31
32 /* Translate from distributed/local array indices to global indices */
33
34 /// inserts the contributions from the element matrices of elements
35 /// into the row index col.
36 void IndexList_insertElements(IndexList* index_list, ElementFile* elements,
37 bool reduce_row_order, const index_t* row_map,
38 bool reduce_col_order, const index_t* col_map)
39 {
40 // index_list is an array of linked lists. Each entry is a row (DOF) and
41 // contains the indices to the non-zero columns
42 if (!elements)
43 return;
44
45 const int NN = elements->numNodes;
46 const_ReferenceElement_ptr refElement(elements->referenceElementSet->
47 borrowReferenceElement(false));
48
49 int NN_row, NN_col, numSub;
50 const int *row_node=NULL, *col_node=NULL;
51 if (reduce_col_order) {
52 numSub=1;
53 col_node=refElement->Type->linearNodes;
54 NN_col=refElement->LinearBasisFunctions->Type->numShapes * refElement->Type->numSides;
55 } else {
56 numSub=refElement->Type->numSubElements;
57 col_node=refElement->Type->subElementNodes;
58 NN_col=refElement->BasisFunctions->Type->numShapes * refElement->Type->numSides;
59 }
60
61 if (reduce_row_order) {
62 numSub=1;
63 row_node=refElement->Type->linearNodes;
64 NN_row=refElement->LinearBasisFunctions->Type->numShapes * refElement->Type->numSides;
65 } else {
66 numSub=refElement->Type->numSubElements;
67 row_node=refElement->Type->subElementNodes;
68 NN_row=refElement->BasisFunctions->Type->numShapes * refElement->Type->numSides;
69 }
70
71 for (int color=elements->minColor; color<=elements->maxColor; color++) {
72 #pragma omp for
73 for (index_t e=0; e<elements->numElements; e++) {
74 if (elements->Color[e]==color) {
75 for (int isub=0; isub<numSub; isub++) {
76 for (int kr=0; kr<NN_row; kr++) {
77 const index_t irow=row_map[elements->Nodes[INDEX2(row_node[INDEX2(kr,isub,NN_row)],e,NN)]];
78 for (int kc=0; kc<NN_col; kc++) {
79 const index_t icol=col_map[elements->Nodes[INDEX2(col_node[INDEX2(kc,isub,NN_col)],e,NN)]];
80 index_list[irow].insertIndex(icol);
81 }
82 }
83 }
84 }
85 }
86 }
87 }
88
89 void IndexList_insertElementsWithRowRangeNoMainDiagonal(
90 IndexList* index_list, index_t firstRow,
91 index_t lastRow, ElementFile* elements,
92 index_t* row_map, index_t* col_map)
93 {
94 if (!elements)
95 return;
96
97 // this does not resolve macro elements
98 const int NN = elements->numNodes;
99 for (index_t color = elements->minColor; color <= elements->maxColor; color++) {
100 #pragma omp for
101 for (index_t e = 0; e < elements->numElements; e++) {
102 if (elements->Color[e] == color) {
103 for (int kr = 0; kr < NN; kr++) {
104 const index_t irow = row_map[elements->Nodes[INDEX2(kr, e, NN)]];
105 if (firstRow <= irow && irow < lastRow) {
106 const index_t irow_loc = irow - firstRow;
107 for (int kc = 0; kc < NN; kc++) {
108 const index_t icol = col_map[elements->Nodes[INDEX2(kc, e, NN)]];
109 if (icol != irow)
110 index_list[irow_loc].insertIndex(icol);
111 }
112 }
113 }
114 }
115 }
116 }
117 }
118
119
120 } // namespace finley
121

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision
svn:mergeinfo /branches/4.0fordebian/finley/src/IndexList.cpp:5567-5588 /branches/diaplayground/finley/src/IndexList.cpp:4940-5147 /branches/lapack2681/finley/src/IndexList.cpp:2682-2741 /branches/pasowrap/finley/src/IndexList.cpp:3661-3674 /branches/py3_attempt2/finley/src/IndexList.cpp:3871-3891 /branches/restext/finley/src/IndexList.cpp:2610-2624 /branches/ripleygmg_from_3668/finley/src/IndexList.cpp:3669-3791 /branches/stage3.0/finley/src/IndexList.cpp:2569-2590 /branches/symbolic_from_3470/finley/src/IndexList.cpp:3471-3974 /branches/trilinos_from_5897/finley/src/IndexList.cpp:5898-6118 /release/3.0/finley/src/IndexList.cpp:2591-2601 /release/4.0/finley/src/IndexList.cpp:5380-5406 /trunk/finley/src/IndexList.cpp:4257-4344

  ViewVC Help
Powered by ViewVC 1.1.26