Panzer
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
disc-fe
src
evaluators
Panzer_PointValues_Evaluator_impl.hpp
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
#ifndef PANZER_PointValues_Evaluator_IMPL_HPP
44
#define PANZER_PointValues_Evaluator_IMPL_HPP
45
46
#include <algorithm>
47
#include "
Panzer_PointRule.hpp
"
48
#include "
Panzer_Workset_Utilities.hpp
"
49
#include "
Panzer_CommonArrayFactories.hpp
"
50
51
namespace
panzer
{
52
53
//**********************************************************************
54
template
<
typename
EvalT,
typename
Traits>
55
PointValues_Evaluator<EvalT, Traits>::
56
PointValues_Evaluator
(
57
const
Teuchos::ParameterList& p)
58
{
59
basis_index
= 0;
60
61
Teuchos::RCP<const panzer::PointRule> pointRule
62
= p.get< Teuchos::RCP<const panzer::PointRule> >(
"Point Rule"
);
63
Teuchos::RCP<const Kokkos::DynRankView<double,PHX::Device> > userArray
64
= p.get<Teuchos::RCP<const Kokkos::DynRankView<double,PHX::Device> > >(
"Point Array"
);
65
66
initialize
(pointRule,userArray.ptr(),Teuchos::null);
67
}
68
69
//**********************************************************************
70
template
<
typename
EvalT,
typename
TRAITST>
71
PointValues_Evaluator<EvalT,TRAITST>::PointValues_Evaluator
(
const
Teuchos::RCP<const panzer::PointRule> & pointRule,
72
const
Kokkos::DynRankView<double,PHX::Device> & userArray)
73
{
74
basis_index
= 0;
75
76
initialize
(pointRule,Teuchos::ptrFromRef(userArray),Teuchos::null);
77
}
78
79
//**********************************************************************
80
template
<
typename
EvalT,
typename
TRAITST>
81
PointValues_Evaluator<EvalT,TRAITST>::PointValues_Evaluator
(
const
Teuchos::RCP<const panzer::PointRule> & pointRule,
82
const
PHX::MDField<double, panzer::IP, panzer::Dim> & userArray)
83
{
84
basis_index
= 0;
85
86
initialize
(pointRule,Teuchos::ptrFromRef(userArray),Teuchos::null);
87
}
88
89
//**********************************************************************
90
template
<
typename
EvalT,
typename
TRAITST>
91
PointValues_Evaluator<EvalT,TRAITST>::PointValues_Evaluator
(
const
Teuchos::RCP<const panzer::PointRule> & pointRule,
92
const
Teuchos::RCP<const panzer::PureBasis> & pureBasis)
93
{
94
basis_index
= 0;
95
96
Teuchos::Ptr<const PHX::MDField<double, panzer::IP, panzer::Dim> > userArray;
97
initialize
(pointRule,userArray,pureBasis);
98
}
99
100
//**********************************************************************
101
template
<
typename
EvalT,
typename
TRAITST>
102
template
<
typename
ArrayT>
103
void
PointValues_Evaluator<EvalT,TRAITST>::initialize
(
const
Teuchos::RCP<const panzer::PointRule> & pointRule,
104
const
Teuchos::Ptr<const ArrayT> & userArray,
105
const
Teuchos::RCP<const panzer::PureBasis> & pureBasis)
106
{
107
basis
= pureBasis;
108
109
if
(userArray!=Teuchos::null &&
basis
==Teuchos::null)
110
useBasisValuesRefArray
=
false
;
111
else
if
(userArray==Teuchos::null &&
basis
!=Teuchos::null)
112
useBasisValuesRefArray
=
true
;
113
else
{
114
// this is a conflicting request, throw an exception
115
TEUCHOS_ASSERT(
false
);
116
}
117
118
// copy user array data
119
if
(userArray!=Teuchos::null) {
120
TEUCHOS_ASSERT(userArray->rank()==2);
121
MDFieldArrayFactory
md_af(
"refPointArray"
,
true
);
122
123
refPointArray
= md_af.
buildStaticArray
<double,
NODE
,
Dim
>(
"refPointArray"
,userArray->extent(0),userArray->extent(1));
124
Kokkos::deep_copy(PHX::as_view(
refPointArray
), PHX::as_view(*userArray));
125
126
}
127
128
// setup all fields to be evaluated and constructed
129
pointValues
=
PointValues2<double>
(pointRule->getName()+
"_"
,
false
);
130
pointValues
.setupArrays(pointRule);
131
132
// the field manager will allocate all of these field
133
this->addEvaluatedField(
pointValues
.coords_ref);
134
this->addEvaluatedField(
pointValues
.node_coordinates);
135
this->addEvaluatedField(
pointValues
.jac);
136
this->addEvaluatedField(
pointValues
.jac_inv);
137
this->addEvaluatedField(
pointValues
.jac_det);
138
this->addEvaluatedField(
pointValues
.point_coords);
139
140
std::string n =
"PointValues_Evaluator: "
+ pointRule->getName();
141
this->setName(n);
142
}
143
144
//**********************************************************************
145
template
<
typename
EvalT,
typename
Traits>
146
void
147
PointValues_Evaluator<EvalT, Traits>::
148
postRegistrationSetup
(
149
typename
Traits::SetupData
sd,
150
PHX::FieldManager<Traits>
& fm)
151
{
152
// setup the pointers for evaluation
153
this->utils.setFieldData(
pointValues
.coords_ref,fm);
154
this->utils.setFieldData(
pointValues
.node_coordinates,fm);
155
this->utils.setFieldData(
pointValues
.jac,fm);
156
this->utils.setFieldData(
pointValues
.jac_inv,fm);
157
this->utils.setFieldData(
pointValues
.jac_det,fm);
158
this->utils.setFieldData(
pointValues
.point_coords,fm);
159
160
if
(
useBasisValuesRefArray
) {
161
basis_index
=
panzer::getPureBasisIndex
(
basis
->name(), (*sd.
worksets_
)[0], this->wda);
162
163
// basis better have coordinates if you want to use them! Assertion to protect
164
// a silent failure.
165
TEUCHOS_ASSERT(
basis
->supportsBasisCoordinates());
166
}
167
}
168
169
//**********************************************************************
170
template
<
typename
EvalT,
typename
Traits>
171
void
172
PointValues_Evaluator<EvalT, Traits>::
173
evaluateFields
(
174
typename
Traits::EvalData
workset)
175
{
176
if
(
useBasisValuesRefArray
) {
177
panzer::BasisValues2<double>
& basisValues = *this->
wda
(workset).bases[
basis_index
];
178
179
// evaluate the point values (construct jacobians etc...)
180
pointValues
.evaluateValues(this->
wda
(workset).cell_vertex_coordinates,
181
basisValues.
basis_coordinates_ref
,
182
workset.
num_cells
);
183
}
184
else
{
185
// evaluate the point values (construct jacobians etc...)
186
pointValues
.evaluateValues(this->
wda
(workset).cell_vertex_coordinates,
refPointArray
,
187
workset.
num_cells
);
188
}
189
}
190
191
//**********************************************************************
192
193
}
194
195
#endif
Panzer_CommonArrayFactories.hpp
Panzer_PointRule.hpp
Panzer_Workset_Utilities.hpp
PHX::FieldManager
Definition
Panzer_BCStrategy_Base.hpp:53
panzer::BasisValues2
Definition
Panzer_BasisValues2.hpp:100
panzer::BasisValues2::basis_coordinates_ref
Array_BasisDim basis_coordinates_ref
Definition
Panzer_BasisValues2.hpp:224
panzer::EvaluatorWithBaseImpl< Traits >::wda
WorksetDetailsAccessor wda
Definition
Panzer_Evaluator_WithBaseImpl.hpp:63
panzer::MDFieldArrayFactory
Definition
Panzer_CommonArrayFactories.hpp:86
panzer::MDFieldArrayFactory::buildStaticArray
PHX::MDField< Scalar, T0 > buildStaticArray(const std::string &str, int d0) const
Definition
Panzer_CommonArrayFactories_impl.hpp:167
panzer::PointValues2
Definition
Panzer_PointValues2.hpp:57
panzer::PointValues_Evaluator::basis
Teuchos::RCP< const panzer::PureBasis > basis
Definition
Panzer_PointValues_Evaluator_decl.hpp:85
panzer::PointValues_Evaluator::PointValues_Evaluator
PointValues_Evaluator(const Teuchos::ParameterList &p)
Definition
Panzer_PointValues_Evaluator_impl.hpp:56
panzer::PointValues_Evaluator::initialize
void initialize(const Teuchos::RCP< const panzer::PointRule > &pointRule, const Teuchos::Ptr< const ArrayT > &userArray, const Teuchos::RCP< const panzer::PureBasis > &pureBasis)
Initialization method to unify the constructors.
Definition
Panzer_PointValues_Evaluator_impl.hpp:103
panzer::PointValues_Evaluator::postRegistrationSetup
void postRegistrationSetup(typename Traits::SetupData d, PHX::FieldManager< Traits > &fm)
Definition
Panzer_PointValues_Evaluator_impl.hpp:148
panzer::PointValues_Evaluator::evaluateFields
void evaluateFields(typename Traits::EvalData d)
Definition
Panzer_PointValues_Evaluator_impl.hpp:173
panzer::PointValues_Evaluator::basis_index
std::size_t basis_index
Definition
Panzer_PointValues_Evaluator_decl.hpp:86
panzer::PointValues_Evaluator::useBasisValuesRefArray
bool useBasisValuesRefArray
Definition
Panzer_PointValues_Evaluator_decl.hpp:84
panzer::PointValues_Evaluator::refPointArray
PHX::MDField< double, NODE, Dim > refPointArray
Definition
Panzer_PointValues_Evaluator_decl.hpp:82
panzer::PointValues_Evaluator::pointValues
PointValues2< double > pointValues
Definition
Panzer_PointValues_Evaluator_decl.hpp:80
panzer::WorksetDetails::num_cells
int num_cells
DEPRECATED - use: numCells().
Definition
Panzer_Workset.hpp:116
panzer
Computes .
Definition
Panzer_BasisValues_Evaluator_decl.hpp:54
panzer::getPureBasisIndex
std::vector< std::string >::size_type getPureBasisIndex(std::string basis_name, const panzer::Workset &workset, WorksetDetailsAccessor &wda)
Returns the index in the workset bases for a particular PureBasis name.
Definition
Panzer_Workset_Utilities.cpp:57
panzer::NODE
BASIS NODE
Definition
Panzer_Dimension.hpp:77
panzer::Dim
Definition
Panzer_Dimension.hpp:74
panzer::Traits::SD::worksets_
Teuchos::RCP< const std::vector< panzer::Workset > > worksets_
Definition
Panzer_Traits.hpp:124
panzer::Traits::EvalData
const panzer::Workset & EvalData
Definition
Panzer_Traits.hpp:129
panzer::Traits::SetupData
const SD & SetupData
Definition
Panzer_Traits.hpp:127
Generated by
1.17.0