escript  Revision_
ReferenceElementSets.h
Go to the documentation of this file.
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 #ifndef __FINLEY_REFERENCEELEMENTSETS_H__
18 #define __FINLEY_REFERENCEELEMENTSETS_H__
19 
20 #include "ReferenceElements.h"
21 
22 namespace finley {
23 
26 struct ReferenceElementSet {
27  ReferenceElementSet(ElementTypeId id, int order, int reduced_order)
28  {
29  const ReferenceElementInfo* id_info = ReferenceElement::getInfo(id);
30  const ShapeFunctionInfo* bf_info = ShapeFunction::getInfo(
31  id_info->BasisFunctions);
32  if (order<0)
33  order=std::max(2*bf_info->numOrder, 0);
34 
35  referenceElement.reset(new ReferenceElement(id, order));
36  if (reduced_order<0)
37  reduced_order=std::max(2*(bf_info->numOrder-1), 0);
39  reduced_order));
40 
41  if (referenceElement->getNumNodes() != referenceElementReducedQuadrature->getNumNodes()) {
42  throw escript::ValueError("ReferenceElementSet: numNodes in referenceElement and referenceElementReducedQuadrature don't match.");
43  }
44  }
45 
46  const_ShapeFunction_ptr borrowBasisFunctions(bool reducedShapefunction,
47  bool reducedIntegrationOrder) const
48  {
49  if (reducedShapefunction) {
50  return (reducedIntegrationOrder ?
51  referenceElementReducedQuadrature->LinearBasisFunctions :
52  referenceElement->LinearBasisFunctions);
53  }
54  return (reducedIntegrationOrder ?
55  referenceElementReducedQuadrature->BasisFunctions :
56  referenceElement->BasisFunctions);
57  }
58 
59  const_ShapeFunction_ptr borrowParametrization(bool reducedIntegrationOrder) const
60  {
61  return (reducedIntegrationOrder ?
62  referenceElementReducedQuadrature->Parametrization :
63  referenceElement->Parametrization);
64  }
65 
66  const_ReferenceElement_ptr borrowReferenceElement(bool reducedIntOrder) const
67  {
68  return (reducedIntOrder ? referenceElementReducedQuadrature :
70  }
71 
72  inline int getNumNodes() const { return referenceElement->getNumNodes(); }
73 
76 };
77 
78 
79 typedef boost::shared_ptr<const ReferenceElementSet> const_ReferenceElementSet_ptr;
80 
81 
82 } // namespace finley
83 
84 #endif // __FINLEY_REFERENCEELEMENTSETS_H__
85 
finley::ReferenceElementSet::ReferenceElementSet
ReferenceElementSet(ElementTypeId id, int order, int reduced_order)
Definition: ReferenceElementSets.h:50
finley::ReferenceElementSet::getNumNodes
int getNumNodes() const
Definition: ReferenceElementSets.h:95
finley::ReferenceElement_ptr
boost::shared_ptr< ReferenceElement > ReferenceElement_ptr
Definition: ReferenceElements.h:210
finley::ReferenceElementSet::borrowReferenceElement
const_ReferenceElement_ptr borrowReferenceElement(bool reducedIntOrder) const
Definition: ReferenceElementSets.h:89
finley::const_ReferenceElementSet_ptr
boost::shared_ptr< const ReferenceElementSet > const_ReferenceElementSet_ptr
Definition: ReferenceElementSets.h:90
finley::ReferenceElementSet::referenceElement
ReferenceElement_ptr referenceElement
Definition: ReferenceElementSets.h:98
finley::const_ReferenceElement_ptr
boost::shared_ptr< const ReferenceElement > const_ReferenceElement_ptr
Definition: ReferenceElements.h:211
finley::ShapeFunction::getInfo
static const ShapeFunctionInfo * getInfo(ShapeFunctionTypeId id)
Definition: ShapeFunctions.cpp:117
finley::ReferenceElementSet::borrowBasisFunctions
const_ShapeFunction_ptr borrowBasisFunctions(bool reducedShapefunction, bool reducedIntegrationOrder) const
Definition: ReferenceElementSets.h:69
finley::ElementTypeId
ElementTypeId
Definition: ReferenceElements.h:36
finley::ReferenceElement::getInfo
static const ReferenceElementInfo * getInfo(ElementTypeId id)
returns the element information structure for the given type id
Definition: ReferenceElements.cpp:676
finley::ReferenceElementSet::borrowParametrization
const_ShapeFunction_ptr borrowParametrization(bool reducedIntegrationOrder) const
Definition: ReferenceElementSets.h:82
finley::const_ShapeFunction_ptr
boost::shared_ptr< const ShapeFunction > const_ShapeFunction_ptr
Definition: ShapeFunctions.h:98
ReferenceElements.h
finley::ReferenceElementSet::referenceElementReducedQuadrature
ReferenceElement_ptr referenceElementReducedQuadrature
Definition: ReferenceElementSets.h:97
finley
A suite of factory methods for creating various finley domains.
Definition: finley/src/Assemble.h:31
escript::ValueError
An exception class that signals an invalid argument value.
Definition: EsysException.h:99
finley::ReferenceElement
this struct holds the realization of a reference element
Definition: ReferenceElements.h:174