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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision
svn:mergeinfo /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 /trunk/dudley/src/Assemble_getAssembleParameters.cpp:4257-4344 /trunk/ripley/test/python/dudley/src/Assemble_getAssembleParameters.cpp:3480-3515

  ViewVC Help
Powered by ViewVC 1.1.26