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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 82 - (hide annotations)
Tue Oct 26 06:53:54 2004 UTC (15 years, 4 months ago) by jgs
Original Path: trunk/esys2/finley/src/finleyC/Assemble_getAssembleParameters.c
File MIME type: text/plain
File size: 5443 byte(s)
Initial revision

1 jgs 82 /* $Id$ */
2    
3     /**************************************************************/
4    
5     /* assemblage routines: prepares the assemble parameter set */
6    
7     /**************************************************************/
8    
9     /* Copyrights by ACcESS Australia, 2003,2004 */
10     /* author: gross@access.edu.au */
11     /* Version: $Id$ */
12    
13     /**************************************************************/
14    
15     #include "escript/Data/DataC.h"
16     #include "Finley.h"
17     #include "Assemble.h"
18     #include "NodeFile.h"
19     #include "ElementFile.h"
20    
21     /**************************************************************/
22    
23     void Assemble_getAssembleParameters(Finley_NodeFile* nodes,Finley_ElementFile* elements,Finley_SystemMatrix* S,
24     escriptDataC* F,Assemble_Parameters *parm) {
25     int i;
26     parm->NN=elements->ReferenceElement->Type->numNodes;
27     for (i=0;i<parm->NN;i++) parm->id[i]=i;
28     parm->NS=elements->ReferenceElement->Type->numShapes;
29     parm->referenceElement=elements->ReferenceElement;
30     parm->numQuad=parm->referenceElement->numQuadNodes;
31     parm->numDim=nodes->numDim;
32     parm->numElementDim=parm->referenceElement->Type->numDim;
33    
34     if (!isExpanded(F) ) {
35     Finley_ErrorCode=TYPE_ERROR;
36     sprintf(Finley_ErrorMsg,"Right hand side is not expanded.");
37     return;
38     }
39     /* check the dimensions of S and F */
40     if (S!=NULL && !isEmpty(F)) {
41     if ( getDataPointSize(F)!=S->total_row_block_size) {
42     Finley_ErrorCode=TYPE_ERROR;
43     sprintf(Finley_ErrorMsg,"matrix rows and number of components of right hand side don't match.");
44     return;
45     }
46     if (! numSamplesEqual(F,1,S->num_rows*S->row_block_size)) {
47     Finley_ErrorCode=TYPE_ERROR;
48     sprintf(Finley_ErrorMsg,"number of rows of matrix and length of right hand side don't match.");
49     return;
50     }
51     }
52     /* get the number of equations and components */
53     if (S!=NULL) {
54     parm->numEqu=S->total_row_block_size;
55     parm->numComp=S->total_col_block_size;
56     } else {
57     parm->numEqu=1;
58     parm->numComp=1;
59     }
60     if (!isEmpty(F)) parm->numEqu=getDataPointSize(F);
61    
62     parm->label_col=nodes->degreeOfFreedom;
63     parm->label_row=nodes->degreeOfFreedom;
64     parm->referenceElement_row=elements->ReferenceElement;
65     parm->referenceElement_col=elements->ReferenceElement;
66     /* get the information for the labeling of the degrees of freedom */
67     if (S!=NULL) {
68     if (S->num_rows*S->row_block_size==parm->numEqu*nodes->numDegreesOfFreedom) {
69     parm->label_row=nodes->degreeOfFreedom;
70     parm->row_node=&(parm->id[0]);
71     parm->referenceElement_row=elements->ReferenceElement;
72     } else if (S->num_rows*S->row_block_size==parm->numEqu*nodes->reducedNumDegreesOfFreedom) {
73     parm->label_row=nodes->reducedDegreeOfFreedom;
74     parm->row_node=parm->referenceElement->Type->linearNodes;
75     parm->referenceElement_row=elements->LinearReferenceElement;
76     } else {
77     Finley_ErrorCode=TYPE_ERROR;
78     sprintf(Finley_ErrorMsg,"number of rows in matrix does not match the number of degrees of freedom in mesh");
79     return;
80     }
81     if (S->num_cols*S->col_block_size==parm->numComp*nodes->numDegreesOfFreedom) {
82     parm->label_col=nodes->degreeOfFreedom;
83     parm->col_node=&(parm->id[0]);
84     parm->referenceElement_col=elements->ReferenceElement;
85     } else if (S->num_cols*S->col_block_size==parm->numComp*nodes->reducedNumDegreesOfFreedom) {
86     parm->label_col=nodes->reducedDegreeOfFreedom;
87     parm->col_node=parm->referenceElement->Type->linearNodes;
88     parm->referenceElement_col=elements->LinearReferenceElement;
89     } else {
90     Finley_ErrorCode=TYPE_ERROR;
91     sprintf(Finley_ErrorMsg,"number of columns in matrix does not match the number of degrees of freedom in mesh");
92     return;
93     }
94     }
95     if (!isEmpty(F)) {
96     if (numSamplesEqual(F,1,nodes->numDegreesOfFreedom)) {
97     parm->row_node=&(parm->id[0]);
98     parm->label_row=nodes->degreeOfFreedom;
99     parm->referenceElement_row=elements->ReferenceElement;
100     } else if (numSamplesEqual(F,1,nodes->reducedNumDegreesOfFreedom)) {
101     parm->label_row=nodes->reducedDegreeOfFreedom;
102     parm->row_node=parm->referenceElement->Type->linearNodes;
103     parm->referenceElement_row=elements->LinearReferenceElement;
104     } else {
105     Finley_ErrorCode=TYPE_ERROR;
106     sprintf(Finley_ErrorMsg,"length of RHS vector does not match the number of degrees of freedom in mesh");
107     return;
108     }
109     if (S==NULL) {
110     parm->label_col=parm->label_row;
111     parm->col_node=parm->row_node;
112     parm->referenceElement_col=parm->referenceElement_row;
113     }
114     }
115     if (parm->referenceElement_row!=parm->referenceElement_col) {
116     Finley_ErrorCode=TYPE_ERROR;
117     sprintf(Finley_ErrorMsg,"assemblage cannot handel different shape functions for rows and columns (yet).");
118     return;
119     }
120     parm->NN_row=parm->referenceElement_row->Type->numNodes;
121     parm->NS_row=parm->referenceElement_row->Type->numShapes;
122     parm->NN_col=parm->referenceElement_col->Type->numNodes;
123     parm->NS_col=parm->referenceElement_col->Type->numShapes;
124     }
125    
126     /*
127     * $Log$
128     * Revision 1.1 2004/10/26 06:53:57 jgs
129     * Initial revision
130     *
131     * Revision 1.2 2004/07/21 05:00:54 gross
132     * name changes in DataC
133     *
134     * Revision 1.1 2004/07/02 04:21:13 gross
135     * Finley C code has been included
136     *
137     *
138     */
139    

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26