Panzer
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
disc-fe
src
Panzer_BasisDescriptor.cpp
Go to the documentation of this file.
1
// @HEADER
2
// ***********************************************************************
3
//
4
// Panzer: A partial differential equation assembly
5
// engine for strongly coupled complex multiphysics systems
6
// Copyright (2011) Sandia Corporation
7
//
8
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9
// the U.S. Government retains certain rights in this software.
10
//
11
// Redistribution and use in source and binary forms, with or without
12
// modification, are permitted provided that the following conditions are
13
// met:
14
//
15
// 1. Redistributions of source code must retain the above copyright
16
// notice, this list of conditions and the following disclaimer.
17
//
18
// 2. Redistributions in binary form must reproduce the above copyright
19
// notice, this list of conditions and the following disclaimer in the
20
// documentation and/or other materials provided with the distribution.
21
//
22
// 3. Neither the name of the Corporation nor the names of the
23
// contributors may be used to endorse or promote products derived from
24
// this software without specific prior written permission.
25
//
26
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37
//
38
// Questions? Contact Roger P. Pawlowski (rppawlo@sandia.gov) and
39
// Eric C. Cyr (eccyr@sandia.gov)
40
// ***********************************************************************
41
// @HEADER
42
43
#include "
Panzer_BasisDescriptor.hpp
"
44
45
#include "Phalanx_KokkosDeviceTypes.hpp"
46
47
#include "
Panzer_HashUtils.hpp
"
48
#include "
Panzer_IntrepidBasisFactory.hpp
"
49
#include "
Panzer_PointGenerator.hpp
"
// includes Kokkos::DynRankView
50
51
namespace
panzer
52
{
53
54
// Anonymous namespace that holds the coordinate generator,
55
// this hides any details about the generator from an external
56
// user and hopefully hides Kokkos from any file that doesn't need it.
57
namespace
{
58
61
class
BasisCoordsGenerator :
62
public
PointGenerator
{
63
public
:
64
BasisCoordsGenerator(
const
int
basis_order,
const
std::string & basis_type)
65
: _basis_type(basis_type), _basis_order(basis_order) {}
66
67
virtual
~BasisCoordsGenerator() =
default
;
68
69
virtual
Kokkos::DynRankView<double> getPoints(
const
shards::CellTopology & topo)
const override
70
{
71
Teuchos::RCP<Intrepid2::Basis<PHX::Device::execution_space,double,double> >
72
intrepid_basis =
createIntrepid2Basis<PHX::Device::execution_space,double,double>
(_basis_type,_basis_order,topo);
73
74
Kokkos::DynRankView<double> view(_basis_type+
"_ref_coords"
,intrepid_basis->getCardinality(),topo.getDimension());
75
76
intrepid_basis->getDofCoords(view);
77
78
return
view;
79
}
80
81
virtual
int
numPoints(
const
shards::CellTopology & topo)
const override
82
{
83
Teuchos::RCP<Intrepid2::Basis<PHX::Device::execution_space,double,double> >
84
intrepid_basis =
createIntrepid2Basis<PHX::Device::execution_space,double,double>
(_basis_type,_basis_order,topo);
85
return
intrepid_basis->getCardinality();
86
}
87
88
virtual
bool
hasPoints(
const
shards::CellTopology & topo)
const override
89
{
90
return
true
;
91
}
92
93
protected
:
94
std::string _basis_type;
95
int
_basis_order;
96
97
private
:
98
// hidden
99
BasisCoordsGenerator();
100
BasisCoordsGenerator(
const
BasisCoordsGenerator &);
101
};
102
103
}
// end namespace <anonymous>
104
105
106
BasisDescriptor::BasisDescriptor
():
107
_basis_type
(
"none"
),
108
_basis_order
(-1)
109
{
110
_key
= std::hash<BasisDescriptor>{}(*this);
111
}
112
113
BasisDescriptor::BasisDescriptor
(
const
int
basis_order,
const
std::string & basis_type):
114
_basis_type
(basis_type),
115
_basis_order
(basis_order)
116
{
117
_key
= std::hash<BasisDescriptor>{}(*this);
118
}
119
120
PointDescriptor
121
BasisDescriptor::
122
getPointDescriptor
()
const
123
{
124
using
Teuchos::RCP;
125
using
Teuchos::rcp;
126
127
std::stringstream ss;
128
ss <<
"cell_ref:"
<<
_basis_type
<<
"-"
<<
_basis_order
;
129
130
RCP<PointGenerator> generator = rcp(
new
BasisCoordsGenerator(
_basis_order
,
_basis_type
));
131
132
PointDescriptor
pd(ss.str(),generator);
133
134
return
pd;
135
}
136
137
}
// end namespace panzer
138
139
std::size_t
140
std::hash<panzer::BasisDescriptor>::operator()
(
const
panzer::BasisDescriptor
& desc)
const
141
{
142
std::size_t seed = 0;
143
144
panzer::hash_combine
(seed,desc.
getType
());
145
panzer::hash_combine
(seed,desc.
getOrder
());
146
147
return
seed;
148
}
149
Panzer_BasisDescriptor.hpp
Panzer_HashUtils.hpp
Panzer_IntrepidBasisFactory.hpp
Panzer_PointGenerator.hpp
panzer::BasisDescriptor
Definition
Panzer_BasisDescriptor.hpp:54
panzer::BasisDescriptor::_basis_order
int _basis_order
Definition
Panzer_BasisDescriptor.hpp:107
panzer::BasisDescriptor::getOrder
int getOrder() const
Get order of basis.
Definition
Panzer_BasisDescriptor.hpp:84
panzer::BasisDescriptor::_basis_type
std::string _basis_type
Basis type (HGrad, HDiv, HCurl,...).
Definition
Panzer_BasisDescriptor.hpp:104
panzer::BasisDescriptor::getType
const std::string & getType() const
Get type of basis.
Definition
Panzer_BasisDescriptor.hpp:78
panzer::BasisDescriptor::_key
std::size_t _key
Definition
Panzer_BasisDescriptor.hpp:110
panzer::BasisDescriptor::getPointDescriptor
PointDescriptor getPointDescriptor() const
Build a point descriptor that builds reference points for the DOF locations. This method throws if no...
Definition
Panzer_BasisDescriptor.cpp:122
panzer::BasisDescriptor::BasisDescriptor
BasisDescriptor()
Constructor for empty basis.
Definition
Panzer_BasisDescriptor.cpp:106
panzer::PointDescriptor
Definition
Panzer_PointDescriptor.hpp:60
panzer::PointGenerator
Definition
Panzer_PointGenerator.hpp:55
panzer
Computes .
Definition
Panzer_BasisValues_Evaluator_decl.hpp:54
panzer::createIntrepid2Basis
Teuchos::RCP< Intrepid2::Basis< ExecutionSpace, OutputValueType, PointValueType > > createIntrepid2Basis(const std::string basis_type, int basis_order, const shards::CellTopology &cell_topology)
Creates an Intrepid2::Basis object given the basis, order and cell topology.
Definition
Panzer_IntrepidBasisFactory.hpp:123
panzer::hash_combine
void hash_combine(std::size_t &seed, const T &v)
Definition
Panzer_HashUtils.hpp:30
std::hash< panzer::BasisDescriptor >::operator()
std::size_t operator()(const panzer::BasisDescriptor &desc) const
Definition
Panzer_BasisDescriptor.cpp:140
Generated by
1.17.0