/[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 6090 - (show annotations)
Wed Mar 23 06:35:54 2016 UTC (3 years, 1 month ago) by caltinay
File size: 4851 byte(s)
Simplified dudley PDE routines.

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 using escript::ValueError;
29
30 namespace dudley {
31
32 AssembleParameters::AssembleParameters(const NodeFile* nodes,
33 const ElementFile* ef,
34 escript::ASM_ptr sm,
35 escript::Data& rhs,
36 bool reducedIntegrationOrder) :
37 elements(ef),
38 S(sm),
39 F(rhs),
40 shapeFns(NULL)
41 {
42 paso::SystemMatrix* pasoMat = sm ?
43 dynamic_cast<paso::SystemMatrix*>(sm.get()) : NULL;
44
45 if (!rhs.isEmpty() && !rhs.actsExpanded()) {
46 throw ValueError("AssembleParameters: Right hand side is not expanded.");
47 }
48
49 if (!getQuadShape(elements->numDim, reducedIntegrationOrder, &shapeFns)) {
50 throw DudleyException("AssembleParameters: Cannot locate shape functions.");
51 }
52 // check the dimensions of matrix and rhs
53 if (pasoMat != NULL && !rhs.isEmpty()) {
54 const dim_t numRows = pasoMat->row_distribution->getMyNumComponents()*pasoMat->row_block_size;
55 if (!rhs.numSamplesEqual(1, numRows/pasoMat->logical_row_block_size)) {
56 throw ValueError("AssembleParameters: number of rows of matrix "
57 "and length of right hand side don't match.");
58 }
59 }
60 // get the number of equations and components
61 if (sm == NULL) {
62 if (rhs.isEmpty()) {
63 numEqu = 1;
64 } else {
65 numEqu = rhs.getDataPointSize();
66 }
67 } else {
68 if (!rhs.isEmpty() && rhs.getDataPointSize() != sm->getRowBlockSize()) {
69 throw DudleyException("AssembleParameters: matrix row block size "
70 "and number of components of right hand side don't match.");
71 }
72 if (sm->getRowBlockSize() != sm->getColumnBlockSize())
73 throw DudleyException("Dudley requires number of equations == number of solutions.");
74 numEqu = sm->getRowBlockSize();
75 }
76 DOF = nodes->borrowTargetDegreesOfFreedom();
77 DOF_UpperBound = nodes->getNumDegreesOfFreedom();
78
79 // get the information for the labeling of the degrees of freedom from
80 // the matrix
81 if (pasoMat) {
82 // Make sure # rows in matrix == num local DOF
83 const index_t numRows = pasoMat->row_distribution->getMyNumComponents()*pasoMat->row_block_size;
84 const index_t numCols = pasoMat->col_distribution->getMyNumComponents()*pasoMat->col_block_size;
85
86 if (numRows != numEqu * nodes->getNumDegreesOfFreedom()) {
87 throw DudleyException("AssembleParameters: number of rows in "
88 "matrix does not match the number of "
89 "degrees of freedom in mesh");
90 }
91 // Make sure # cols in matrix == num local DOF
92 if (numCols != numRows) {
93 throw DudleyException("AssembleParameters: number of columns in "
94 "matrix does not match the number of "
95 "degrees of freedom in mesh");
96 }
97 }
98
99 // get the information from right hand side
100 if (!rhs.isEmpty() &&
101 !rhs.numSamplesEqual(1, nodes->getNumDegreesOfFreedom())) {
102 throw DudleyException("AssembleParameters: length of RHS vector does "
103 "not match the number of degrees of freedom "
104 "in mesh");
105 }
106
107 jac = elements->borrowJacobians(nodes, reducedIntegrationOrder);
108
109 if (elements->numNodes < jac->numShapes) {
110 throw DudleyException("AssembleParameters: too many nodes are "
111 "expected by row.");
112 }
113 if (jac->numElements != elements->numElements) {
114 throw DudleyException("AssembleParameters: number of elements for "
115 "row is wrong.");
116 }
117
118 NN = elements->numNodes;
119 numQuad = jac->numQuad;
120 numDim = jac->numDim;
121 numShapes = jac->numShapes;
122 }
123
124 } // namespace dudley
125

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