Panzer Version of the Day
Loading...
Searching...
No Matches
Panzer_BasisDescriptor.cpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Panzer: A partial differential equation assembly
4// engine for strongly coupled complex multiphysics systems
5//
6// Copyright 2011 NTESS and the Panzer contributors.
7// SPDX-License-Identifier: BSD-3-Clause
8// *****************************************************************************
9// @HEADER
10
12
13#include "Phalanx_KokkosDeviceTypes.hpp"
14
15#include "Panzer_HashUtils.hpp"
17#include "Panzer_PointGenerator.hpp" // includes Kokkos::DynRankView
18
19namespace panzer
20{
21
22// Anonymous namespace that holds the coordinate generator,
23// this hides any details about the generator from an external
24// user and hopefully hides Kokkos from any file that doesn't need it.
25namespace {
26
29class BasisCoordsGenerator :
30 public PointGenerator {
31public:
32 BasisCoordsGenerator(const int basis_order, const std::string & basis_type)
33 : _basis_type(basis_type), _basis_order(basis_order) {}
34
35 virtual ~BasisCoordsGenerator() = default;
36
37 virtual Kokkos::DynRankView<double> getPoints(const shards::CellTopology & topo) const override
38 {
39 Teuchos::RCP<Intrepid2::Basis<PHX::Device::execution_space,double,double> >
40 intrepid_basis = createIntrepid2Basis<PHX::Device::execution_space,double,double>(_basis_type,_basis_order,topo);
41
42 Kokkos::DynRankView<double> view(_basis_type+"_ref_coords",intrepid_basis->getCardinality(),topo.getDimension());
43
44 intrepid_basis->getDofCoords(view);
45
46 return view;
47 }
48
49 virtual int numPoints(const shards::CellTopology & topo) const override
50 {
51 Teuchos::RCP<Intrepid2::Basis<PHX::Device::execution_space,double,double> >
52 intrepid_basis = createIntrepid2Basis<PHX::Device::execution_space,double,double>(_basis_type,_basis_order,topo);
53 return intrepid_basis->getCardinality();
54 }
55
56 virtual bool hasPoints(const shards::CellTopology & topo) const override
57 {
58 return true;
59 }
60
61protected:
62 std::string _basis_type;
64
65private:
66 // hidden
67 BasisCoordsGenerator();
68 BasisCoordsGenerator(const BasisCoordsGenerator &);
69};
70
71} // end namespace <anonymous>
72
73
75 _basis_type("none"),
76 _basis_order(-1)
77{
78 _key = std::hash<BasisDescriptor>{}(*this);
79}
80
81BasisDescriptor::BasisDescriptor(const int basis_order, const std::string & basis_type):
82 _basis_type(basis_type),
83 _basis_order(basis_order)
84{
85 _key = std::hash<BasisDescriptor>{}(*this);
86}
87
91{
92 using Teuchos::RCP;
93 using Teuchos::rcp;
94
95 std::stringstream ss;
96 ss << "cell_ref:" << _basis_type << "-" << _basis_order;
97
98 RCP<PointGenerator> generator = rcp(new BasisCoordsGenerator(_basis_order,_basis_type));
99
100 PointDescriptor pd(ss.str(),generator);
101
102 return pd;
103}
104
106 const panzer::BasisDescriptor& right)
107{
108 return ( (left.getType() == right.getType()) &&
109 (left.getOrder() == right.getOrder()) );
110}
111
112} // end namespace panzer
113
114std::size_t
115std::hash<panzer::BasisDescriptor>::operator()(const panzer::BasisDescriptor& desc) const
116{
117 std::size_t seed = 0;
118
119 panzer::hash_combine(seed,desc.getType());
120 panzer::hash_combine(seed,desc.getOrder());
121
122 return seed;
123}
124
std::string _basis_type
int numPoints
int getOrder() const
Get order of basis.
std::string _basis_type
Basis type (HGrad, HDiv, HCurl, HVol)
const std::string & getType() const
Get type of basis.
PointDescriptor getPointDescriptor() const
Build a point descriptor that builds reference points for the DOF locations. This method throws if no...
BasisDescriptor()
Constructor for empty basis.
bool operator==(const panzer::BasisDescriptor &left, const panzer::BasisDescriptor &right)
void hash_combine(std::size_t &seed, const T &v)