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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 797 by bcumming, Mon Jun 26 01:46:34 2006 UTC revision 798 by gross, Fri Aug 4 01:05:36 2006 UTC
# Line 27  Line 27 
27  /**************************************************************/  /**************************************************************/
28    
29  void Assemble_getAssembleParameters(Finley_NodeFile* nodes,Finley_ElementFile* elements,Paso_SystemMatrix* S,  void Assemble_getAssembleParameters(Finley_NodeFile* nodes,Finley_ElementFile* elements,Paso_SystemMatrix* S,
30                                          escriptDataC* F,Assemble_Parameters *parm) {                                          escriptDataC* F, bool_t reducedIntegrationOrder, Assemble_Parameters *parm) {
31    Finley_resetError();    Finley_resetError();
32    dim_t i;  
33    parm->NN=elements->ReferenceElement->Type->numNodes;    for (dim_t i=0;i<MAX_numNodes;i++) parm->id[i]=i;
   for (i=0;i<parm->NN;i++) parm->id[i]=i;  
   parm->NS=elements->ReferenceElement->Type->numShapes;  
   parm->referenceElement=elements->ReferenceElement;  
   parm->numQuad=parm->referenceElement->numQuadNodes;  
   parm->numDim=nodes->numDim;  
   parm->numElementDim=parm->referenceElement->Type->numDim;  
34    
35    if (!isEmpty(F) && !isExpanded(F) ) {    if (!isEmpty(F) && !isExpanded(F) ) {
36        Finley_setError(TYPE_ERROR,"__FILE__: Right hand side is not expanded.");        Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: Right hand side is not expanded.");
37        return;        return;
38    }    }
39    /*  check the dimensions of S and F */    /*  check the dimensions of S and F */
40    if (S!=NULL && !isEmpty(F)) {    if (S!=NULL && !isEmpty(F)) {
     if ( getDataPointSize(F)!=S->logical_row_block_size) {  
       Finley_setError(TYPE_ERROR,"__FILE__: matrix row block size and number of components of right hand side don't match.");  
       return;  
     }  
   
41      if (! numSamplesEqual(F,1,(S->num_rows*S->row_block_size)/S->logical_row_block_size)) {      if (! numSamplesEqual(F,1,(S->num_rows*S->row_block_size)/S->logical_row_block_size)) {
42        Finley_setError(TYPE_ERROR,"__FILE__: number of rows of matrix and length of right hand side don't match.");        Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of rows of matrix and length of right hand side don't match.");
43        return;        return;
44      }      }
45    }    }
46    /* get the number of equations and components */    /* get the number of equations and components */
47    if (S!=NULL) {    if (S==NULL) {
48      parm->numEqu=S->logical_row_block_size;       if (isEmpty(F)) {
49      parm->numComp=S->logical_col_block_size;          parm->numEqu=1;
50            parm->numComp=1;
51         } else {
52            parm->numEqu=getDataPointSize(F);
53            parm->numComp=parm->numEqu;
54         }
55    } else {    } else {
56      parm->numEqu=1;       if (isEmpty(F)) {
57      parm->numComp=1;          parm->numEqu=S->logical_row_block_size;
58            parm->numComp=S->logical_col_block_size;
59         } else {
60            if ( getDataPointSize(F)!=S->logical_row_block_size) {
61              Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: matrix row block size and number of components of right hand side don't match.");
62              return;
63            }
64            parm->numEqu=S->logical_row_block_size;
65            parm->numComp=S->logical_col_block_size;
66         }
67    }    }
68    if (!isEmpty(F)) parm->numEqu=getDataPointSize(F);  
69        parm->col_DOF=nodes->degreeOfFreedom;
70    parm->label_col=nodes->degreeOfFreedom;    parm->row_DOF=nodes->degreeOfFreedom;
71    parm->label_row=nodes->degreeOfFreedom;    /* get the information for the labeling of the degrees of freedom from matrix */
   parm->referenceElement_row=elements->ReferenceElement;  
   parm->referenceElement_col=elements->ReferenceElement;  
   /* get the information for the labeling of the degrees of freedom */  
72    if (S!=NULL) {    if (S!=NULL) {
73  #ifndef PASO_MPI  #ifndef PASO_MPI
74        if (S->num_rows*S->row_block_size==parm->numEqu*nodes->numDegreesOfFreedom) {        if (S->num_rows*S->row_block_size==parm->numEqu*nodes->numDegreesOfFreedom) {
75               parm->row_DOF_UpperBound = nodes->numDegreesOfFreedom;
76  #else  #else
77        if (S->num_rows*S->row_block_size==parm->numEqu*nodes->degreeOfFreedomDistribution->numLocal) {        if (S->num_rows*S->row_block_size==parm->numEqu*nodes->degreeOfFreedomDistribution->numLocal) {
78             parm->degreeOfFreedomUpperBound = nodes->degreeOfFreedomDistribution->numLocal;             parm->row_DOF_UpperBound = nodes->degreeOfFreedomDistribution->numLocal;
79  #endif  #endif
80             parm->label_row=nodes->degreeOfFreedom;             parm->row_DOF=nodes->degreeOfFreedom;
81             parm->row_node=&(parm->id[0]);             parm->row_node=&(parm->id[0]);
82             parm->referenceElement_row=elements->ReferenceElement;             parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder);
83        }        }
84  #ifndef PASO_MPI  #ifndef PASO_MPI
85        else if (S->num_rows*S->row_block_size==parm->numEqu*nodes->reducedNumDegreesOfFreedom) {        else if (S->num_rows*S->row_block_size==parm->numEqu*nodes->reducedNumDegreesOfFreedom) {
86               parm->row_DOF_UpperBound = nodes->reducedNumDegreesOfFreedom;
87  #else  #else
88        else if (S->num_rows*S->row_block_size==parm->numEqu*nodes->reducedDegreeOfFreedomDistribution->numLocal) {        else if (S->num_rows*S->row_block_size==parm->numEqu*nodes->reducedDegreeOfFreedomDistribution->numLocal) {
89             parm->degreeOfFreedomUpperBound = nodes->reducedDegreeOfFreedomDistribution->numLocal;             parm->row_DOF_UpperBound = nodes->reducedDegreeOfFreedomDistribution->numLocal;
90  #endif  #endif
91             parm->label_row=nodes->reducedDegreeOfFreedom;             parm->row_DOF=nodes->reducedDegreeOfFreedom;
92             parm->row_node=parm->referenceElement->Type->linearNodes;             parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);
93             parm->referenceElement_row=elements->LinearReferenceElement;             parm->row_node=parm->row_jac->ReferenceElement->Type->linearNodes;
94        } else {        } else {
95             Finley_setError(TYPE_ERROR,"__FILE__: number of rows in matrix does not match the number of degrees of freedom in mesh");             Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of rows in matrix does not match the number of degrees of freedom in mesh");
            return;  
96        }        }
97  #ifndef PASO_MPI        #ifndef PASO_MPI      
98        if (S->num_cols*S->col_block_size==parm->numComp*nodes->numDegreesOfFreedom) {        if (S->num_cols*S->col_block_size==parm->numComp*nodes->numDegreesOfFreedom) {
99               parm->col_DOF_UpperBound = nodes->numDegreesOfFreedom;
100  #else  #else
101        if (S->num_cols*S->col_block_size==parm->numComp*nodes->degreeOfFreedomDistribution->numLocal) {        if (S->num_cols*S->col_block_size==parm->numComp*nodes->degreeOfFreedomDistribution->numLocal) {
102             parm->degreeOfFreedomUpperBound = nodes->degreeOfFreedomDistribution->numLocal;             parm->col_DOF_UpperBound = nodes->degreeOfFreedomDistribution->numLocal;
103  #endif  #endif
104             parm->label_col=nodes->degreeOfFreedom;             parm->col_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder);
105               parm->col_DOF=nodes->degreeOfFreedom;
106             parm->col_node=&(parm->id[0]);             parm->col_node=&(parm->id[0]);
            parm->referenceElement_col=elements->ReferenceElement;  
107        }        }
108  #ifndef PASO_MPI  #ifndef PASO_MPI
109        else if (S->num_cols*S->col_block_size==parm->numComp*nodes->reducedNumDegreesOfFreedom) {        else if (S->num_cols*S->col_block_size==parm->numComp*nodes->reducedNumDegreesOfFreedom) {
110               parm->col_DOF_UpperBound = nodes->reducedNumDegreesOfFreedom;
111  #else  #else
112        else if (S->num_cols*S->col_block_size==parm->numComp*nodes->reducedDegreeOfFreedomDistribution->numLocal) {        else if (S->num_cols*S->col_block_size==parm->numComp*nodes->reducedDegreeOfFreedomDistribution->numLocal) {
113             parm->degreeOfFreedomUpperBound = nodes->reducedDegreeOfFreedomDistribution->numLocal;             parm->col_DOF_UpperBound = nodes->reducedDegreeOfFreedomDistribution->numLocal;
114  #endif  #endif
115             parm->label_col=nodes->reducedDegreeOfFreedom;             parm->col_DOF=nodes->reducedDegreeOfFreedom;
116             parm->col_node=parm->referenceElement->Type->linearNodes;             parm->col_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);
117             parm->referenceElement_col=elements->LinearReferenceElement;             parm->col_node=parm->row_jac->ReferenceElement->Type->linearNodes;
118        } else {        } else {
119             Finley_setError(TYPE_ERROR,"__FILE__: number of columns in matrix does not match the number of degrees of freedom in mesh");             Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of columns in matrix does not match the number of degrees of freedom in mesh");
            return;  
120        }        }
121    }    }
122      if (! Finley_noError()) return;
123      /* get the information from right hand side */
124    if (!isEmpty(F)) {    if (!isEmpty(F)) {
125  #ifndef PASO_MPI  #ifndef PASO_MPI
126        if (numSamplesEqual(F,1,nodes->numDegreesOfFreedom)) {        if (numSamplesEqual(F,1,nodes->numDegreesOfFreedom)) {
127               parm->row_DOF_UpperBound=nodes->numDegreesOfFreedom;
128  #else  #else
129        if (numSamplesEqual(F,1,nodes->degreeOfFreedomDistribution->numLocal)) {        if (numSamplesEqual(F,1,nodes->degreeOfFreedomDistribution->numLocal)) {
130             parm->degreeOfFreedomUpperBound = nodes->degreeOfFreedomDistribution->numLocal;             parm->row_DOF_UpperBound = nodes->degreeOfFreedomDistribution->numLocal;
131  #endif  #endif
132               parm->row_DOF=nodes->degreeOfFreedom;
133               parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder);
134             parm->row_node=&(parm->id[0]);             parm->row_node=&(parm->id[0]);
            parm->label_row=nodes->degreeOfFreedom;  
            parm->referenceElement_row=elements->ReferenceElement;  
135        }        }
136  #ifndef PASO_MPI  #ifndef PASO_MPI
137        else if (numSamplesEqual(F,1,nodes->reducedNumDegreesOfFreedom)) {        else if (numSamplesEqual(F,1,nodes->reducedNumDegreesOfFreedom)) {
138               parm->row_DOF_UpperBound=nodes->reducedNumDegreesOfFreedom;
139  #else  #else
140        else if (numSamplesEqual(F,1,nodes->reducedDegreeOfFreedomDistribution->numLocal)) {        else if (numSamplesEqual(F,1,nodes->reducedDegreeOfFreedomDistribution->numLocal)) {
141             parm->degreeOfFreedomUpperBound = nodes->reducedDegreeOfFreedomDistribution->numLocal;             parm->row_DOF_UpperBound = nodes->reducedDegreeOfFreedomDistribution->numLocal;
142  #endif  #endif
143             parm->label_row=nodes->reducedDegreeOfFreedom;             parm->row_DOF=nodes->reducedDegreeOfFreedom;
144             parm->row_node=parm->referenceElement->Type->linearNodes;             parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);
145             parm->referenceElement_row=elements->LinearReferenceElement;             parm->row_node=parm->row_jac->ReferenceElement->Type->linearNodes;
146        } else {        } else {
147             Finley_setError(TYPE_ERROR,"__FILE__: length of RHS vector does not match the number of degrees of freedom in mesh");             Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: length of RHS vector does not match the number of degrees of freedom in mesh");
            return;  
148        }        }
149        if (S==NULL) {        if (S==NULL) {
150             parm->label_col=parm->label_row;             parm->col_DOF_UpperBound=parm->row_DOF_UpperBound;
151               parm->col_DOF=parm->row_DOF;
152             parm->col_node=parm->row_node;             parm->col_node=parm->row_node;
153             parm->referenceElement_col=parm->referenceElement_row;             parm->col_jac=parm->row_jac;
154        }        }
155    }    }
156    if (parm->referenceElement_row!=parm->referenceElement_col) {    if (! Finley_noError()) return;
157        Finley_setError(TYPE_ERROR,"__FILE__: assemblage cannot handle different shape functions for rows and columns (yet).");    if (parm->row_jac!=parm->col_jac) {
158        return;        Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: assemblage cannot handle different shape functions for rows and columns (yet).");
159    }    }
160    parm->NN_row=parm->referenceElement_row->Type->numNodes;    if (! Finley_noError()) return;
161    parm->NS_row=parm->referenceElement_row->Type->numShapes;    parm->NN=elements->ReferenceElement->Type->numNodes;
162    parm->NN_col=parm->referenceElement_col->Type->numNodes;    parm->numDim=parm->row_jac->numDim;
163    parm->NS_col=parm->referenceElement_col->Type->numShapes;    parm->numQuad=parm->row_jac->ReferenceElement->numQuadNodes;
164      parm->row_NN=parm->row_jac->ReferenceElement->Type->numNodes;
165      parm->row_NS=parm->row_jac->ReferenceElement->Type->numShapes;
166      parm->col_NN=parm->col_jac->ReferenceElement->Type->numNodes;
167      parm->col_NS=parm->col_jac->ReferenceElement->Type->numShapes;
168  }  }
169    
170  /*  /*

Legend:
Removed from v.797  
changed lines
  Added in v.798

  ViewVC Help
Powered by ViewVC 1.1.26