/[escript]/branches/domexper/dudley/src/Assemble_getAssembleParameters.c
ViewVC logotype

Contents of /branches/domexper/dudley/src/Assemble_getAssembleParameters.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3204 - (show annotations)
Thu Sep 23 23:59:39 2010 UTC (8 years, 11 months ago) by jfenwick
File MIME type: text/plain
File size: 7836 byte(s)
More params collapsed

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 #include "ShapeTable.h"
23
24 /**************************************************************/
25
26 void Assemble_getAssembleParameters(Dudley_NodeFile* nodes,Dudley_ElementFile* elements,Paso_SystemMatrix* S,
27 escriptDataC* F, bool_t reducedIntegrationOrder, Assemble_Parameters *parm) {
28 Dudley_resetError();
29 parm->reducedIntegrationOrder=reducedIntegrationOrder;
30 parm->shapeFns=NULL;
31 if (!isEmpty(F) && !isExpanded(F) ) {
32 Dudley_setError(TYPE_ERROR,"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, "Assemble_getAssembleParameters: Can not locate shape functions.");
39 }
40 /* check the dimensions of S and F */
41 if (S!=NULL && !isEmpty(F)) {
42 if (! numSamplesEqual(F,1,(Paso_Distribution_getMyNumComponents(S->row_distribution)*S->row_block_size)/S->logical_row_block_size)) {
43 Dudley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of rows of matrix and length of right hand side don't match.");
44 return;
45 }
46 }
47 /* get the number of equations and components */
48 if (S==NULL) {
49 if (isEmpty(F)) {
50 parm->numEqu=1;
51 parm->numComp=1;
52 } else {
53 parm->numEqu=getDataPointSize(F);
54 parm->numComp=parm->numEqu;
55 }
56 } else {
57 if (isEmpty(F)) {
58 parm->numEqu=S->logical_row_block_size;
59 parm->numComp=S->logical_col_block_size;
60 } else {
61 if ( getDataPointSize(F)!=S->logical_row_block_size) {
62 Dudley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: matrix row block size and number of components of right hand side don't match.");
63 return;
64 }
65 parm->numEqu=S->logical_row_block_size;
66 parm->numComp=S->logical_col_block_size;
67 }
68 }
69 parm->col_DOF=nodes->degreesOfFreedomMapping->target;
70 parm->row_DOF=nodes->degreesOfFreedomMapping->target;
71 /* get the information for the labeling of the degrees of freedom from matrix */
72 if (S!=NULL) {
73 /* Make sure # rows in matrix == num DOF for one of: full or reduced (use numLocalDOF for MPI) */
74 if ( Paso_Distribution_getMyNumComponents(S->row_distribution)*S->row_block_size==parm->numEqu* Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution)) {
75 parm->row_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution);
76 parm->row_DOF=nodes->degreesOfFreedomMapping->target;
77 parm->row_jac=Dudley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder);
78 }
79 else if ( Paso_Distribution_getMyNumComponents(S->row_distribution)*S->row_block_size==parm->numEqu* Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution)) {
80 parm->row_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution);
81 parm->row_DOF=nodes->reducedDegreesOfFreedomMapping->target;
82 parm->row_jac=Dudley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);
83 } else {
84 Dudley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of rows in matrix does not match the number of degrees of freedom in mesh");
85 }
86 /* Make sure # cols in matrix == num DOF for one of: full or reduced (use numLocalDOF for MPI) */
87 if ( Paso_Distribution_getMyNumComponents(S->col_distribution)*S->col_block_size==parm->numComp* Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution)) {
88 parm->col_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution);
89 parm->col_DOF=nodes->degreesOfFreedomMapping->target;
90 parm->row_jac=Dudley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder);
91 } else if ( Paso_Distribution_getMyNumComponents(S->col_distribution)*S->col_block_size==parm->numComp* Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution)) {
92 parm->col_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution);
93 parm->col_DOF=nodes->reducedDegreesOfFreedomMapping->target;
94 parm->row_jac=Dudley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);
95 } else {
96 Dudley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of columns in matrix does not match the number of degrees of freedom in mesh");
97 }
98 }
99 if (! Dudley_noError()) return;
100 /* get the information from right hand side */
101 if (!isEmpty(F)) {
102 if (numSamplesEqual(F,1, Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution))) {
103 parm->row_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution);
104 parm->row_DOF=nodes->degreesOfFreedomMapping->target;
105 parm->row_jac=Dudley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder);
106 }
107 else if (numSamplesEqual(F,1, Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution))) {
108 parm->row_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution);
109 parm->row_DOF=nodes->reducedDegreesOfFreedomMapping->target;
110 parm->row_jac=Dudley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);
111 } else {
112 Dudley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: length of RHS vector does not match the number of degrees of freedom in mesh");
113 }
114 if (S==NULL) {
115 parm->col_DOF_UpperBound=parm->row_DOF_UpperBound;
116 parm->col_DOF=parm->row_DOF;
117 parm->row_jac=parm->row_jac;
118 }
119 }
120
121 if ( parm->row_jac->numDim !=parm->row_jac->numDim) {
122 Dudley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: spacial dimension for row and column shape function must match.");
123 }
124
125 if (elements->numNodes < parm->row_jac->numShapes) {
126 Dudley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: too many nodes are expected by row.");
127 }
128 if (elements->numNodes < parm->row_jac->numShapes) {
129 Dudley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: too many nodes are expected by col.");
130 }
131 if ( parm->row_jac->numElements !=elements->numElements) {
132 Dudley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of elements for row is wrong.");
133 }
134 if ( parm->row_jac->numElements !=elements->numElements) {
135 Dudley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of elements for column is wrong.");
136 }
137 if ( parm->row_jac->numQuadTotal !=parm->row_jac->numQuadTotal) {
138 Dudley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of quadrature points for row and column shape functions must match.");
139 }
140
141 parm->numQuadTotal=parm->row_jac->numQuadTotal;
142 parm->NN=elements->numNodes;
143 parm->numElements=elements->numElements;
144 parm->numDim=parm->row_jac->numDim;
145 parm->numShapes=parm->row_jac->numShapes;
146 // parm->numShapes=parm->row_jac->BasisFunctions->Type->numShapes;
147
148
149 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26