/[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 6079 - (show annotations)
Mon Mar 21 12:22:38 2016 UTC (2 years, 11 months ago) by caltinay
File size: 5543 byte(s)
Big commit - making dudley much more like finley to make it more
managable. Fixed quite a few issues that had been fixed in finley.
Disposed of all ReducedNode/ReducedDOF entities that dudley never supported.
Compiles and passes tests.

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 NodeFile* nodes,
31 const ElementFile* elements, escript::ASM_ptr mat,
32 const escript::Data& F, bool reducedIntegrationOrder,
33 AssembleParameters* 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->borrowTargetDegreesOfFreedom();
76 parm->row_DOF = nodes->borrowTargetDegreesOfFreedom();
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 local DOF
80 if (S->row_distribution->getMyNumComponents() * S->row_block_size ==
81 parm->numEqu * nodes->getNumDegreesOfFreedom()) {
82 parm->row_DOF_UpperBound = nodes->getNumDegreesOfFreedom();
83 parm->row_DOF = nodes->borrowTargetDegreesOfFreedom();
84 } else {
85 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 local DOF
90 if (S->col_distribution->getMyNumComponents() * S->col_block_size ==
91 parm->numComp * nodes->getNumDegreesOfFreedom()) {
92 parm->col_DOF_UpperBound = nodes->getNumDegreesOfFreedom();
93 parm->col_DOF = nodes->borrowTargetDegreesOfFreedom();
94 } else {
95 throw DudleyException("Assemble_getAssembleParameters: number of columns in matrix does not match the number of degrees of freedom in mesh");
96 }
97 }
98
99 // get the information from right hand side
100 if (!F.isEmpty()) {
101 if (F.numSamplesEqual(1, nodes->getNumDegreesOfFreedom())) {
102 parm->row_DOF_UpperBound = nodes->getNumDegreesOfFreedom();
103 parm->row_DOF = nodes->borrowTargetDegreesOfFreedom();
104 } else {
105 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) {
110 parm->col_DOF_UpperBound = parm->row_DOF_UpperBound;
111 parm->col_DOF = parm->row_DOF;
112 }
113 }
114
115 parm->row_jac = elements->borrowJacobians(nodes, reducedIntegrationOrder);
116
117 if (elements->numNodes < parm->row_jac->numShapes) {
118 throw DudleyException("Assemble_getAssembleParameters: too many nodes are expected by row.");
119 }
120 if (parm->row_jac->numElements != elements->numElements) {
121 throw DudleyException("Assemble_getAssembleParameters: number of elements for row is wrong.");
122 }
123
124 parm->numQuad = parm->row_jac->numQuad;
125 parm->NN = elements->numNodes;
126 parm->numElements = elements->numElements;
127 parm->numDim = parm->row_jac->numDim;
128 parm->numShapes = parm->row_jac->numShapes;
129 }
130
131 } // namespace dudley
132

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