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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3259 - (show annotations)
Mon Oct 11 01:48:14 2010 UTC (8 years, 10 months ago) by jfenwick
File MIME type: text/plain
File size: 9203 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
17 /* assemblage routines: prepares the assemble parameter set */
18
19 /**************************************************************/
20
21 #include "Assemble.h"
22
23 /**************************************************************/
24
25 void Finley_Assemble_getAssembleParameters(Finley_NodeFile* nodes,Finley_ElementFile* elements,Paso_SystemMatrix* S,
26 escriptDataC* F, bool_t reducedIntegrationOrder, Finley_Assemble_Parameters *parm) {
27 dim_t numSub, numQuadSub;
28 Finley_resetError();
29
30 if (!isEmpty(F) && !isExpanded(F) ) {
31 Finley_setError(TYPE_ERROR,"Finley_Assemble_getAssembleParameters: Right hand side is not expanded.");
32 return;
33 }
34 /* check the dimensions of S and F */
35 if (S!=NULL && !isEmpty(F)) {
36 if (! numSamplesEqual(F,1,(Paso_Distribution_getMyNumComponents(S->row_distribution)*S->row_block_size)/S->logical_row_block_size)) {
37 Finley_setError(TYPE_ERROR,"Finley_Assemble_getAssembleParameters: number of rows of matrix and length of right hand side don't match.");
38 return;
39 }
40 }
41 /* get the number of equations and components */
42 if (S==NULL) {
43 if (isEmpty(F)) {
44 parm->numEqu=1;
45 parm->numComp=1;
46 } else {
47 parm->numEqu=getDataPointSize(F);
48 parm->numComp=parm->numEqu;
49 }
50 } else {
51 if (isEmpty(F)) {
52 parm->numEqu=S->logical_row_block_size;
53 parm->numComp=S->logical_col_block_size;
54 } else {
55 if ( getDataPointSize(F)!=S->logical_row_block_size) {
56 Finley_setError(TYPE_ERROR,"Finley_Assemble_getAssembleParameters: matrix row block size and number of components of right hand side don't match.");
57 return;
58 }
59 parm->numEqu=S->logical_row_block_size;
60 parm->numComp=S->logical_col_block_size;
61 }
62 }
63 parm->col_DOF=nodes->degreesOfFreedomMapping->target;
64 parm->row_DOF=nodes->degreesOfFreedomMapping->target;
65 /* get the information for the labeling of the degrees of freedom from matrix */
66 if (S!=NULL) {
67 /* Make sure # rows in matrix == num DOF for one of: full or reduced (use numLocalDOF for MPI) */
68 if ( Paso_Distribution_getMyNumComponents(S->row_distribution)*S->row_block_size==parm->numEqu* Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution)) {
69 parm->row_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution);
70 parm->row_DOF=nodes->degreesOfFreedomMapping->target;
71 parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder);
72 }
73 else if ( Paso_Distribution_getMyNumComponents(S->row_distribution)*S->row_block_size==parm->numEqu* Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution)) {
74 parm->row_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution);
75 parm->row_DOF=nodes->reducedDegreesOfFreedomMapping->target;
76 parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);
77 } else {
78 Finley_setError(TYPE_ERROR,"Finley_Assemble_getAssembleParameters: number of rows in matrix does not match the number of degrees of freedom in mesh");
79 }
80 /* Make sure # cols in matrix == num DOF for one of: full or reduced (use numLocalDOF for MPI) */
81 if ( Paso_Distribution_getMyNumComponents(S->col_distribution)*S->col_block_size==parm->numComp* Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution)) {
82 parm->col_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution);
83 parm->col_DOF=nodes->degreesOfFreedomMapping->target;
84 parm->col_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder);
85 } else if ( Paso_Distribution_getMyNumComponents(S->col_distribution)*S->col_block_size==parm->numComp* Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution)) {
86 parm->col_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution);
87 parm->col_DOF=nodes->reducedDegreesOfFreedomMapping->target;
88 parm->col_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);
89 } else {
90 Finley_setError(TYPE_ERROR,"Finley_Assemble_getAssembleParameters: number of columns in matrix does not match the number of degrees of freedom in mesh");
91 }
92 }
93 if (! Finley_noError()) return;
94 /* get the information from right hand side */
95 if (!isEmpty(F)) {
96 if (numSamplesEqual(F,1, Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution))) {
97 parm->row_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution);
98 parm->row_DOF=nodes->degreesOfFreedomMapping->target;
99 parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder);
100 }
101 else if (numSamplesEqual(F,1, 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=Finley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);
105 } else {
106 Finley_setError(TYPE_ERROR,"Finley_Assemble_getAssembleParameters: length of RHS vector does not match the number of degrees of freedom in mesh");
107 }
108 if (S==NULL) {
109 parm->col_DOF_UpperBound=parm->row_DOF_UpperBound;
110 parm->col_DOF=parm->row_DOF;
111 parm->col_jac=parm->row_jac;
112 }
113 }
114
115 numSub=MIN(parm->row_jac->numSub, parm->col_jac->numSub);
116 numQuadSub=parm->row_jac->numQuadTotal/numSub;
117 if ( parm->row_jac->numSides !=parm->col_jac->numSides) {
118 Finley_setError(TYPE_ERROR,"Finley_Assemble_getAssembleParameters: number of sides for row and column shape functions must match.");
119 }
120 if ( parm->row_jac->numDim !=parm->col_jac->numDim) {
121 Finley_setError(TYPE_ERROR,"Finley_Assemble_getAssembleParameters: spacial dimension for row and column shape function must match.");
122 }
123
124 if (elements->numNodes < parm->row_jac->numShapesTotal) {
125 Finley_setError(TYPE_ERROR,"Finley_Assemble_getAssembleParameters: too many nodes are expected by row.");
126 }
127 if (elements->numNodes < parm->row_jac->numShapesTotal) {
128 Finley_setError(TYPE_ERROR,"Finley_Assemble_getAssembleParameters: too many nodes are expected by col.");
129 }
130 if ( parm->row_jac->numElements !=elements->numElements) {
131 Finley_setError(TYPE_ERROR,"Finley_Assemble_getAssembleParameters: number of elements for row is wrong.");
132 }
133 if ( parm->col_jac->numElements !=elements->numElements) {
134 Finley_setError(TYPE_ERROR,"Finley_Assemble_getAssembleParameters: number of elements for column is wrong.");
135 }
136 if ( parm->row_jac->numQuadTotal !=parm->col_jac->numQuadTotal) {
137 Finley_setError(TYPE_ERROR,"Finley_Assemble_getAssembleParameters: number of quadrature points for row and column shape functions must match.");
138 }
139 /* to consider different basis function for rows and columns this will require some work :*/
140 if (numQuadSub * numSub != parm->row_jac->numQuadTotal) {
141 Finley_setError(TYPE_ERROR,"Finley_Assemble_getAssembleParameters: number of quadrature points for row is not correct.");
142 }
143 if (numQuadSub * numSub != parm->row_jac->numQuadTotal) {
144 Finley_setError(TYPE_ERROR,"Finley_Assemble_getAssembleParameters: number of quadrature points for column is not correct.");
145 }
146 if (numQuadSub != parm->row_jac->BasisFunctions->numQuadNodes) {
147 Finley_setError(TYPE_ERROR,"Finley_Assemble_getAssembleParameters: Incorrect number of quadrature points for row.");
148 }
149 if (numQuadSub != parm->col_jac->BasisFunctions->numQuadNodes) {
150 Finley_setError(TYPE_ERROR,"Finley_Assemble_getAssembleParameters: Incorrect number of quadrature points for row.");
151 }
152
153 parm->numQuadSub=numQuadSub;
154 parm->numSub=numSub;
155 parm->numQuadTotal=parm->row_jac->numQuadTotal;
156 parm->NN=elements->numNodes;
157 parm->numElements=elements->numElements;
158 parm->numDim=parm->row_jac->numDim;
159 parm->col_node=parm->col_jac->node_selection;
160 parm->row_node=parm->row_jac->node_selection;
161 parm->numSides=parm->row_jac->numSides;
162 parm->row_numShapesTotal=parm->row_jac->numShapesTotal;
163 parm->row_numShapes=parm->row_jac->BasisFunctions->Type->numShapes;
164 parm->col_numShapesTotal=parm->col_jac->numShapesTotal;
165 parm->col_numShapes=parm->col_jac->BasisFunctions->Type->numShapes;
166
167
168 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26