/[escript]/trunk/dudley/src/Assemble_CopyElementData.cpp
ViewVC logotype

Contents of /trunk/dudley/src/Assemble_CopyElementData.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6651 - (show annotations)
Wed Feb 7 02:12:08 2018 UTC (19 months, 1 week ago) by jfenwick
File size: 3202 byte(s)
Make everyone sad by touching all the files

Copyright dates update

1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2018 by The University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Apache License, version 2.0
9 * http://www.apache.org/licenses/LICENSE-2.0
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 using escript::ValueError;
24
25 template<typename Scalar>
26 void Assemble_CopyElementData(const ElementFile* elements, escript::Data& out,
27 const escript::Data& in)
28 {
29 if (!elements)
30 return;
31
32 dim_t numQuad = (hasReducedIntegrationOrder(in) ?
33 QuadNums[elements->numDim][0] : QuadNums[elements->numDim][1]);
34
35 // check out and in
36 const dim_t numElements = elements->numElements;
37 const int numComps = out.getDataPointSize();
38
39 if (numComps != in.getDataPointSize()) {
40 throw ValueError("Assemble_CopyElementData: number of components of input and output Data do not match.");
41 } else if (!in.numSamplesEqual(numQuad, numElements)) {
42 throw ValueError("Assemble_CopyElementData: illegal number of samples of input Data object");
43 } else if (!out.numSamplesEqual(numQuad, numElements)) {
44 throw ValueError("Assemble_CopyElementData: illegal number of samples of output Data object");
45 } else if (!out.actsExpanded()) {
46 throw ValueError("Assemble_CopyElementData: expanded Data object is expected for output data.");
47 } else if (in.isComplex() != out.isComplex()) {
48 throw ValueError("Assemble_CopyElementData: complexity of input and output Data must match.");
49 } else {
50 const Scalar zero = static_cast<Scalar>(0);
51 out.requireWrite();
52 if (in.actsExpanded()) {
53 const size_t len_size = numComps * numQuad * sizeof(Scalar);
54 #pragma omp parallel for
55 for (index_t n = 0; n < numElements; n++)
56 memcpy(out.getSampleDataRW(n, zero),
57 in.getSampleDataRO(n, zero), len_size);
58 } else {
59 const size_t len_size = numComps * sizeof(Scalar);
60 #pragma omp parallel for
61 for (index_t n = 0; n < numElements; n++) {
62 const Scalar* in_array = in.getSampleDataRO(n, zero);
63 Scalar* out_array = out.getSampleDataRW(n, zero);
64 for (int q = 0; q < numQuad; q++)
65 memcpy(out_array + q * numComps, in_array, len_size);
66 }
67 }
68 }
69 }
70
71 // instantiate our two supported versions
72 template void Assemble_CopyElementData<escript::DataTypes::real_t>(
73 const ElementFile* elements, escript::Data& out,
74 const escript::Data& in);
75 template void Assemble_CopyElementData<escript::DataTypes::cplx_t>(
76 const ElementFile* elements, escript::Data& out,
77 const escript::Data& in);
78
79 } // namespace dudley
80

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 /branches/trilinos_from_5897/dudley/src/Assemble_CopyElementData.cpp:5898-6118 /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 /trunk/ripley/test/python/dudley/src/Assemble_CopyElementData.cpp:3480-3515

  ViewVC Help
Powered by ViewVC 1.1.26