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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6079 - (hide annotations)
Mon Mar 21 12:22:38 2016 UTC (3 years 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 jgs 82
2 jfenwick 3981 /*****************************************************************************
3 ksteube 1811 *
4 jfenwick 5863 * Copyright (c) 2003-2016 by The University of Queensland
5 jfenwick 3981 * http://www.uq.edu.au
6 ksteube 1811 *
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 jfenwick 3981 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 jfenwick 4657 * Development 2012-2013 by School of Earth Sciences
13     * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 jfenwick 3981 *
15     *****************************************************************************/
16 jgs 82
17     #include "Assemble.h"
18 caltinay 5963 #include "ShapeTable.h"
19 jgs 82 #include "Util.h"
20    
21 caltinay 6009 namespace dudley {
22 jgs 82
23 caltinay 6079 void Assemble_interpolate(const NodeFile* nodes, const ElementFile* elements,
24     const escript::Data& data,
25     escript::Data& interpolated_data)
26 jfenwick 3224 {
27 caltinay 6009 if (!nodes || !elements)
28 caltinay 5963 return;
29 jgs 82
30 caltinay 6079 const int data_type = data.getFunctionSpace().getTypeCode();
31     const bool reduced_integration = hasReducedIntegrationOrder(interpolated_data);
32 jgs 82
33 caltinay 6009 dim_t numNodes = 0;
34 caltinay 6079 const index_t* map = NULL;
35 caltinay 6009
36     if (data_type == DUDLEY_NODES) {
37 caltinay 6079 numNodes = nodes->getNumNodes();
38     map = nodes->borrowTargetNodes();
39 caltinay 6009 } 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 caltinay 5963 }
43 caltinay 6079 numNodes = nodes->getNumDegreesOfFreedom();
44     map = nodes->borrowTargetDegreesOfFreedom();
45 caltinay 6009 } else {
46     throw DudleyException("Assemble_interpolate: Cannot interpolate data");
47 jfenwick 3224 }
48 jgs 82
49 caltinay 6079 const dim_t numComps = data.getDataPointSize();
50 caltinay 6009 const int NN = elements->numNodes;
51 caltinay 6079 const int numQuad = reduced_integration ? 1 : elements->numNodes;
52 caltinay 6009 const int NS_DOF = elements->numDim + 1;
53     const double *shapeFns = NULL;
54 jfenwick 3198
55 caltinay 6009 // check the dimensions of interpolated_data and data
56 caltinay 6079 if (!interpolated_data.numSamplesEqual(numQuad, elements->numElements)) {
57 caltinay 6009 throw DudleyException("Assemble_interpolate: illegal number of samples of output Data object");
58 caltinay 6079 } else if (!data.numSamplesEqual(1, numNodes)) {
59 caltinay 6009 throw DudleyException("Assemble_interpolate: illegal number of samples of input Data object");
60 caltinay 6079 } else if (numComps != interpolated_data.getDataPointSize()) {
61 caltinay 6009 throw DudleyException("Assemble_interpolate: number of components of input and interpolated Data do not match.");
62 caltinay 6079 } else if (!interpolated_data.actsExpanded()) {
63 caltinay 6009 throw DudleyException("Assemble_interpolate: expanded Data object is expected for output data.");
64 jfenwick 3224 }
65 jgs 82
66 caltinay 6009 if (!getQuadShape(elements->numDim, reduced_integration, &shapeFns)) {
67     throw DudleyException("Assemble_interpolate: unable to locate shape function.");
68 jfenwick 3224 }
69 jfenwick 3198
70 caltinay 6079 interpolated_data.requireWrite();
71 caltinay 6009 #pragma omp parallel
72 jfenwick 3224 {
73 caltinay 6009 std::vector<double> local_data(NS_DOF * numComps);
74     const size_t numComps_size = numComps *sizeof(double);
75 caltinay 6079 // open the element loop
76 caltinay 6009 #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 caltinay 6079 const double* data_array = data.getSampleDataRO(map[i]);
81 caltinay 6009 memcpy(&local_data[INDEX3(0, q, 0, numComps, NS_DOF)],
82     data_array, numComps_size);
83 caltinay 5963 }
84 caltinay 6009 // calculate interpolated_data=local_data*S
85 caltinay 6079 util::smallMatSetMult1(1, numComps, numQuad,
86     interpolated_data.getSampleDataRW(e), NS_DOF,
87 caltinay 6009 &local_data[0], shapeFns);
88     } // end of element loop
89     } // end of parallel region
90 jgs 82 }
91 caltinay 6009
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