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

Contents of /trunk-mpi-branch/finley/src/Assemble_getAssembleParameters.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1223 - (show annotations)
Fri Aug 3 02:40:39 2007 UTC (11 years, 8 months ago) by gross
File MIME type: text/plain
File size: 7680 byte(s)
first attemt towards an improved MPI version.  

1 /*
2 ************************************************************
3 * Copyright 2006 by ACcESS MNRF *
4 * *
5 * http://www.access.edu.au *
6 * Primary Business: Queensland, Australia *
7 * Licensed under the Open Software License version 3.0 *
8 * http://www.opensource.org/licenses/osl-3.0.php *
9 * *
10 ************************************************************
11 */
12
13 /**************************************************************/
14
15 /* assemblage routines: prepares the assemble parameter set */
16
17 /**************************************************************/
18
19 /* Copyrights by ACcESS Australia, 2003,2004,2005 */
20 /* author: gross@access.edu.au */
21 /* Version: $Id$ */
22
23 /**************************************************************/
24
25 #include "Assemble.h"
26
27 /**************************************************************/
28
29 void Assemble_getAssembleParameters(Finley_NodeFile* nodes,Finley_ElementFile* elements,Paso_SystemMatrix* S,
30 escriptDataC* F, bool_t reducedIntegrationOrder, Assemble_Parameters *parm) {
31 dim_t i;
32 Finley_resetError();
33
34 for (i=0;i<MAX_numNodes;i++) parm->id[i]=i;
35
36 if (!isEmpty(F) && !isExpanded(F) ) {
37 Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: Right hand side is not expanded.");
38 return;
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 Finley_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 Finley_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
70 parm->col_DOF=nodes->degreesOfFreedomMapping->target;
71 parm->row_DOF=nodes->degreesOfFreedomMapping->target;
72 /* get the information for the labeling of the degrees of freedom from matrix */
73 if (S!=NULL) {
74 /* Make sure # rows in matrix == num DOF for one of: full or reduced (use numLocalDOF for MPI) */
75 if ( Paso_Distribution_getMyNumComponents(S->row_distribution)*S->row_block_size==parm->numEqu* Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution)) {
76 parm->row_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution);
77 parm->row_DOF=nodes->degreesOfFreedomMapping->target;
78
79 parm->row_node=&(parm->id[0]);
80 parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder);
81 }
82 else if ( Paso_Distribution_getMyNumComponents(S->row_distribution)*S->row_block_size==parm->numEqu* Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution)) {
83 parm->row_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution);
84 parm->row_DOF=nodes->reducedDegreesOfFreedomMapping->target;
85 parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);
86 parm->row_node=parm->row_jac->ReferenceElement->Type->linearNodes;
87 } else {
88 Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of rows in matrix does not match the number of degrees of freedom in mesh");
89 }
90 /* Make sure # cols in matrix == num DOF for one of: full or reduced (use numLocalDOF for MPI) */
91 if ( Paso_Distribution_getMyNumComponents(S->col_distribution)*S->col_block_size==parm->numComp* Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution)) {
92 parm->col_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution);
93 parm->col_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder);
94 parm->col_DOF=nodes->degreesOfFreedomMapping->target;
95 parm->col_node=&(parm->id[0]);
96 }
97 else if ( Paso_Distribution_getMyNumComponents(S->col_distribution)*S->col_block_size==parm->numComp* Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution)) {
98 parm->col_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution);
99 parm->col_DOF=nodes->reducedDegreesOfFreedomMapping->target;
100 parm->col_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);
101 parm->col_node=parm->row_jac->ReferenceElement->Type->linearNodes;
102 } else {
103 Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of columns in matrix does not match the number of degrees of freedom in mesh");
104 }
105 }
106 if (! Finley_noError()) return;
107 /* get the information from right hand side */
108 if (!isEmpty(F)) {
109 if (numSamplesEqual(F,1, Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution))) {
110 parm->row_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution);
111 parm->row_DOF=nodes->degreesOfFreedomMapping->target;
112 parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder);
113 parm->row_node=&(parm->id[0]);
114 }
115 else if (numSamplesEqual(F,1, Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution))) {
116 parm->row_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution);
117 parm->row_DOF=nodes->reducedDegreesOfFreedomMapping->target;
118 parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);
119 parm->row_node=parm->row_jac->ReferenceElement->Type->linearNodes;
120 } else {
121 Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: length of RHS vector does not match the number of degrees of freedom in mesh");
122 }
123 if (S==NULL) {
124 parm->col_DOF_UpperBound=parm->row_DOF_UpperBound;
125 parm->col_DOF=parm->row_DOF;
126 parm->col_node=parm->row_node;
127 parm->col_jac=parm->row_jac;
128 }
129 }
130 if (! Finley_noError()) return;
131 if (parm->row_jac!=parm->col_jac) {
132 Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: assemblage cannot handle different shape functions for rows and columns (yet).");
133 }
134 if (! Finley_noError()) return;
135 parm->NN=elements->ReferenceElement->Type->numNodes;
136 parm->numDim=parm->row_jac->numDim;
137 parm->numQuad=parm->row_jac->ReferenceElement->numQuadNodes;
138 parm->row_NN=parm->row_jac->ReferenceElement->Type->numNodes;
139 parm->row_NS=parm->row_jac->ReferenceElement->Type->numShapes;
140 parm->col_NN=parm->col_jac->ReferenceElement->Type->numNodes;
141 parm->col_NS=parm->col_jac->ReferenceElement->Type->numShapes;
142 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26