/[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 2747 by jfenwick, Mon Jul 20 06:20:06 2009 UTC revision 2748 by gross, Tue Nov 17 07:32:59 2009 UTC
# Line 24  Line 24 
24    
25  void Assemble_getAssembleParameters(Finley_NodeFile* nodes,Finley_ElementFile* elements,Paso_SystemMatrix* S,  void Assemble_getAssembleParameters(Finley_NodeFile* nodes,Finley_ElementFile* elements,Paso_SystemMatrix* S,
26                                          escriptDataC* F, bool_t reducedIntegrationOrder, Assemble_Parameters *parm) {                                          escriptDataC* F, bool_t reducedIntegrationOrder, Assemble_Parameters *parm) {
27    dim_t i;    dim_t  numSub,  numQuadSub;
28    Finley_resetError();    Finley_resetError();
29      
   for (i=0;i<MAX_numNodes;i++) parm->id[i]=i;  
   
30    if (!isEmpty(F) && !isExpanded(F) ) {    if (!isEmpty(F) && !isExpanded(F) ) {
31        Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: Right hand side is not expanded.");        Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: Right hand side is not expanded.");
32        return;        return;
# Line 62  void Assemble_getAssembleParameters(Finl Line 60  void Assemble_getAssembleParameters(Finl
60          parm->numComp=S->logical_col_block_size;          parm->numComp=S->logical_col_block_size;
61       }       }
62    }    }
   
63    parm->col_DOF=nodes->degreesOfFreedomMapping->target;    parm->col_DOF=nodes->degreesOfFreedomMapping->target;
64    parm->row_DOF=nodes->degreesOfFreedomMapping->target;    parm->row_DOF=nodes->degreesOfFreedomMapping->target;
65    /* get the information for the labeling of the degrees of freedom from matrix */    /* get the information for the labeling of the degrees of freedom from matrix */
# Line 71  void Assemble_getAssembleParameters(Finl Line 68  void Assemble_getAssembleParameters(Finl
68        if ( Paso_Distribution_getMyNumComponents(S->row_distribution)*S->row_block_size==parm->numEqu* Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution)) {        if ( Paso_Distribution_getMyNumComponents(S->row_distribution)*S->row_block_size==parm->numEqu* Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution)) {
69             parm->row_DOF_UpperBound =  Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution);             parm->row_DOF_UpperBound =  Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution);
70             parm->row_DOF=nodes->degreesOfFreedomMapping->target;             parm->row_DOF=nodes->degreesOfFreedomMapping->target;
   
            parm->row_node=&(parm->id[0]);  
71             parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder);             parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder);
72        }        }
73        else if ( Paso_Distribution_getMyNumComponents(S->row_distribution)*S->row_block_size==parm->numEqu* Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution)) {        else if ( Paso_Distribution_getMyNumComponents(S->row_distribution)*S->row_block_size==parm->numEqu* Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution)) {
74             parm->row_DOF_UpperBound =  Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution);             parm->row_DOF_UpperBound =  Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution);
75             parm->row_DOF=nodes->reducedDegreesOfFreedomMapping->target;             parm->row_DOF=nodes->reducedDegreesOfFreedomMapping->target;
76             parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);         parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);
            parm->row_node=parm->row_jac->ReferenceElement->Type->linearNodes;  
77        } else {        } else {
78             Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: 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");
79        }        }
80        /* Make sure # cols in matrix == num DOF for one of: full or reduced (use numLocalDOF for MPI) */        /* Make sure # cols in matrix == num DOF for one of: full or reduced (use numLocalDOF for MPI) */
81        if ( Paso_Distribution_getMyNumComponents(S->col_distribution)*S->col_block_size==parm->numComp* Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution)) {        if ( Paso_Distribution_getMyNumComponents(S->col_distribution)*S->col_block_size==parm->numComp* Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution)) {
82             parm->col_DOF_UpperBound =  Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution);             parm->col_DOF_UpperBound =  Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution);
83             parm->col_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder);             parm->col_DOF=nodes->degreesOfFreedomMapping->target;
84             parm->col_DOF=nodes->degreesOfFreedomMapping->target;             parm->col_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder);
85             parm->col_node=&(parm->id[0]);        } else if ( Paso_Distribution_getMyNumComponents(S->col_distribution)*S->col_block_size==parm->numComp* Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution)) {
       }  
       else if ( Paso_Distribution_getMyNumComponents(S->col_distribution)*S->col_block_size==parm->numComp* Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution)) {  
86             parm->col_DOF_UpperBound =  Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution);             parm->col_DOF_UpperBound =  Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution);
87             parm->col_DOF=nodes->reducedDegreesOfFreedomMapping->target;             parm->col_DOF=nodes->reducedDegreesOfFreedomMapping->target;
88             parm->col_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);             parm->col_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);
            parm->col_node=parm->row_jac->ReferenceElement->Type->linearNodes;  
