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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6079 - (show annotations)
Mon Mar 21 12:22:38 2016 UTC (2 years, 10 months ago) by caltinay
File size: 3818 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 #include "Assemble.h"
18 #include "ShapeTable.h"
19 #include "Util.h"
20
21 namespace dudley {
22
23 void Assemble_interpolate(const NodeFile* nodes, const ElementFile* elements,
24 const escript::Data& data,
25 escript::Data& interpolated_data)
26 {
27 if (!nodes || !elements)
28 return;
29
30 const int data_type = data.getFunctionSpace().getTypeCode();
31 const bool reduced_integration = hasReducedIntegrationOrder(interpolated_data);
32
33 dim_t numNodes = 0;
34 const index_t* map = NULL;
35
36 if (data_type == DUDLEY_NODES) {
37 numNodes = nodes->getNumNodes();
38 map = nodes->borrowTargetNodes();
39 } else if (data_type == DUDLEY_DEGREES_OF_FREEDOM) {
40 if (elements->MPIInfo->size > 1) {
41 throw DudleyException("Assemble_interpolate: for more than one processor DEGREES_OF_FREEDOM data are not accepted as input.");
42 }
43 numNodes = nodes->getNumDegreesOfFreedom();
44 map = nodes->borrowTargetDegreesOfFreedom();
45 } else {
46 throw DudleyException("Assemble_interpolate: Cannot interpolate data");
47 }
48
49 const dim_t numComps = data.getDataPointSize();
50 const int NN = elements->numNodes;
51 const int numQuad = reduced_integration ? 1 : elements->numNodes;
52 const int NS_DOF = elements->numDim + 1;
53 const double *shapeFns = NULL;
54
55 // check the dimensions of interpolated_data and data
56 if (!interpolated_data.numSamplesEqual(numQuad, elements->numElements)) {
57 throw DudleyException("Assemble_interpolate: illegal number of samples of output Data object");
58 } else if (!data.numSamplesEqual(1, numNodes)) {
59 throw DudleyException("Assemble_interpolate: illegal number of samples of input Data object");
60 } else if (numComps != interpolated_data.getDataPointSize()) {
61 throw DudleyException("Assemble_interpolate: number of components of input and interpolated Data do not match.");
62 } else if (!interpolated_data.actsExpanded()) {
63 throw DudleyException("Assemble_interpolate: expanded Data object is expected for output data.");
64 }
65
66 if (!getQuadShape(elements->numDim, reduced_integration, &shapeFns)) {
67 throw DudleyException("Assemble_interpolate: unable to locate shape function.");
68 }
69
70 interpolated_data.requireWrite();
71 #pragma omp parallel
72 {
73 std::vector<double> local_data(NS_DOF * numComps);
74 const size_t numComps_size = numComps *sizeof(double);
75 // open the element loop
76 #pragma omp for
77 for (index_t e = 0; e < elements->numElements; e++) {
78 for (int q = 0; q < NS_DOF; q++) {
79 const index_t i = elements->Nodes[INDEX2(q, e, NN)];
80 const double* data_array = data.getSampleDataRO(map[i]);
81 memcpy(&local_data[INDEX3(0, q, 0, numComps, NS_DOF)],
82 data_array, numComps_size);
83 }
84 // calculate interpolated_data=local_data*S
85 util::smallMatSetMult1(1, numComps, numQuad,
86 interpolated_data.getSampleDataRW(e), NS_DOF,
87 &local_data[0], shapeFns);
88 } // end of element loop
89 } // end of parallel region
90 }
91
92 } // namespace dudley
93

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26