Intrepid2
Intrepid2_HVOL_C0_FEM.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Intrepid2 Package
4//
5// Copyright 2007 NTESS and the Intrepid2 contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
15#ifndef __INTREPID2_HVOL_C0_FEM_HPP__
16#define __INTREPID2_HVOL_C0_FEM_HPP__
17
19#include "Intrepid2_Basis.hpp"
20
21namespace Intrepid2 {
22
23 namespace Impl {
24
29 public:
33 template<EOperator opType>
34 struct Serial {
35 template<typename OutputViewType,
36 typename inputViewType>
37 KOKKOS_INLINE_FUNCTION
38 static void
39 getValues( OutputViewType output,
40 const inputViewType input );
41
42 };
43
44 template<typename DeviceType,
45 typename outputValueValueType, class ...outputValueProperties,
46 typename inputPointValueType, class ...inputPointProperties>
47 static void
48 getValues( Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValues,
49 const Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPoints,
50 const EOperator operatorType);
51
55 template<typename outputValueViewType,
56 typename inputPointViewType,
57 EOperator opType>
58 struct Functor {
59 outputValueViewType _outputValues;
60 const inputPointViewType _inputPoints;
61
62 KOKKOS_INLINE_FUNCTION
63 Functor( outputValueViewType outputValues_,
64 inputPointViewType inputPoints_ )
65 : _outputValues(outputValues_), _inputPoints(inputPoints_) {}
66
67 KOKKOS_INLINE_FUNCTION
68 void operator()(const ordinal_type pt) const {
69 switch (opType) {
70 case OPERATOR_VALUE : {
71 auto output = Kokkos::subview( _outputValues, Kokkos::ALL(), pt );
72 const auto input = Kokkos::subview( _inputPoints, pt, Kokkos::ALL() );
73 Serial<opType>::getValues( output, input );
74 break;
75 }
76 case OPERATOR_MAX : {
77 auto output = Kokkos::subview( _outputValues, Kokkos::ALL(), pt, Kokkos::ALL() );
78 const auto input = Kokkos::subview( _inputPoints, pt, Kokkos::ALL() );
79 Serial<opType>::getValues( output, input );
80 break;
81 }
82 default: {
83 INTREPID2_TEST_FOR_ABORT( opType != OPERATOR_VALUE &&
84 opType != OPERATOR_MAX,
85 ">>> ERROR: (Intrepid2::Basis_HVOL_C0_FEM::Serial::getValues) operator is not supported");
86 }
87 }
88 }
89 };
90 };
91 }
92
96 template<typename DeviceType = void,
97 typename outputValueType = double,
98 typename pointValueType = double>
99 class Basis_HVOL_C0_FEM : public Basis<DeviceType,outputValueType,pointValueType> {
100
101 std::string basisName_;
102
103 public:
107
111
114 Basis_HVOL_C0_FEM(const shards::CellTopology& cellTopo);
115
119
120 using Basis<DeviceType,outputValueType,pointValueType>::getValues;
121
122 virtual
123 void
124 getValues( OutputViewType outputValues,
125 const PointViewType inputPoints,
126 const EOperator operatorType = OPERATOR_VALUE ) const override {
127#ifdef HAVE_INTREPID2_DEBUG
128 // Verify arguments
130 inputPoints,
131 operatorType,
132 this->getBaseCellTopology(),
133 this->getCardinality() );
134#endif
135 Impl::Basis_HVOL_C0_FEM::
136 getValues<DeviceType>( outputValues,
137 inputPoints,
138 operatorType );
139 }
140
141 virtual
142 void
143 getDofCoords( ScalarViewType dofCoords ) const override {
144#ifdef HAVE_INTREPID2_DEBUG
145 // Verify rank of output array.
146 INTREPID2_TEST_FOR_EXCEPTION( dofCoords.rank() != 2, std::invalid_argument,
147 ">>> ERROR: (Intrepid2::Basis_HVOL_C0_FEM::getDofCoords) rank = 2 required for dofCoords array");
148 // Verify 0th dimension of output array.
149 INTREPID2_TEST_FOR_EXCEPTION( static_cast<ordinal_type>(dofCoords.extent(0)) != this->getCardinality(), std::invalid_argument,
150 ">>> ERROR: (Intrepid2::Basis_HVOL_C0_FEM::getDofCoords) mismatch in number of dof and 0th dimension of dofCoords array");
151 // Verify 1st dimension of output array.
152 INTREPID2_TEST_FOR_EXCEPTION( dofCoords.extent(1) != this->getBaseCellTopology().getDimension(), std::invalid_argument,
153 ">>> ERROR: (Intrepid2::Basis_HVOL_C0_FEM::getDofCoords) incorrect reference cell (1st) dimension in dofCoords array");
154#endif
155 Kokkos::deep_copy(dofCoords, this->dofCoords_);
156 }
157
158 virtual
159 void
160 getDofCoeffs( ScalarViewType dofCoeffs ) const override {
161#ifdef HAVE_INTREPID2_DEBUG
162 // Verify rank of output array.
163 INTREPID2_TEST_FOR_EXCEPTION( dofCoeffs.rank() != 1, std::invalid_argument,
164 ">>> ERROR: (Intrepid2::Basis_HVOL_C0_FEM::getdofCoeffs) rank = 1 required for dofCoeffs array");
165 // Verify 0th dimension of output array.
166 INTREPID2_TEST_FOR_EXCEPTION( static_cast<ordinal_type>(dofCoeffs.extent(0)) != this->getCardinality(), std::invalid_argument,
167 ">>> ERROR: (Intrepid2::Basis_HVOL_C0_FEM::getdofCoeffs) mismatch in number of dof and 0th dimension of dofCoeffs array");
168#endif
169 Kokkos::deep_copy(dofCoeffs, 1.0);
170 }
171
172 virtual
173 const char* getName() const override {
174 return basisName_.c_str();
175 }
176
181 };
182}
183
185
186#endif
Header file for the abstract base class Intrepid2::Basis.
BasisPtr< typename Kokkos::HostSpace::device_type, OutputType, PointType > HostBasisPtr
Pointer to a Basis whose device type is on the host (Kokkos::HostSpace::device_type),...
void getValues_HGRAD_Args(const outputValueViewType outputValues, const inputPointViewType inputPoints, const EOperator operatorType, const shards::CellTopology cellTopo, const ordinal_type basisCard)
Runtime check of the arguments for the getValues method in an HGRAD-conforming FEM basis....
Header file for the Intrepid2::CellTools class.
Definition file FEM basis functions of degree 0 for H(vol) functions on all supported topologies.
Implementation of the default HVOL-compatible FEM contstant basis on triangle, quadrilateral,...
Basis_HVOL_C0_FEM()=delete
Constructor.
virtual HostBasisPtr< outputValueType, pointValueType > getHostBasis() const override
Creates and returns a Basis object whose DeviceType template argument is Kokkos::HostSpace::device_ty...
virtual const char * getName() const override
Returns basis name.
An abstract base class that defines interface for concrete basis implementations for Finite Element (...
Kokkos::DynRankView< PointValueType, Kokkos::LayoutStride, DeviceType > PointViewType
View type for input points.
Kokkos::DynRankView< OutputValueType, Kokkos::LayoutStride, DeviceType > OutputViewType
View type for basis value output.
Kokkos::View< ordinal_type ***, typename ExecutionSpace::array_layout, Kokkos::HostSpace > OrdinalTypeArray3DHost
View type for 3d host array.
ordinal_type getCardinality() const
Returns cardinality of the basis.
Kokkos::DynRankView< scalarType, Kokkos::LayoutStride, DeviceType > ScalarViewType
View type for scalars.
Device DeviceType
(Kokkos) Device type on which Basis is templated. Does not necessarily return true for Kokkos::is_dev...
Kokkos::DynRankView< scalarType, DeviceType > dofCoords_
Coordinates of degrees-of-freedom for basis functions defined in physical space.
Kokkos::View< ordinal_type **, typename ExecutionSpace::array_layout, Kokkos::HostSpace > OrdinalTypeArray2DHost
View type for 2d host array.
shards::CellTopology getBaseCellTopology() const
Returns the base cell topology for which the basis is defined. See Shards documentation https://trili...
Kokkos::View< ordinal_type *, typename ExecutionSpace::array_layout, Kokkos::HostSpace > OrdinalTypeArray1DHost
View type for 1d host array.
See Intrepid2::Basis_HVOL_C0_FEM.