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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5933 - (show annotations)
Wed Feb 17 23:53:30 2016 UTC (21 months, 3 weeks ago) by caltinay
File size: 8335 byte(s)
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 /* assemblage routines: prepares the assemble parameter set */
20
21 /************************************************************************************/
22
23 #define ESNEEDPYTHON
24 #include "esysUtils/first.h"
25
26 #include "Assemble.h"
27 #include "ShapeTable.h"
28
29 #include <paso/SystemMatrix.h>
30
31 /************************************************************************************/
32
33 void Dudley_Assemble_getAssembleParameters(Dudley_NodeFile* nodes,
34 Dudley_ElementFile* elements, escript::ASM_ptr mat,
35 const escript::Data* F, bool reducedIntegrationOrder,
36 Dudley_Assemble_Parameters* parm)
37 {
38 paso::SystemMatrix* S = dynamic_cast<paso::SystemMatrix*>(mat.get());
39 if (mat && !S) {
40 Dudley_setError(TYPE_ERROR, "Dudley_Assemble_getAssembleParameters: Unknown matrix type.");
41 return;
42 }
43 Dudley_resetError();
44 parm->shapeFns = NULL;
45 if (!isEmpty(F) && !isExpanded(F))
46 {
47 Dudley_setError(TYPE_ERROR, "Dudley_Assemble_getAssembleParameters: Right hand side is not expanded.");
48 return;
49 }
50
51 if (!getQuadShape(elements->numDim, reducedIntegrationOrder, &parm->shapeFns))
52 {
53 Dudley_setError(TYPE_ERROR, "Dudley_Assemble_getAssembleParameters: Can not locate shape functions.");
54 }
55 /* check the dimensions of S and F */
56 if (S != NULL && !isEmpty(F))
57 {
58 if (!numSamplesEqual
59 (F, 1,
60 (S->row_distribution->getMyNumComponents() * S->row_block_size) /
61 S->logical_row_block_size))
62 {
63 Dudley_setError(TYPE_ERROR,
64 "Dudley_Assemble_getAssembleParameters: number of rows of matrix and length of right hand side don't match.");
65 return;
66 }
67 }
68 /* get the number of equations and components */
69 if (S == NULL)
70 {
71 if (isEmpty(F))
72 {
73 parm->numEqu = 1;
74 parm->numComp = 1;
75 }
76 else
77 {
78 parm->numEqu = getDataPointSize(F);
79 parm->numComp = parm->numEqu;
80 }
81 }
82 else
83 {
84 if (isEmpty(F))
85 {
86 parm->numEqu = S->logical_row_block_size;
87 parm->numComp = S->logical_col_block_size;
88 }
89 else
90 {
91 if (getDataPointSize(F) != S->logical_row_block_size)
92 {
93 Dudley_setError(TYPE_ERROR,
94 "Dudley_Assemble_getAssembleParameters: matrix row block size and number of components of right hand side don't match.");
95 return;
96 }
97 parm->numEqu = S->logical_row_block_size;
98 parm->numComp = S->logical_col_block_size;
99 }
100 }
101 parm->col_DOF = nodes->degreesOfFreedomMapping->target;
102 parm->row_DOF = nodes->degreesOfFreedomMapping->target;
103 /* get the information for the labeling of the degrees of freedom from matrix */
104 if (S != NULL)
105 {
106 /* Make sure # rows in matrix == num DOF for one of: full or reduced (use numLocalDOF for MPI) */
107 if (S->row_distribution->getMyNumComponents() * S->row_block_size ==
108 parm->numEqu * nodes->degreesOfFreedomDistribution->getMyNumComponents())
109 {
110 parm->row_DOF_UpperBound = nodes->degreesOfFreedomDistribution->getMyNumComponents();
111 parm->row_DOF = nodes->degreesOfFreedomMapping->target;
112 parm->row_jac = Dudley_ElementFile_borrowJacobeans(elements, nodes, reducedIntegrationOrder);
113 }
114 else if (S->row_distribution->getMyNumComponents() * S->row_block_size ==
115 parm->numEqu * nodes->reducedDegreesOfFreedomDistribution->getMyNumComponents())
116 {
117 parm->row_DOF_UpperBound = nodes->reducedDegreesOfFreedomDistribution->getMyNumComponents();
118 parm->row_DOF = nodes->reducedDegreesOfFreedomMapping->target;
119 parm->row_jac = Dudley_ElementFile_borrowJacobeans(elements, nodes, reducedIntegrationOrder);
120 }
121 else
122 {
123 Dudley_setError(TYPE_ERROR,
124 "Dudley_Assemble_getAssembleParameters: number of rows in matrix does not match the number of degrees of freedom in mesh");
125 }
126 /* Make sure # cols in matrix == num DOF for one of: full or reduced (use numLocalDOF for MPI) */
127 if (S->col_distribution->getMyNumComponents() * S->col_block_size ==
128 parm->numComp * nodes->degreesOfFreedomDistribution->getMyNumComponents())
129 {
130 parm->col_DOF_UpperBound = nodes->degreesOfFreedomDistribution->getMyNumComponents();
131 parm->col_DOF = nodes->degreesOfFreedomMapping->target;
132 parm->row_jac = Dudley_ElementFile_borrowJacobeans(elements, nodes, reducedIntegrationOrder);
133 }
134 else if (S->col_distribution->getMyNumComponents() * S->col_block_size ==
135 parm->numComp * nodes->reducedDegreesOfFreedomDistribution->getMyNumComponents())
136 {
137 parm->col_DOF_UpperBound = nodes->reducedDegreesOfFreedomDistribution->getMyNumComponents();
138 parm->col_DOF = nodes->reducedDegreesOfFreedomMapping->target;
139 parm->row_jac = Dudley_ElementFile_borrowJacobeans(elements, nodes, reducedIntegrationOrder);
140 }
141 else
142 {
143 Dudley_setError(TYPE_ERROR,
144 "Dudley_Assemble_getAssembleParameters: number of columns in matrix does not match the number of degrees of freedom in mesh");
145 }
146 }
147 if (!Dudley_noError())
148 return;
149 /* get the information from right hand side */
150 if (!isEmpty(F))
151 {
152 if (numSamplesEqual(F, 1, nodes->degreesOfFreedomDistribution->getMyNumComponents()))
153 {
154 parm->row_DOF_UpperBound = nodes->degreesOfFreedomDistribution->getMyNumComponents();
155 parm->row_DOF = nodes->degreesOfFreedomMapping->target;
156 parm->row_jac = Dudley_ElementFile_borrowJacobeans(elements, nodes, reducedIntegrationOrder);
157 }
158 else if (numSamplesEqual
159 (F, 1, nodes->reducedDegreesOfFreedomDistribution->getMyNumComponents()))
160 {
161 parm->row_DOF_UpperBound = nodes->reducedDegreesOfFreedomDistribution->getMyNumComponents();
162 parm->row_DOF = nodes->reducedDegreesOfFreedomMapping->target;
163 parm->row_jac = Dudley_ElementFile_borrowJacobeans(elements, nodes, reducedIntegrationOrder);
164 }
165 else
166 {
167 Dudley_setError(TYPE_ERROR,
168 "Dudley_Assemble_getAssembleParameters: length of RHS vector does not match the number of degrees of freedom in mesh");
169 }
170 if (S == NULL)
171 {
172 parm->col_DOF_UpperBound = parm->row_DOF_UpperBound;
173 parm->col_DOF = parm->row_DOF;
174 parm->row_jac = parm->row_jac;
175 }
176 }
177
178 if (parm->row_jac->numDim != parm->row_jac->numDim)
179 {
180 Dudley_setError(TYPE_ERROR,
181 "Dudley_Assemble_getAssembleParameters: spacial dimension for row and column shape function must match.");
182 }
183
184 if (elements->numNodes < parm->row_jac->numShapes)
185 {
186 Dudley_setError(TYPE_ERROR, "Dudley_Assemble_getAssembleParameters: too many nodes are expected by row.");
187 }
188 if (parm->row_jac->numElements != elements->numElements)
189 {
190 Dudley_setError(TYPE_ERROR, "Dudley_Assemble_getAssembleParameters: number of elements for row is wrong.");
191 }
192
193 parm->numQuad = parm->row_jac->numQuad;
194 parm->NN = elements->numNodes;
195 parm->numElements = elements->numElements;
196 parm->numDim = parm->row_jac->numDim;
197 parm->numShapes = parm->row_jac->numShapes;
198 }
199

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26