Intrepid2
Intrepid2_DerivedBasis_HGRAD_HEX.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ************************************************************************
3 //
4 // Intrepid2 Package
5 // Copyright (2007) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Kyungjoo Kim (kyukim@sandia.gov),
38 // Mauro Perego (mperego@sandia.gov), or
39 // Nate Roberts (nvrober@sandia.gov)
40 //
41 // ************************************************************************
42 // @HEADER
43 
57 #ifndef Intrepid2_DerivedBasis_HGRAD_HEX_h
58 #define Intrepid2_DerivedBasis_HGRAD_HEX_h
59 
61 
63 
64 namespace Intrepid2
65 {
66  // TODO: make this a subclass of TensorBasis3 instead, following what we've done for H(curl) and H(div)
67  template<class HGRAD_LINE>
69  : public Basis_TensorBasis<Intrepid2::Basis_Derived_HGRAD_QUAD<HGRAD_LINE>,
70  HGRAD_LINE>
71  {
72  public:
73  using ExecutionSpace = typename HGRAD_LINE::ExecutionSpace;
74  using OutputValueType = typename HGRAD_LINE::OutputValueType;
75  using PointValueType = typename HGRAD_LINE::PointValueType;
76 
77  using OutputViewType = typename HGRAD_LINE::OutputViewType;
78  using PointViewType = typename HGRAD_LINE::PointViewType ;
79  using ScalarViewType = typename HGRAD_LINE::ScalarViewType;
80 
81  using LineBasis = HGRAD_LINE;
84 
90  Basis_Derived_HGRAD_HEX(int polyOrder_x, int polyOrder_y, int polyOrder_z)
91  :
92  TensorBasis(QuadBasis(polyOrder_x,polyOrder_y),
93  LineBasis(polyOrder_z))
94  {
95  this->functionSpace_ = FUNCTION_SPACE_HGRAD;
96  }
97 
101  Basis_Derived_HGRAD_HEX(int polyOrder) : Basis_Derived_HGRAD_HEX(polyOrder, polyOrder, polyOrder) {}
102 
105  virtual bool requireOrientation() const override {
106  return (this->getDofCount(1,0) > 1); //if it has more than 1 DOF per edge, than it needs orientations
107  }
108 
110 
118  virtual void getValues(OutputViewType outputValues, const EOperator operatorType,
119  const PointViewType inputPoints1, const PointViewType inputPoints2,
120  bool tensorPoints) const override
121  {
122  Intrepid2::EOperator op1, op2;
123  if (operatorType == Intrepid2::OPERATOR_VALUE)
124  {
125  op1 = Intrepid2::OPERATOR_VALUE;
126  op2 = Intrepid2::OPERATOR_VALUE;
127 
128  this->TensorBasis::getValues(outputValues,
129  inputPoints1, op1,
130  inputPoints2, op2, tensorPoints);
131  }
132  else if (operatorType == Intrepid2::OPERATOR_GRAD)
133  {
134  // to evaluate gradient, we actually need both OP_VALUE and OP_GRAD (thanks to product rule)
135  // for 1D line x line, we will put derivative * value in first component, and value * derivative in second
136 
137  // outputValues1 and outputValues2 are computed by basis1 and basis2 -- these are tensorial components
138  // outputValuesComponent1 is a slice of the final output container (similarly, outputValuesComponent2)
139  // when the component basis is 1D, it expects not to have a "dimension" component in the output container
140  // the int argument in the dimension component creates a subview that skips the dimension component; the std::pair argument retains it
141  auto outputValuesComponent1 = Kokkos::subview(outputValues,Kokkos::ALL(),Kokkos::ALL(),std::make_pair(0,2));
142  auto outputValuesComponent2 = Kokkos::subview(outputValues,Kokkos::ALL(),Kokkos::ALL(),2);
143 
144  // compute first component -- derivative happens in x and y, and value taken in z
145  op1 = Intrepid2::OPERATOR_GRAD;
146  op2 = Intrepid2::OPERATOR_VALUE;
147 
148  this->TensorBasis::getValues(outputValuesComponent1,
149  inputPoints1, op1,
150  inputPoints2, op2, tensorPoints);
151 
152  // second component -- value in x and y, derivative in z
153  op1 = Intrepid2::OPERATOR_VALUE;
154  op2 = Intrepid2::OPERATOR_GRAD;
155 
156  this->TensorBasis::getValues(outputValuesComponent2,
157  inputPoints1, op1,
158  inputPoints2, op2, tensorPoints);
159  }
160  else
161  {
162  INTREPID2_TEST_FOR_EXCEPTION(true,std::invalid_argument,"operator not yet supported");
163  }
164  }
165  };
166 } // end namespace Intrepid2
167 
168 #endif /* Intrepid2_DerivedBasis_HGRAD_HEX_h */
Implementation of bases that are tensor products of two or three component bases. ...
An abstract base class that defines interface for concrete basis implementations for Finite Element (...
void getValues(OutputViewType outputValues, const PointViewType inputPoints, const EOperator operatorType=OPERATOR_VALUE) const override
Evaluation of a FEM basis on a reference cell.
Implementation of H(grad) basis on the quadrilateral that is templated on H(grad) on the line...
virtual bool requireOrientation() const override
True if orientation is required.
virtual void getValues(OutputViewType outputValues, const EOperator operatorType, const PointViewType inputPoints1, const PointViewType inputPoints2, bool tensorPoints) const override
multi-component getValues() method (required/called by TensorBasis)
Basis_Derived_HGRAD_HEX(int polyOrder_x, int polyOrder_y, int polyOrder_z)
Constructor.
Basis defined as the tensor product of two component bases.