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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6939 - (show annotations)
Mon Jan 20 03:37:18 2020 UTC (4 months, 1 week ago) by uqaeller
File size: 3564 byte(s)
Updated the copyright header.


1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2020 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-2017 by Centre for Geoscience Computing (GeoComp)
14 * Development from 2019 by School of Earth and Environmental Sciences
15 **
16 *****************************************************************************/
17
18
19 /****************************************************************************
20
21 Assemblage routines: calculates the normal vector at quadrature points on
22 face elements
23
24 *****************************************************************************/
25
26 #include "Assemble.h"
27 #include "Util.h"
28
29 #include <escript/index.h>
30
31 namespace finley {
32
33 void Assemble_getNormal(const NodeFile* nodes, const ElementFile* elements,
34 escript::Data& normal)
35 {
36 if (!nodes || !elements)
37 return;
38
39 const_ReferenceElement_ptr refElement(elements->referenceElementSet->
40 borrowReferenceElement(util::hasReducedIntegrationOrder(normal)));
41 const int NN = elements->numNodes;
42 const int numDim = nodes->numDim;
43 const int numQuad = refElement->Parametrization->numQuadNodes;
44 const int numDim_local = refElement->Parametrization->Type->numDim;
45 const int NS = refElement->Parametrization->Type->numShapes;
46
47 int sign, node_offset;
48 if (normal.getFunctionSpace().getTypeCode() == FINLEY_CONTACT_ELEMENTS_2) {
49 node_offset = refElement->Type->offsets[1];
50 sign = -1;
51 } else {
52 node_offset = refElement->Type->offsets[0];
53 sign = 1;
54 }
55
56 // check the dimensions of normal
57 if (!(numDim == numDim_local || numDim - 1 == numDim_local)) {
58 throw escript::ValueError("Assemble_setNormal: Cannot calculate normal vector");
59 } else if (!normal.numSamplesEqual(numQuad, elements->numElements)) {
60 throw escript::ValueError("Assemble_setNormal: illegal number of samples of normal Data object");
61 } else if (!normal.isDataPointShapeEqual(1, &numDim)) {
62 throw escript::ValueError("Assemble_setNormal: illegal point data shape of normal Data object");
63 } else if (!normal.actsExpanded()) {
64 throw escript::ValueError("Assemble_setNormal: expanded Data object is expected for normal.");
65 }
66
67 normal.requireWrite();
68 #pragma omp parallel
69 {
70 std::vector<double> local_X(NS * numDim);
71 std::vector<double> dVdv(numQuad * numDim * numDim_local);
72 #pragma omp for
73 for (index_t e = 0; e < elements->numElements; e++) {
74 // gather local coordinates of nodes into local_X
75 util::gather(NS, &elements->Nodes[INDEX2(node_offset, e, NN)],
76 numDim, nodes->Coordinates, &local_X[0]);
77 // calculate dVdv(i,j,q)=local_X(i,n)*DSDv(n,j,q)
78 util::smallMatMult(numDim, numDim_local * numQuad, &dVdv[0], NS,
79 local_X, refElement->Parametrization->dSdv);
80 double* normal_array = normal.getSampleDataRW(e);
81 util::normalVector(numQuad, numDim, numDim_local, &dVdv[0],
82 normal_array);
83 for (int q = 0; q < numQuad * numDim; q++)
84 normal_array[q] *= sign;
85 }
86 } // parallel section
87 }
88
89 } // namespace finley

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26