/[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 1811 - (show annotations)
Thu Sep 25 23:11:13 2008 UTC (11 years, 1 month ago) by ksteube
File MIME type: text/plain
File size: 7340 byte(s)
Copyright updated in all files

1
2 /*******************************************************
3 *
4 * Copyright (c) 2003-2008 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 Assemble_getAssembleParameters(Finley_NodeFile* nodes,Finley_ElementFile* elements,Paso_SystemMatrix* S,
26 escriptDataC* F, bool_t reducedIntegrationOrder, Assemble_Parameters *parm) {
27 dim_t i;
28 Finley_resetError();
29
30 for (i=0;i<MAX_numNodes;i++) parm->id[i]=i;
31
32 if (!isEmpty(F) && !isExpanded(F) ) {
33 Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: Right hand side is not expanded.");
34 return;
35 }
36 /* check the dimensions of S and F */
37 if (S!=NULL && !isEmpty(F)) {
38 if (! numSamplesEqual(F,1,(Paso_Distribution_getMyNumComponents(S->row_distribution)*S->row_block_size)/S->logical_row_block_size)) {
39 Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of rows of matrix and length of right hand side don't match.");
40 return;
41 }
42 }
43 /* get the number of equations and components */
44 if (S==NULL) {
45 if (isEmpty(F)) {
46 parm->numEqu=1;
47 parm->numComp=1;
48 } else {
49 parm->numEqu=getDataPointSize(F);
50 parm->numComp=parm->numEqu;
51 }
52 } else {
53 if (isEmpty(F)) {
54 parm->numEqu=S->logical_row_block_size;
55 parm->numComp=S->logical_col_block_size;
56 } else {
57 if ( getDataPointSize(F)!=S->logical_row_block_size) {
58 Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: matrix row block size and number of components of right hand side don't match.");
59 return;
60 }
61 parm->numEqu=S->logical_row_block_size;
62 parm->numComp=S->logical_col_block_size;
63 }
64 }
65
66 parm->col_DOF=nodes->degreesOfFreedomMapping->target;
67 parm->row_DOF=nodes->degreesOfFreedomMapping->target;
68 /* get the information for the labeling of the degrees of freedom from matrix */
69 if (S!=NULL) {
70 /* Make sure # rows in matrix == num DOF for one of: full or reduced (use numLocalDOF for MPI) */
71 if ( Paso_Distribution_getMyNumComponents(S->row_distribution)*S->row_block_size==parm->numEqu* Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution)) {
72 parm->row_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution);
73 parm->row_DOF=nodes->degreesOfFreedomMapping->target;
74
75 parm->row_node=&(parm->id[0]);
76 parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder);
77 }
78 else if ( Paso_Distribution_getMyNumComponents(S->row_distribution)*S->row_block_size==parm->numEqu* Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution)) {
79 parm->row_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution);
80 parm->row_DOF=nodes->reducedDegreesOfFreedomMapping->target;
81 parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);
82 parm->row_node=parm->row_jac->ReferenceElement->Type->linearNodes;
83 } else {
84 Finley_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_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder);
90 parm->col_DOF=nodes->degreesOfFreedomMapping->target;
91 parm->col_node=&(parm->id[0]);
92 }
93 else if ( Paso_Distribution_getMyNumComponents(S->col_distribution)*S->col_block_size==parm->numComp* Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution)) {
94 parm->col_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution);
95 parm->col_DOF=nodes->reducedDegreesOfFreedomMapping->target;
96 parm->col_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);
97 parm->col_node=parm->row_jac->ReferenceElement->Type->linearNodes;
98 } else {
99 Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of columns in matrix does not match the number of degrees of freedom in mesh");
100 }
101 }
102 if (! Finley_noError()) return;
103 /* get the information from right hand side */
104 if (!isEmpty(F)) {
105 if (numSamplesEqual(F,1, Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution))) {
106 parm->row_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution);
107 parm->row_DOF=nodes->degreesOfFreedomMapping->target;
108 parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder);
109 parm->row_node=&(parm->id[0]);
110 }
111 else if (numSamplesEqual(F,1, Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution))) {
112 parm->row_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution);
113 parm->row_DOF=nodes->reducedDegreesOfFreedomMapping->target;
114 parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);
115 parm->row_node=parm->row_jac->ReferenceElement->Type->linearNodes;
116 } else {
117 Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: length of RHS vector does not match the number of degrees of freedom in mesh");
118 }
119 if (S==NULL) {
120 parm->col_DOF_UpperBound=parm->row_DOF_UpperBound;
121 parm->col_DOF=parm->row_DOF;
122 parm->col_node=parm->row_node;
123 parm->col_jac=parm->row_jac;
124 }
125 }
126 if (! Finley_noError()) return;
127 if (parm->row_jac!=parm->col_jac) {
128 Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: assemblage cannot handle different shape functions for rows and columns (yet).");
129 }
130 if (! Finley_noError()) return;
131 parm->NN=elements->ReferenceElement->Type->numNodes;
132 parm->numDim=parm->row_jac->numDim;
133 parm->numQuad=parm->row_jac->ReferenceElement->numQuadNodes;
134 parm->row_NN=parm->row_jac->ReferenceElement->Type->numNodes;
135 parm->row_NS=parm->row_jac->ReferenceElement->Type->numShapes;
136 parm->col_NN=parm->col_jac->ReferenceElement->Type->numNodes;
137 parm->col_NS=parm->col_jac->ReferenceElement->Type->numShapes;
138 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26