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

Contents of /trunk/finley/src/Mesh_getPasoPattern.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: 5569 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 #ifdef ESYS_HAVE_PASO
19 #include "FinleyDomain.h"
20 #include "IndexList.h"
21
22 #include <boost/scoped_array.hpp>
23
24 namespace finley {
25
26 paso::SystemMatrixPattern_ptr FinleyDomain::getPasoPattern(
27 bool reducedRowOrder, bool reducedColOrder) const
28 {
29 paso::SystemMatrixPattern_ptr out;
30 // make sure that the requested pattern is available
31 if (reducedRowOrder) {
32 if (reducedColOrder) {
33 if (!ReducedReducedPattern)
34 ReducedReducedPattern = makePasoPattern(reducedRowOrder, reducedColOrder);
35 } else {
36 if (!ReducedFullPattern)
37 ReducedFullPattern = makePasoPattern(reducedRowOrder, reducedColOrder);
38 }
39 } else {
40 if (reducedColOrder) {
41 if (!FullReducedPattern)
42 FullReducedPattern = makePasoPattern(reducedRowOrder, reducedColOrder);
43 } else {
44 if (!FullFullPattern)
45 FullFullPattern = makePasoPattern(reducedRowOrder, reducedColOrder);
46 }
47 }
48 if (reducedRowOrder) {
49 if (reducedColOrder) {
50 out = ReducedReducedPattern;
51 } else {
52 out = ReducedFullPattern;
53 }
54 } else {
55 if (reducedColOrder) {
56 out = FullReducedPattern;
57 } else {
58 out = FullFullPattern;
59 }
60 }
61 return out;
62 }
63
64 paso::SystemMatrixPattern_ptr FinleyDomain::makePasoPattern(
65 bool reducedRowOrder, bool reducedColOrder) const
66 {
67 paso::Connector_ptr col_connector, row_connector;
68 escript::Distribution_ptr colDistribution, rowDistribution;
69
70 dim_t myNumColTargets, myNumRowTargets;
71 dim_t numColTargets, numRowTargets;
72 const index_t *colTarget, *rowTarget;
73
74 if (reducedColOrder) {
75 myNumColTargets = m_nodes->getNumReducedDegreesOfFreedom();
76 numColTargets = m_nodes->getNumReducedDegreesOfFreedomTargets();
77 colTarget = m_nodes->borrowTargetReducedDegreesOfFreedom();
78 colDistribution = m_nodes->reducedDegreesOfFreedomDistribution;
79 col_connector = m_nodes->reducedDegreesOfFreedomConnector;
80 } else {
81 myNumColTargets = m_nodes->getNumDegreesOfFreedom();
82 numColTargets = m_nodes->getNumDegreesOfFreedomTargets();
83 colTarget = m_nodes->borrowTargetDegreesOfFreedom();
84 colDistribution = m_nodes->degreesOfFreedomDistribution;
85 col_connector = m_nodes->degreesOfFreedomConnector;
86 }
87
88 if (reducedRowOrder) {
89 myNumRowTargets = m_nodes->getNumReducedDegreesOfFreedom();
90 numRowTargets = m_nodes->getNumReducedDegreesOfFreedomTargets();
91 rowTarget = m_nodes->borrowTargetReducedDegreesOfFreedom();
92 rowDistribution = m_nodes->reducedDegreesOfFreedomDistribution;
93 row_connector = m_nodes->reducedDegreesOfFreedomConnector;
94 } else {
95 myNumRowTargets = m_nodes->getNumDegreesOfFreedom();
96 numRowTargets = m_nodes->getNumDegreesOfFreedomTargets();
97 rowTarget = m_nodes->borrowTargetDegreesOfFreedom();
98 rowDistribution = m_nodes->degreesOfFreedomDistribution;
99 row_connector = m_nodes->degreesOfFreedomConnector;
100 }
101 boost::scoped_array<IndexList> index_list(new IndexList[numRowTargets]);
102
103 #pragma omp parallel
104 {
105 // insert contributions from element matrices into columns in indexlist
106 IndexList_insertElements(index_list.get(), m_elements, reducedRowOrder,
107 rowTarget, reducedColOrder, colTarget);
108 IndexList_insertElements(index_list.get(), m_faceElements,
109 reducedRowOrder, rowTarget, reducedColOrder,
110 colTarget);
111 IndexList_insertElements(index_list.get(), m_contactElements,
112 reducedRowOrder, rowTarget, reducedColOrder,
113 colTarget);
114 IndexList_insertElements(index_list.get(), m_points, reducedRowOrder,
115 rowTarget, reducedColOrder, colTarget);
116 }
117
118 // create pattern
119 paso::Pattern_ptr mainPattern(paso::Pattern::fromIndexListArray(0,
120 myNumRowTargets, index_list.get(), 0, myNumColTargets, 0));
121 paso::Pattern_ptr colCouplePattern(paso::Pattern::fromIndexListArray(0,
122 myNumRowTargets, index_list.get(), myNumColTargets,
123 numColTargets, -myNumColTargets));
124 paso::Pattern_ptr rowCouplePattern(paso::Pattern::fromIndexListArray(
125 myNumRowTargets, numRowTargets, index_list.get(), 0,
126 myNumColTargets, 0));
127
128 paso::SystemMatrixPattern_ptr out(new paso::SystemMatrixPattern(
129 MATRIX_FORMAT_DEFAULT, rowDistribution, colDistribution,
130 mainPattern, colCouplePattern, rowCouplePattern,
131 col_connector, row_connector));
132 return out;
133 }
134
135 } // namespace finley
136
137 #endif // ESYS_HAVE_PASO
138

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26