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

Contents of /branches/trilinos_from_5897/dudley/src/Assemble_CopyElementData.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: 2531 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_CopyElementData(const ElementFile* elements, escript::Data& out,
24 const escript::Data& in)
25 {
26 if (!elements)
27 return;
28
29 dim_t numQuad = (hasReducedIntegrationOrder(in) ?
30 QuadNums[elements->numDim][0] : QuadNums[elements->numDim][1]);
31
32 // check out and in
33 const dim_t numElements = elements->numElements;
34 const int numComps = out.getDataPointSize();
35
36 if (numComps != in.getDataPointSize()) {
37 throw DudleyException("Assemble_CopyElementData: number of components of input and output Data do not match.");
38 } else if (!in.numSamplesEqual(numQuad, numElements)) {
39 throw DudleyException("Assemble_CopyElementData: illegal number of samples of input Data object");
40 } else if (!out.numSamplesEqual(numQuad, numElements)) {
41 throw DudleyException("Assemble_CopyElementData: illegal number of samples of output Data object");
42 } else if (!out.actsExpanded()) {
43 throw DudleyException("Assemble_CopyElementData: expanded Data object is expected for output data.");
44 } else {
45 out.requireWrite();
46 if (in.actsExpanded()) {
47 const size_t len_size = numComps * numQuad * sizeof(double);
48 #pragma omp parallel for
49 for (index_t n = 0; n < numElements; n++)
50 memcpy(out.getSampleDataRW(n), in.getSampleDataRO(n), len_size);
51 } else {
52 const size_t len_size = numComps * sizeof(double);
53 #pragma omp parallel for
54 for (index_t n = 0; n < numElements; n++) {
55 const double* in_array = in.getSampleDataRO(n);
56 double* out_array = out.getSampleDataRW(n);
57 for (int q = 0; q < numQuad; q++)
58 memcpy(out_array + q * numComps, in_array, len_size);
59 }
60 }
61 }
62 }
63
64 } // namespace dudley
65

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26