/[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 1312 - (show annotations)
Mon Sep 24 06:18:44 2007 UTC (11 years, 11 months ago) by ksteube
File MIME type: text/plain
File size: 7375 byte(s)
The MPI branch is hereby closed. All future work should be in trunk.

Previously in revision 1295 I merged the latest changes to trunk into trunk-mpi-branch.
In this revision I copied all files from trunk-mpi-branch over the corresponding
trunk files. I did not use 'svn merge', it was a copy.

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26