/[escript]/trunk/dudley/src/Assemble_getAssembleParameters.c
ViewVC logotype

Contents of /trunk/dudley/src/Assemble_getAssembleParameters.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3259 - (show annotations)
Mon Oct 11 01:48:14 2010 UTC (9 years ago) by jfenwick
File MIME type: text/plain
File size: 7161 byte(s)
Merging dudley and scons updates from branches

1
2 /*******************************************************
3 *
4 * Copyright (c) 2003-2010 by University of Queensland
5 * Earth Systems Science Computational Center (ESSCC)
6 * http://www.uq.edu.au/esscc
7 *
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
11 *
12 *******************************************************/
13
14 /**************************************************************/
15
16 /* assemblage routines: prepares the assemble parameter set */
17
18 /**************************************************************/
19
20 #include "Assemble.h"
21 #include "ShapeTable.h"
22
23 /**************************************************************/
24
25 void Dudley_Assemble_getAssembleParameters(Dudley_NodeFile * nodes, Dudley_ElementFile * elements, Paso_SystemMatrix * S,
26 escriptDataC * F, bool_t reducedIntegrationOrder, Dudley_Assemble_Parameters * parm)
27 {
28 Dudley_resetError();
29 parm->shapeFns = NULL;
30 if (!isEmpty(F) && !isExpanded(F))
31 {
32 Dudley_setError(TYPE_ERROR, "Dudley_Assemble_getAssembleParameters: Right hand side is not expanded.");
33 return;
34 }
35
36 if (!getQuadShape(elements->numDim, reducedIntegrationOrder, &(parm->shapeFns)))
37 {
38 Dudley_setError(TYPE_ERROR, "Dudley_Assemble_getAssembleParameters: Can not locate shape functions.");
39 }
40 /* check the dimensions of S and F */
41 if (S != NULL && !isEmpty(F))
42 {
43 if (!numSamplesEqual
44 (F, 1,
45 (Paso_Distribution_getMyNumComponents(S->row_distribution) * S->row_block_size) /
46 S->logical_row_block_size))
47 {
48 Dudley_setError(TYPE_ERROR,
49 "Dudley_Assemble_getAssembleParameters: number of rows of matrix and length of right hand side don't match.");
50 return;
51 }
52 }
53 /* get the number of equations and components */
54 if (S == NULL)
55 {
56 if (isEmpty(F))
57 {
58 parm->numEqu = 1;
59 parm->numComp = 1;
60 }
61 else
62 {
63 parm->numEqu = getDataPointSize(F);
64 parm->numComp = parm->numEqu;
65 }
66 }
67 else
68 {
69 if (isEmpty(F))
70 {
71 parm->numEqu = S->logical_row_block_size;
72 parm->numComp = S->logical_col_block_size;
73 }
74 else
75 {
76 if (getDataPointSize(F) != S->logical_row_block_size)
77 {
78 Dudley_setError(TYPE_ERROR,
79 "Dudley_Assemble_getAssembleParameters: matrix row block size and number of components of right hand side don't match.");
80 return;
81 }
82 parm->numEqu = S->logical_row_block_size;
83 parm->numComp = S->logical_col_block_size;
84 }
85 }
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 */
89 if (S != NULL)
90 {
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))
94 {
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);
98 }
99 else if (Paso_Distribution_getMyNumComponents(S->row_distribution) * S->row_block_size ==
100 parm->numEqu * Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution))
101 {
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);
105 }
106 else
107 {
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");
110 }
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))
114 {
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);
118 }
119 else if (Paso_Distribution_getMyNumComponents(S->col_distribution) * S->col_block_size ==
120 parm->numComp * Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution))
121 {
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);
125 }
126 else
127 {
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");
130 }
131 }
132 if (!Dudley_noError())
133 return;
134 /* get the information from right hand side */
135 if (!isEmpty(F))
136 {
137 if (numSamplesEqual(F, 1, Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution)))
138 {
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);
142 }
143 else if (numSamplesEqual
144 (F, 1, Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution)))
145 {
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);
149 }
150 else
151 {
152 Dudley_setError(TYPE_ERROR,
153 "Dudley_Assemble_getAssembleParameters: length of RHS vector does not match the number of degrees of freedom in mesh");
154 }
155 if (S == NULL)
156 {
157 parm->col_DOF_UpperBound = parm->row_DOF_UpperBound;
158 parm->col_DOF = parm->row_DOF;
159 parm->row_jac = parm->row_jac;
160 }
161 }
162
163 if (parm->row_jac->numDim != parm->row_jac->numDim)
164 {
165 Dudley_setError(TYPE_ERROR,
166 "Dudley_Assemble_getAssembleParameters: spacial dimension for row and column shape function must match.");
167 }
168
169 if (elements->numNodes < parm->row_jac->numShapes)
170 {
171 Dudley_setError(TYPE_ERROR, "Dudley_Assemble_getAssembleParameters: too many nodes are expected by row.");
172 }
173 if (parm->row_jac->numElements != elements->numElements)
174 {
175 Dudley_setError(TYPE_ERROR, "Dudley_Assemble_getAssembleParameters: number of elements for row is wrong.");
176 }
177
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;
183
184 }

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26