/[escript]/branches/trilinos_from_5897/dudley/src/Assemble_getAssembleParameters.cpp
ViewVC logotype

Diff of /branches/trilinos_from_5897/dudley/src/Assemble_getAssembleParameters.cpp

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

revision 6078 by caltinay, Wed Mar 2 04:13:26 2016 UTC revision 6079 by caltinay, Mon Mar 21 12:22:38 2016 UTC
# Line 27  Line 27 
27    
28  namespace dudley {  namespace dudley {
29    
30  void Assemble_getAssembleParameters(const Dudley_NodeFile* nodes,  void Assemble_getAssembleParameters(const NodeFile* nodes,
31          const Dudley_ElementFile* elements, escript::ASM_ptr mat,          const ElementFile* elements, escript::ASM_ptr mat,
32          const escript::Data& F, bool reducedIntegrationOrder,          const escript::Data& F, bool reducedIntegrationOrder,
33          Assemble_Parameters* parm)          AssembleParameters* parm)
34  {  {
35      paso::SystemMatrix* S = dynamic_cast<paso::SystemMatrix*>(mat.get());      paso::SystemMatrix* S = dynamic_cast<paso::SystemMatrix*>(mat.get());
36      if (mat && !S) {      if (mat && !S) {
# Line 72  void Assemble_getAssembleParameters(cons Line 72  void Assemble_getAssembleParameters(cons
72              parm->numComp = S->logical_col_block_size;              parm->numComp = S->logical_col_block_size;
73          }          }
74      }      }
75      parm->col_DOF = nodes->degreesOfFreedomMapping->target;      parm->col_DOF = nodes->borrowTargetDegreesOfFreedom();
76      parm->row_DOF = nodes->degreesOfFreedomMapping->target;      parm->row_DOF = nodes->borrowTargetDegreesOfFreedom();
77      /* 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 */
78      if (S != NULL) {      if (S != NULL) {
79          // Make sure # rows in matrix == num DOF for one of:          // Make sure # rows in matrix == num local DOF
         // full or reduced (use numLocalDOF for MPI)  
80          if (S->row_distribution->getMyNumComponents() * S->row_block_size ==          if (S->row_distribution->getMyNumComponents() * S->row_block_size ==
81              parm->numEqu * nodes->degreesOfFreedomDistribution->getMyNumComponents()) {                  parm->numEqu * nodes->getNumDegreesOfFreedom()) {
82              parm->row_DOF_UpperBound = nodes->degreesOfFreedomDistribution->getMyNumComponents();              parm->row_DOF_UpperBound = nodes->getNumDegreesOfFreedom();
83              parm->row_DOF = nodes->degreesOfFreedomMapping->target;              parm->row_DOF = nodes->borrowTargetDegreesOfFreedom();
             parm->row_jac = Dudley_ElementFile_borrowJacobians(elements, nodes, reducedIntegrationOrder);  
         } else if (S->row_distribution->getMyNumComponents() * S->row_block_size ==  
                  parm->numEqu * nodes->reducedDegreesOfFreedomDistribution->getMyNumComponents()) {  
             parm->row_DOF_UpperBound = nodes->reducedDegreesOfFreedomDistribution->getMyNumComponents();  
             parm->row_DOF = nodes->reducedDegreesOfFreedomMapping->target;  
             parm->row_jac = Dudley_ElementFile_borrowJacobians(elements, nodes, reducedIntegrationOrder);  
84          } else {          } else {
85              throw DudleyException("Assemble_getAssembleParameters: number of rows in matrix does not match the number of degrees of freedom in mesh");              throw DudleyException("Assemble_getAssembleParameters: number of "
86                                      "rows in matrix does not match the number "
87                                      "of degrees of freedom in mesh");
88          }          }
89          // Make sure # cols in matrix == num DOF for one of:          // Make sure # cols in matrix == num local DOF
         // full or reduced (use numLocalDOF for MPI)  
90          if (S->col_distribution->getMyNumComponents() * S->col_block_size ==          if (S->col_distribution->getMyNumComponents() * S->col_block_size ==
91              parm->numComp * nodes->degreesOfFreedomDistribution->getMyNumComponents()) {                  parm->numComp * nodes->getNumDegreesOfFreedom()) {
92              parm->col_DOF_UpperBound = nodes->degreesOfFreedomDistribution->getMyNumComponents();              parm->col_DOF_UpperBound = nodes->getNumDegreesOfFreedom();
93              parm->col_DOF = nodes->degreesOfFreedomMapping->target;              parm->col_DOF = nodes->borrowTargetDegreesOfFreedom();
             parm->row_jac = Dudley_ElementFile_borrowJacobians(elements, nodes, reducedIntegrationOrder);  
         } else if (S->col_distribution->getMyNumComponents() * S->col_block_size ==  
                  parm->numComp * nodes->reducedDegreesOfFreedomDistribution->getMyNumComponents()) {  
             parm->col_DOF_UpperBound = nodes->reducedDegreesOfFreedomDistribution->getMyNumComponents();  
             parm->col_DOF = nodes->reducedDegreesOfFreedomMapping->target;  
             parm->row_jac = Dudley_ElementFile_borrowJacobians(elements, nodes, reducedIntegrationOrder);  
94          } else {          } else {
95              throw DudleyException("Assemble_getAssembleParameters: number of columns in matrix does not match the number of degrees of freedom in mesh");              throw DudleyException("Assemble_getAssembleParameters: number of columns in matrix does not match the number of degrees of freedom in mesh");
96          }          }
# Line 110  void Assemble_getAssembleParameters(cons Line 98  void Assemble_getAssembleParameters(cons
98    
99      // get the information from right hand side      // get the information from right hand side
100      if (!F.isEmpty()) {      if (!F.isEmpty()) {
101          if (F.numSamplesEqual(1, nodes->degreesOfFreedomDistribution->getMyNumComponents())) {          if (F.numSamplesEqual(1, nodes->getNumDegreesOfFreedom())) {
102              parm->row_DOF_UpperBound = nodes->degreesOfFreedomDistribution->getMyNumComponents();              parm->row_DOF_UpperBound = nodes->getNumDegreesOfFreedom();
103              parm->row_DOF = nodes->degreesOfFreedomMapping->target;              parm->row_DOF = nodes->borrowTargetDegreesOfFreedom();
             parm->row_jac = Dudley_ElementFile_borrowJacobians(elements, nodes, reducedIntegrationOrder);  
         } else if (F.numSamplesEqual(1, nodes->reducedDegreesOfFreedomDistribution->getMyNumComponents())) {  
             parm->row_DOF_UpperBound = nodes->reducedDegreesOfFreedomDistribution->getMyNumComponents();  
             parm->row_DOF = nodes->reducedDegreesOfFreedomMapping->target;  
             parm->row_jac = Dudley_ElementFile_borrowJacobians(elements, nodes, reducedIntegrationOrder);  
104          } else {          } else {
105              throw DudleyException("Assemble_getAssembleParameters: length of RHS vector does not match the number of degrees of freedom in mesh");              throw DudleyException("Assemble_getAssembleParameters: length of "
106                                      "RHS vector does not match the number of "
107                                      "degrees of freedom in mesh");
108          }          }
109          if (S == NULL) {          if (S == NULL) {
110              parm->col_DOF_UpperBound = parm->row_DOF_UpperBound;              parm->col_DOF_UpperBound = parm->row_DOF_UpperBound;
111              parm->col_DOF = parm->row_DOF;              parm->col_DOF = parm->row_DOF;
             parm->row_jac = parm->row_jac;  
112          }          }
113      }      }
114    
115      if (parm->row_jac->numDim != parm->row_jac->numDim) {      parm->row_jac = elements->borrowJacobians(nodes, reducedIntegrationOrder);
         throw DudleyException("Assemble_getAssembleParameters: spacial dimension for row and column shape function must match.");  
     }  
116    
117      if (elements->numNodes < parm->row_jac->numShapes) {      if (elements->numNodes < parm->row_jac->numShapes) {
118          throw DudleyException("Assemble_getAssembleParameters: too many nodes are expected by row.");          throw DudleyException("Assemble_getAssembleParameters: too many nodes are expected by row.");

Legend:
Removed from v.6078  
changed lines
  Added in v.6079

  ViewVC Help
Powered by ViewVC 1.1.26