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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4496 - (show annotations)
Mon Jul 15 06:53:44 2013 UTC (6 years ago) by caltinay
File size: 2857 byte(s)
finley (WIP):
-moved all of finley into its namespace
-introduced some shared pointers
-Mesh is now a class
-other bits and pieces...

1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2013 by 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 since 2012 by School of Earth Sciences
13 *
14 *****************************************************************************/
15
16
17 /****************************************************************************
18
19 Assemblage routines: copies data between elements.
20
21 *****************************************************************************/
22
23 #include "Assemble.h"
24 #include "Util.h"
25
26 namespace finley {
27
28 void Assemble_CopyElementData(const ElementFile* elements, escript::Data& out,
29 const escript::Data& in)
30 {
31 resetError();
32 if (!elements)
33 return;
34
35 int numQuad;
36 if (util::hasReducedIntegrationOrder(in)) {
37 numQuad=elements->referenceElementSet->referenceElementReducedQuadrature->Parametrization->numQuadNodes;
38 } else {
39 numQuad=elements->referenceElementSet->referenceElement->Parametrization->numQuadNodes;
40 }
41
42 const int numElements=elements->numElements;
43 const int numComps=out.getDataPointSize();
44
45 if (numComps != in.getDataPointSize()) {
46 setError(TYPE_ERROR,"Assemble_CopyElementData: number of components of input and output Data do not match.");
47 } else if (!in.numSamplesEqual(numQuad,numElements)) {
48 setError(TYPE_ERROR,"Assemble_CopyElementData: illegal number of samples of input Data object");
49 } else if (!out.numSamplesEqual(numQuad,numElements)) {
50 setError(TYPE_ERROR,"Assemble_CopyElementData: illegal number of samples of output Data object");
51 } else if (!out.actsExpanded()) {
52 setError(TYPE_ERROR,"Assemble_CopyElementData: expanded Data object is expected for output data.");
53 } else {
54 escript::Data& _in(*const_cast<escript::Data*>(&in));
55 if (in.actsExpanded()) {
56 const size_t len_size=numComps*numQuad*sizeof(double);
57 out.requireWrite();
58 #pragma omp parallel for
59 for (int n=0; n<numElements; n++)
60 memcpy(out.getSampleDataRW(n), _in.getSampleDataRO(n), len_size);
61 } else {
62 const size_t len_size=numComps*sizeof(double);
63 out.requireWrite();
64 #pragma omp parallel for
65 for (int n=0; n<numElements; n++) {
66 const double *in_array = _in.getSampleDataRO(n);
67 double *out_array = out.getSampleDataRW(n);
68 for (int q=0; q<numQuad; q++)
69 memcpy(out_array+q*numComps, in_array, len_size);
70 }
71 }
72 }
73 }
74
75 } // namespace finley
76

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision
svn:mergeinfo /branches/lapack2681/finley/src/Assemble_CopyElementData.cpp:2682-2741 /branches/pasowrap/finley/src/Assemble_CopyElementData.cpp:3661-3674 /branches/py3_attempt2/finley/src/Assemble_CopyElementData.cpp:3871-3891 /branches/restext/finley/src/Assemble_CopyElementData.cpp:2610-2624 /branches/ripleygmg_from_3668/finley/src/Assemble_CopyElementData.cpp:3669-3791 /branches/stage3.0/finley/src/Assemble_CopyElementData.cpp:2569-2590 /branches/symbolic_from_3470/finley/src/Assemble_CopyElementData.cpp:3471-3974 /release/3.0/finley/src/Assemble_CopyElementData.cpp:2591-2601 /trunk/finley/src/Assemble_CopyElementData.cpp:4257-4344

  ViewVC Help
Powered by ViewVC 1.1.26