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

Contents of /branches/trilinos_from_5897/dudley/src/Assemble_getSize.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: 3021 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 "Util.h"
19
20 namespace dudley {
21
22 void Assemble_getSize(const NodeFile* nodes, const ElementFile* elements,
23 escript::Data& out)
24 {
25 if (!nodes || !elements)
26 return;
27
28 const int numDim = nodes->numDim;
29
30 // now we look up what type of elements we need based on the function space
31 // of out. If it is DUDLEY_REDUCED_ELEMENTS or
32 // DUDLEY_REDUCED_FACE_ELEMENTS then we have single quad point
33 int numQuad = (hasReducedIntegrationOrder(out) ? 1 : elements->numNodes);
34 const int NN = elements->numNodes;
35 const int NS = elements->numDim + 1;
36 const int NVertices = elements->numDim + 1;
37
38 // check the dimensions of out
39 if (!out.numSamplesEqual(numQuad, elements->numElements)) {
40 throw DudleyException("Assemble_getSize: illegal number of samples of element size Data object");
41 } else if (!out.isDataPointShapeEqual(0, &numDim)) {
42 throw DudleyException("Assemble_getSize: illegal data point shape of element size Data object");
43 } else if (!out.actsExpanded()) {
44 throw DudleyException("Assemble_getSize: expanded Data object is expected for element size.");
45 }
46
47 // now we can start
48 out.requireWrite();
49 #pragma omp parallel
50 {
51 std::vector<double> local_X(NN * numDim);
52 #pragma omp for
53 for (index_t e = 0; e < elements->numElements; e++) {
54 // gather local coordinates of nodes into local_X(numDim,NN)
55 util::gather(NS, &elements->Nodes[INDEX2(0, e, NN)], numDim,
56 nodes->Coordinates, &local_X[0]);
57 // calculate minimal differences
58 double max_diff = 0;
59 for (int n0 = 0; n0 < NVertices; n0++) {
60 for (int n1 = n0 + 1; n1 < NVertices; n1++) {
61 double diff = 0;
62 for (int i = 0; i < numDim; i++) {
63 const double d = local_X[INDEX2(i, n0, numDim)] - local_X[INDEX2(i, n1, numDim)];
64 diff += d * d;
65 }
66
67 max_diff = std::max(max_diff, diff);
68 }
69 }
70 max_diff = sqrt(max_diff);
71 // set all values to max_diff
72 double* out_array = out.getSampleDataRW(e);
73 for (int q = 0; q < numQuad; q++)
74 out_array[q] = max_diff;
75 }
76 } // end of parallel region
77 }
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_getSize.cpp:5567-5588 /branches/lapack2681/finley/src/Assemble_getSize.cpp:2682-2741 /branches/pasowrap/dudley/src/Assemble_getSize.cpp:3661-3674 /branches/py3_attempt2/dudley/src/Assemble_getSize.cpp:3871-3891 /branches/restext/finley/src/Assemble_getSize.cpp:2610-2624 /branches/ripleygmg_from_3668/dudley/src/Assemble_getSize.cpp:3669-3791 /branches/stage3.0/finley/src/Assemble_getSize.cpp:2569-2590 /branches/symbolic_from_3470/dudley/src/Assemble_getSize.cpp:3471-3974 /branches/symbolic_from_3470/ripley/test/python/dudley/src/Assemble_getSize.cpp:3517-3974 /release/3.0/finley/src/Assemble_getSize.cpp:2591-2601 /release/4.0/dudley/src/Assemble_getSize.cpp:5380-5406 /trunk/dudley/src/Assemble_getSize.cpp:4257-4344,5898-6007 /trunk/ripley/test/python/dudley/src/Assemble_getSize.cpp:3480-3515

  ViewVC Help
Powered by ViewVC 1.1.26