89        } else {        } else {
90             Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: 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");
91        }        }
# Line 106  void Assemble_getAssembleParameters(Finl Line 97  void Assemble_getAssembleParameters(Finl
97             parm->row_DOF_UpperBound =  Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution);             parm->row_DOF_UpperBound =  Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution);
98             parm->row_DOF=nodes->degreesOfFreedomMapping->target;             parm->row_DOF=nodes->degreesOfFreedomMapping->target;
99             parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder);             parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder);
            parm->row_node=&(parm->id[0]);  
100        }        }
101        else if (numSamplesEqual(F,1, Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution))) {        else if (numSamplesEqual(F,1, Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution))) {
102             parm->row_DOF_UpperBound =  Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution);             parm->row_DOF_UpperBound =  Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution);
103             parm->row_DOF=nodes->reducedDegreesOfFreedomMapping->target;             parm->row_DOF=nodes->reducedDegreesOfFreedomMapping->target;
104             parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);         parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);
            parm->row_node=parm->row_jac->ReferenceElement->Type->linearNodes;  
105        } else {        } else {
106             Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: 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");
107        }        }
108        if (S==NULL) {        if (S==NULL) {
109             parm->col_DOF_UpperBound=parm->row_DOF_UpperBound;             parm->col_DOF_UpperBound=parm->row_DOF_UpperBound;
110             parm->col_DOF=parm->row_DOF;             parm->col_DOF=parm->row_DOF;
            parm->col_node=parm->row_node;  
111             parm->col_jac=parm->row_jac;             parm->col_jac=parm->row_jac;
112        }        }
113    }    }
114    if (! Finley_noError()) return;  
115    if (parm->row_jac!=parm->col_jac) {    numSub=MIN(parm->row_jac->numSub, parm->col_jac->numSub);
116        Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: assemblage cannot handle different shape functions for rows and columns (yet).");    numQuadSub=parm->row_jac->numQuadTotal/numSub;
117    }    if ( parm->row_jac->numSides !=parm->col_jac->numSides) {
118    if (! Finley_noError()) return;        Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of sides for row and column shape functions must match.");
119    parm->NN=elements->ReferenceElement->Type->numNodes;    }
120      if ( parm->row_jac->numDim !=parm->col_jac->numDim) {
121          Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: spacial dimension for row and column shape function must match.");
122      }
123      
124      if (elements->numNodes < parm->row_jac->numShapesTotal) {
125          Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: too many nodes are expected by row.");  
126      }
127      if (elements->numNodes < parm->row_jac->numShapesTotal) {
128          Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: too many nodes are expected by col.");  
129      }
130      if ( parm->row_jac->numElements !=elements->numElements) {
131          Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of elements for row is wrong.");
132      }
133      if ( parm->col_jac->numElements !=elements->numElements) {
134          Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of elements for column is wrong.");
135      }
136      if ( parm->row_jac->numQuadTotal !=parm->col_jac->numQuadTotal) {
137          Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of quadrature points for row and column shape functions must match.");
138      }
139        /* to consider different basis function for rows and columns this will require some work :*/
140      if (numQuadSub * numSub != parm->row_jac->numQuadTotal) {
141         Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of quadrature points for row is not correct.");
142      }
143      if (numQuadSub  * numSub != parm->row_jac->numQuadTotal) {
144         Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters:   number of quadrature points for column is not correct.");
145      }
146      if (numQuadSub != parm->row_jac->BasisFunctions->numQuadNodes) {
147         Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: Incorrect number of quadrature points for row.");
148      }
149      if (numQuadSub != parm->col_jac->BasisFunctions->numQuadNodes) {
150         Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: Incorrect number of quadrature points for row.");
151      }
152      
153      parm->numQuadSub=numQuadSub;
154      parm->numSub=numSub;
155      parm->numQuadTotal=parm->row_jac->numQuadTotal;
156      parm->NN=elements->numNodes;
157      parm->numElements=elements->numElements;
158    parm->numDim=parm->row_jac->numDim;    parm->numDim=parm->row_jac->numDim;
159    parm->numQuad=parm->row_jac->ReferenceElement->numQuadNodes;    parm->col_node=parm->col_jac->node_selection;
160    parm->row_NN=parm->row_jac->ReferenceElement->Type->numNodes;    parm->row_node=parm->row_jac->node_selection;
161    parm->row_NS=parm->row_jac->ReferenceElement->Type->numShapes;    parm->numSides=parm->row_jac->numSides;
162    parm->col_NN=parm->col_jac->ReferenceElement->Type->numNodes;    parm->row_numShapesTotal=parm->row_jac->numShapesTotal;
163    parm->col_NS=parm->col_jac->ReferenceElement->Type->numShapes;    parm->row_numShapes=parm->row_jac->BasisFunctions->Type->numShapes;
164      parm->col_numShapesTotal=parm->col_jac->numShapesTotal;
165      parm->col_numShapes=parm->col_jac->BasisFunctions->Type->numShapes;
166        
167    
168  }  }

Legend:
Removed from v.2747  
changed lines
  Added in v.2748

  ViewVC Help
Powered by ViewVC 1.1.26