/[escript]/trunk/finley/src/ReferenceElementSets.h
ViewVC logotype

Contents of /trunk/finley/src/ReferenceElementSets.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6939 - (show annotations)
Mon Jan 20 03:37:18 2020 UTC (4 days, 1 hour ago) by uqaeller
File MIME type: text/plain
File size: 3266 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 #ifndef __FINLEY_REFERENCEELEMENTSETS_H__
19 #define __FINLEY_REFERENCEELEMENTSETS_H__
20
21 #include "ReferenceElements.h"
22
23 namespace finley {
24
25 /// A reference element set manages the reference elements for the full
26 /// and reduced integration order
27 struct ReferenceElementSet {
28 ReferenceElementSet(ElementTypeId id, int order, int reduced_order)
29 {
30 const ReferenceElementInfo* id_info = ReferenceElement::getInfo(id);
31 const ShapeFunctionInfo* bf_info = ShapeFunction::getInfo(
32 id_info->BasisFunctions);
33 if (order<0)
34 order=std::max(2*bf_info->numOrder, 0);
35
36 referenceElement.reset(new ReferenceElement(id, order));
37 if (reduced_order<0)
38 reduced_order=std::max(2*(bf_info->numOrder-1), 0);
39 referenceElementReducedQuadrature.reset(new ReferenceElement(id,
40 reduced_order));
41
42 if (referenceElement->getNumNodes() != referenceElementReducedQuadrature->getNumNodes()) {
43 throw escript::ValueError("ReferenceElementSet: numNodes in referenceElement and referenceElementReducedQuadrature don't match.");
44 }
45 }
46
47 const_ShapeFunction_ptr borrowBasisFunctions(bool reducedShapefunction,
48 bool reducedIntegrationOrder) const
49 {
50 if (reducedShapefunction) {
51 return (reducedIntegrationOrder ?
52 referenceElementReducedQuadrature->LinearBasisFunctions :
53 referenceElement->LinearBasisFunctions);
54 }
55 return (reducedIntegrationOrder ?
56 referenceElementReducedQuadrature->BasisFunctions :
57 referenceElement->BasisFunctions);
58 }
59
60 const_ShapeFunction_ptr borrowParametrization(bool reducedIntegrationOrder) const
61 {
62 return (reducedIntegrationOrder ?
63 referenceElementReducedQuadrature->Parametrization :
64 referenceElement->Parametrization);
65 }
66
67 const_ReferenceElement_ptr borrowReferenceElement(bool reducedIntOrder) const
68 {
69 return (reducedIntOrder ? referenceElementReducedQuadrature :
70 referenceElement);
71 }
72
73 inline int getNumNodes() const { return referenceElement->getNumNodes(); }
74
75 ReferenceElement_ptr referenceElementReducedQuadrature;
76 ReferenceElement_ptr referenceElement;
77 };
78
79
80 typedef boost::shared_ptr<const ReferenceElementSet> const_ReferenceElementSet_ptr;
81
82
83 } // namespace finley
84
85 #endif // __FINLEY_REFERENCEELEMENTSETS_H__
86

  ViewVC Help
Powered by ViewVC 1.1.26