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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6009 - (show annotations)
Wed Mar 2 04:13:26 2016 UTC (3 years, 1 month ago) by caltinay
File size: 7493 byte(s)
Much needed sync with trunk...

1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2016 by The University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Open Software License version 3.0
9 * http://www.opensource.org/licenses/osl-3.0.php
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development 2012-2013 by School of Earth Sciences
13 * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 *
15 *****************************************************************************/
16
17 /****************************************************************************
18
19 Assemblage routines: prepares the assemble parameter set
20
21 *****************************************************************************/
22
23 #include "Assemble.h"
24 #include "ShapeTable.h"
25
26 #include <paso/SystemMatrix.h>
27
28 namespace dudley {
29
30 void Assemble_getAssembleParameters(const Dudley_NodeFile* nodes,
31 const Dudley_ElementFile* elements, escript::ASM_ptr mat,
32 const escript::Data& F, bool reducedIntegrationOrder,
33 Assemble_Parameters* parm)
34 {
35 paso::SystemMatrix* S = dynamic_cast<paso::SystemMatrix*>(mat.get());
36 if (mat && !S) {
37 throw DudleyException("Assemble_getAssembleParameters: Unknown matrix type.");
38 }
39 parm->shapeFns = NULL;
40 if (!F.isEmpty() && !F.actsExpanded()) {
41 throw DudleyException("Assemble_getAssembleParameters: Right hand side is not expanded.");
42 }
43
44 if (!getQuadShape(elements->numDim, reducedIntegrationOrder, &parm->shapeFns)) {
45 throw DudleyException("Assemble_getAssembleParameters: Can not locate shape functions.");
46 }
47 /* check the dimensions of S and F */
48 if (S != NULL && !F.isEmpty()) {
49 if (!F.numSamplesEqual(1, (S->row_distribution->getMyNumComponents()*S->row_block_size) /
50 S->logical_row_block_size)) {
51 throw DudleyException("Assemble_getAssembleParameters: number of rows of matrix and length of right hand side don't match.");
52 }
53 }
54 /* get the number of equations and components */
55 if (S == NULL) {
56 if (F.isEmpty()) {
57 parm->numEqu = 1;
58 parm->numComp = 1;
59 } else {
60 parm->numEqu = F.getDataPointSize();
61 parm->numComp = parm->numEqu;
62 }
63 } else {
64 if (F.isEmpty()) {
65 parm->numEqu = S->logical_row_block_size;
66 parm->numComp = S->logical_col_block_size;
67 } else {
68 if (F.getDataPointSize() != S->logical_row_block_size) {
69 throw DudleyException("Assemble_getAssembleParameters: matrix row block size and number of components of right hand side don't match.");
70 }
71 parm->numEqu = S->logical_row_block_size;
72 parm->numComp = S->logical_col_block_size;
73 }
74 }
75 parm->col_DOF = nodes->degreesOfFreedomMapping->target;
76 parm->row_DOF = nodes->degreesOfFreedomMapping->target;
77 /* get the information for the labeling of the degrees of freedom from matrix */
78 if (S != NULL) {
79 // Make sure # rows in matrix == num DOF for one of:
80 // full or reduced (use numLocalDOF for MPI)
81 if (S->row_distribution->getMyNumComponents() * S->row_block_size ==
82 parm->numEqu * nodes->degreesOfFreedomDistribution->getMyNumComponents()) {
83 parm->row_DOF_UpperBound = nodes->degreesOfFreedomDistribution->getMyNumComponents();
84 parm->row_DOF = nodes->degreesOfFreedomMapping->target;
85 parm->row_jac = Dudley_ElementFile_borrowJacobians(elements, nodes, reducedIntegrationOrder);
86 } else if (S->row_distribution->getMyNumComponents() * S->row_block_size ==
87 parm->numEqu * nodes->reducedDegreesOfFreedomDistribution->getMyNumComponents()) {
88 parm->row_DOF_UpperBound = nodes->reducedDegreesOfFreedomDistribution->getMyNumComponents();
89 parm->row_DOF = nodes->reducedDegreesOfFreedomMapping->target;
90 parm->row_jac = Dudley_ElementFile_borrowJacobians(elements, nodes, reducedIntegrationOrder);
91 } else {
92 throw DudleyException("Assemble_getAssembleParameters: number of rows in matrix does not match the number of degrees of freedom in mesh");
93 }
94 // Make sure # cols in matrix == num DOF for one of:
95 // full or reduced (use numLocalDOF for MPI)
96 if (S->col_distribution->getMyNumComponents() * S->col_block_size ==
97 parm->numComp * nodes->degreesOfFreedomDistribution->getMyNumComponents()) {
98 parm->col_DOF_UpperBound = nodes->degreesOfFreedomDistribution->getMyNumComponents();
99 parm->col_DOF = nodes->degreesOfFreedomMapping->target;
100 parm->row_jac = Dudley_ElementFile_borrowJacobians(elements, nodes, reducedIntegrationOrder);
101 } else if (S->col_distribution->getMyNumComponents() * S->col_block_size ==
102 parm->numComp * nodes->reducedDegreesOfFreedomDistribution->getMyNumComponents()) {
103 parm->col_DOF_UpperBound = nodes->reducedDegreesOfFreedomDistribution->getMyNumComponents();
104 parm->col_DOF = nodes->reducedDegreesOfFreedomMapping->target;
105 parm->row_jac = Dudley_ElementFile_borrowJacobians(elements, nodes, reducedIntegrationOrder);
106 } else {
107 throw DudleyException("Assemble_getAssembleParameters: number of columns in matrix does not match the number of degrees of freedom in mesh");
108 }
109 }
110
111 // get the information from right hand side
112 if (!F.isEmpty()) {
113 if (F.numSamplesEqual(1, nodes->degreesOfFreedomDistribution->getMyNumComponents())) {
114 parm->row_DOF_UpperBound = nodes->degreesOfFreedomDistribution->getMyNumComponents();
115 parm->row_DOF = nodes->degreesOfFreedomMapping->target;
116 parm->row_jac = Dudley_ElementFile_borrowJacobians(elements, nodes, reducedIntegrationOrder);
117 } else if (F.numSamplesEqual(1, nodes->reducedDegreesOfFreedomDistribution->getMyNumComponents())) {
118 parm->row_DOF_UpperBound = nodes->reducedDegreesOfFreedomDistribution->getMyNumComponents();
119 parm->row_DOF = nodes->reducedDegreesOfFreedomMapping->target;
120 parm->row_jac = Dudley_ElementFile_borrowJacobians(elements, nodes, reducedIntegrationOrder);
121 } else {
122 throw DudleyException("Assemble_getAssembleParameters: length of RHS vector does not match the number of degrees of freedom in mesh");
123 }
124 if (S == NULL) {
125 parm->col_DOF_UpperBound = parm->row_DOF_UpperBound;
126 parm->col_DOF = parm->row_DOF;
127 parm->row_jac = parm->row_jac;
128 }
129 }
130
131 if (parm->row_jac->numDim != parm->row_jac->numDim) {
132 throw DudleyException("Assemble_getAssembleParameters: spacial dimension for row and column shape function must match.");
133 }
134
135 if (elements->numNodes < parm->row_jac->numShapes) {
136 throw DudleyException("Assemble_getAssembleParameters: too many nodes are expected by row.");
137 }
138 if (parm->row_jac->numElements != elements->numElements) {
139 throw DudleyException("Assemble_getAssembleParameters: number of elements for row is wrong.");
140 }
141
142 parm->numQuad = parm->row_jac->numQuad;
143 parm->NN = elements->numNodes;
144 parm->numElements = elements->numElements;
145 parm->numDim = parm->row_jac->numDim;
146 parm->numShapes = parm->row_jac->numShapes;
147 }
148
149 } // namespace dudley
150

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision
svn:mergeinfo /branches/4.0fordebian/dudley/src/Assemble_getAssembleParameters.cpp:5567-5588 /branches/lapack2681/finley/src/Assemble_getAssembleParameters.cpp:2682-2741 /branches/pasowrap/dudley/src/Assemble_getAssembleParameters.cpp:3661-3674 /branches/py3_attempt2/dudley/src/Assemble_getAssembleParameters.cpp:3871-3891 /branches/restext/finley/src/Assemble_getAssembleParameters.cpp:2610-2624 /branches/ripleygmg_from_3668/dudley/src/Assemble_getAssembleParameters.cpp:3669-3791 /branches/stage3.0/finley/src/Assemble_getAssembleParameters.cpp:2569-2590 /branches/symbolic_from_3470/dudley/src/Assemble_getAssembleParameters.cpp:3471-3974 /branches/symbolic_from_3470/ripley/test/python/dudley/src/Assemble_getAssembleParameters.cpp:3517-3974 /release/3.0/finley/src/Assemble_getAssembleParameters.cpp:2591-2601 /release/4.0/dudley/src/Assemble_getAssembleParameters.cpp:5380-5406 /trunk/dudley/src/Assemble_getAssembleParameters.cpp:4257-4344,5898-6007 /trunk/ripley/test/python/dudley/src/Assemble_getAssembleParameters.cpp:3480-3515

  ViewVC Help
Powered by ViewVC 1.1.26