Panzer Version of the Day
Loading...
Searching...
No Matches
Panzer_Traits.hpp
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
11#ifndef PANZER_TRAITS_HPP
12#define PANZER_TRAITS_HPP
13
14#include "PanzerDiscFE_config.hpp"
15
16// Teuchos includes
17#include "Teuchos_RCP.hpp"
18
19// mpl (Meta Programming Library) templates
20#include "Sacado_mpl_vector.hpp"
21#include "Sacado_mpl_find.hpp"
22
23// Scalar types
24#include "Sacado.hpp"
25//#include "Sacado_CacheFad_DFad.hpp"
26//#include "Sacado_ELRFad_DFad.hpp"
27//#include "Sacado_ELRCacheFad_DFad.hpp"
28
29#include "Phalanx_Traits.hpp"
30
31// Include User Data Types
32//#include "Phalanx_Allocator_Contiguous.hpp"
33#include "Panzer_Workset.hpp"
34//#include "Panzer_GlobalEvaluationDataContainer.hpp"
35
36// Debugging information
37//#include "Phalanx_Print.hpp"
38
39// forward declaration
40namespace Intrepid2 {
41class Orientation;
42}
43
44namespace panzer {
45
46 class GlobalEvaluationDataContainer;
47
63 struct Traits {
64
65 // ******************************************************************
66 // *** Scalar Types
67 // ******************************************************************
68
70 typedef double RealType;
71 // typedef Sacado::Fad::DFad<double> FadType;
72 // typedef Sacado::CacheFad::DFad<double> FadType;
73 // typedef Sacado::ELRFad::DFad<double> FadType;
74 // typedef Sacado::ELRCacheFad::DFad<double> FadType;
75 // typedef Sacado::Fad::SLFad<double,8> FadType;
77 typedef PANZER_FADTYPE FadType;
78
79#ifdef Panzer_BUILD_HESSIAN_SUPPORT
80 // typedef Sacado::Fad::SFad<FadType,1> HessianType;
82 typedef Sacado::Fad::DFad<Sacado::Fad::SFad<RealType,1> > HessianType;
83#endif
84
85 // ******************************************************************
86 // *** Evaluation Types
87 // ******************************************************************
88
90 struct Residual { typedef RealType ScalarT; };
92 struct Jacobian { typedef FadType ScalarT; };
94 struct Tangent { typedef FadType ScalarT; };
95
96#ifdef Panzer_BUILD_HESSIAN_SUPPORT
98 struct Hessian { typedef HessianType ScalarT; };
99#endif
100
102 typedef Sacado::mpl::vector< Residual
103 , Jacobian
104 , Tangent
105#ifdef Panzer_BUILD_HESSIAN_SUPPORT
106 , Hessian
107#endif
109
110 // ******************************************************************
111 // *** User Defined Object Passed in for Evaluation Method
112 // ******************************************************************
113
123 struct SD {
125 Teuchos::RCP<const std::vector<panzer::Workset>> worksets_;
127 Teuchos::RCP<const std::vector<Intrepid2::Orientation>> orientations_;
128 };
130 using SetupData = const SD&;
131
133 using EvalData = const panzer::Workset&;
134
139 struct PED {
141 PED();
143 Teuchos::RCP<GlobalEvaluationDataContainer> gedc;
148 };
150 using PreEvalData = const PED&;
151
153 typedef void* PostEvalData;
154
155 };
156
157}
158
159namespace PHX {
160
169 template<>
170 struct eval_scalar_types<panzer::Traits::Residual>
171 { typedef Sacado::mpl::vector<panzer::Traits::RealType,bool> type; };
172
174 template<>
175 struct eval_scalar_types<panzer::Traits::Jacobian>
176 { typedef Sacado::mpl::vector<panzer::Traits::FadType,panzer::Traits::RealType,bool> type; };
177
179 template<>
180 struct eval_scalar_types<panzer::Traits::Tangent>
181 { typedef Sacado::mpl::vector<panzer::Traits::FadType,panzer::Traits::RealType,bool> type; };
182
183#ifdef Panzer_BUILD_HESSIAN_SUPPORT
185 template<>
186 struct eval_scalar_types<panzer::Traits::Hessian>
187 { typedef Sacado::mpl::vector<panzer::Traits::HessianType,bool> type; };
188#endif
189
190}
191
192#endif
Sacado::mpl::vector< panzer::Traits::HessianType, bool > type
Sacado::mpl::vector< panzer::Traits::FadType, panzer::Traits::RealType, bool > type
Sacado::mpl::vector< panzer::Traits::RealType, bool > type
Sacado::mpl::vector< panzer::Traits::FadType, panzer::Traits::RealType, bool > type
Evaluation type for computing second derivatives, using HessianType as the scalar type....
Evaluation type for computing the residual and its Jacobian, using FadType as the scalar type.
User-defined data passed to PHX::Evaluator::preEvaluate(), called once before each residual/Jacobian ...
Teuchos::RCP< GlobalEvaluationDataContainer > gedc
Container of global (non-cell-local) data, e.g. distributed vectors needed by gather/scatter evaluato...
PED()
Default constructor. Allocates gedc.
std::string second_sensitivities_name
Name under which second-order sensitivity data is registered in gedc, if any.
std::string first_sensitivities_name
Name under which first-order sensitivity data is registered in gedc, if any.
Evaluation type for computing the residual only, using RealType as the scalar type.
User-defined data passed to PHX::Evaluator::postRegistrationSetup() during the one-time setup phase.
Teuchos::RCP< const std::vector< panzer::Workset > > worksets_
All worksets that will be evaluated over the lifetime of this evaluator.
Teuchos::RCP< const std::vector< Intrepid2::Orientation > > orientations_
Cell orientations corresponding to the worksets above.
Evaluation type for computing directional derivatives (e.g. parameter sensitivities),...
Panzer's specialization of the Phalanx traits class.
double RealType
Scalar type used for the Residual evaluation type (plain double).
PANZER_FADTYPE FadType
Sacado forward-mode AD scalar type used for the Jacobian and Tangent evaluation types.
Sacado::mpl::vector< Residual, Jacobian, Tangent, Hessian > EvalTypes
Sacado::mpl::vector enumerating all evaluation types supported by this build (Residual,...
Sacado::Fad::DFad< Sacado::Fad::SFad< RealType, 1 > > HessianType
Nested Sacado AD scalar type (FAD-over-FAD) used for the Hessian evaluation type. Only defined when b...
void * PostEvalData
Data type passed to PHX::Evaluator::postEvaluate(), called once after each residual/Jacobian fill....