2
/*******************************************************
4
* Copyright (c) 2003-2010 by University of Queensland
5
* Earth Systems Science Computational Center (ESSCC)
6
* http://www.uq.edu.au/esscc
8
* Primary Business: Queensland, Australia
9
* Licensed under the Open Software License version 3.0
10
* http://www.opensource.org/licenses/osl-3.0.php
12
*******************************************************/
14
/**************************************************************/
16
/* assemblage routines: prepares the assemble parameter set */
18
/**************************************************************/
21
#include "ShapeTable.h"
23
/**************************************************************/
25
void Dudley_Assemble_getAssembleParameters(Dudley_NodeFile * nodes, Dudley_ElementFile * elements, Paso_SystemMatrix * S,
26
escriptDataC * F, bool_t reducedIntegrationOrder, Dudley_Assemble_Parameters * parm)
29
parm->shapeFns = NULL;
30
if (!isEmpty(F) && !isExpanded(F))
32
Dudley_setError(TYPE_ERROR, "Dudley_Assemble_getAssembleParameters: Right hand side is not expanded.");
36
if (!getQuadShape(elements->numDim, reducedIntegrationOrder, &(parm->shapeFns)))
38
Dudley_setError(TYPE_ERROR, "Dudley_Assemble_getAssembleParameters: Can not locate shape functions.");
40
/* check the dimensions of S and F */
41
if (S != NULL && !isEmpty(F))
45
(Paso_Distribution_getMyNumComponents(S->row_distribution) * S->row_block_size) /
46
S->logical_row_block_size))
48
Dudley_setError(TYPE_ERROR,
49
"Dudley_Assemble_getAssembleParameters: number of rows of matrix and length of right hand side don't match.");
53
/* get the number of equations and components */
63
parm->numEqu = getDataPointSize(F);
64
parm->numComp = parm->numEqu;
71
parm->numEqu = S->logical_row_block_size;
72
parm->numComp = S->logical_col_block_size;
76
if (getDataPointSize(F) != S->logical_row_block_size)
78
Dudley_setError(TYPE_ERROR,
79
"Dudley_Assemble_getAssembleParameters: matrix row block size and number of components of right hand side don't match.");
82
parm->numEqu = S->logical_row_block_size;
83
parm->numComp = S->logical_col_block_size;
86
parm->col_DOF = nodes->degreesOfFreedomMapping->target;
87
parm->row_DOF = nodes->degreesOfFreedomMapping->target;
88
/* get the information for the labeling of the degrees of freedom from matrix */
91
/* Make sure # rows in matrix == num DOF for one of: full or reduced (use numLocalDOF for MPI) */
92
if (Paso_Distribution_getMyNumComponents(S->row_distribution) * S->row_block_size ==
93
parm->numEqu * Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution))
95
parm->row_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution);
96
parm->row_DOF = nodes->degreesOfFreedomMapping->target;
97
parm->row_jac = Dudley_ElementFile_borrowJacobeans(elements, nodes, reducedIntegrationOrder);
99
else if (Paso_Distribution_getMyNumComponents(S->row_distribution) * S->row_block_size ==
100
parm->numEqu * Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution))
102
parm->row_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution);
103
parm->row_DOF = nodes->reducedDegreesOfFreedomMapping->target;
104
parm->row_jac = Dudley_ElementFile_borrowJacobeans(elements, nodes, reducedIntegrationOrder);
108
Dudley_setError(TYPE_ERROR,
109
"Dudley_Assemble_getAssembleParameters: number of rows in matrix does not match the number of degrees of freedom in mesh");
111
/* Make sure # cols in matrix == num DOF for one of: full or reduced (use numLocalDOF for MPI) */
112
if (Paso_Distribution_getMyNumComponents(S->col_distribution) * S->col_block_size ==
113
parm->numComp * Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution))
115
parm->col_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution);
116
parm->col_DOF = nodes->degreesOfFreedomMapping->target;
117
parm->row_jac = Dudley_ElementFile_borrowJacobeans(elements, nodes, reducedIntegrationOrder);
119
else if (Paso_Distribution_getMyNumComponents(S->col_distribution) * S->col_block_size ==
120
parm->numComp * Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution))
122
parm->col_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution);
123
parm->col_DOF = nodes->reducedDegreesOfFreedomMapping->target;
124
parm->row_jac = Dudley_ElementFile_borrowJacobeans(elements, nodes, reducedIntegrationOrder);
128
Dudley_setError(TYPE_ERROR,
129
"Dudley_Assemble_getAssembleParameters: number of columns in matrix does not match the number of degrees of freedom in mesh");
132
if (!Dudley_noError())
134
/* get the information from right hand side */
137
if (numSamplesEqual(F, 1, Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution)))
139
parm->row_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution);
140
parm->row_DOF = nodes->degreesOfFreedomMapping->target;
141
parm->row_jac = Dudley_ElementFile_borrowJacobeans(elements, nodes, reducedIntegrationOrder);
143
else if (numSamplesEqual
144
(F, 1, Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution)))
146
parm->row_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution);
147
parm->row_DOF = nodes->reducedDegreesOfFreedomMapping->target;
148
parm->row_jac = Dudley_ElementFile_borrowJacobeans(elements, nodes, reducedIntegrationOrder);
152
Dudley_setError(TYPE_ERROR,
153
"Dudley_Assemble_getAssembleParameters: length of RHS vector does not match the number of degrees of freedom in mesh");
157
parm->col_DOF_UpperBound = parm->row_DOF_UpperBound;
158
parm->col_DOF = parm->row_DOF;
159
parm->row_jac = parm->row_jac;
163
if (parm->row_jac->numDim != parm->row_jac->numDim)
165
Dudley_setError(TYPE_ERROR,
166
"Dudley_Assemble_getAssembleParameters: spacial dimension for row and column shape function must match.");
169
if (elements->numNodes < parm->row_jac->numShapes)
171
Dudley_setError(TYPE_ERROR, "Dudley_Assemble_getAssembleParameters: too many nodes are expected by row.");
173
if (parm->row_jac->numElements != elements->numElements)
175
Dudley_setError(TYPE_ERROR, "Dudley_Assemble_getAssembleParameters: number of elements for row is wrong.");
178
parm->numQuad = parm->row_jac->numQuad;
179
parm->NN = elements->numNodes;
180
parm->numElements = elements->numElements;
181
parm->numDim = parm->row_jac->numDim;
182
parm->numShapes = parm->row_jac->numShapes;