Panzer Version of the Day
Loading...
Searching...
No Matches
Panzer_Traits.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_TRAITS_HPP
44#define PANZER_TRAITS_HPP
45
46#include "PanzerDiscFE_config.hpp"
47
48// Teuchos includes
49#include "Teuchos_RCP.hpp"
50
51// mpl (Meta Programming Library) templates
52#include "Sacado_mpl_vector.hpp"
53#include "Sacado_mpl_find.hpp"
54
55// Scalar types
56#include "Sacado.hpp"
57//#include "Sacado_CacheFad_DFad.hpp"
58//#include "Sacado_ELRFad_DFad.hpp"
59//#include "Sacado_ELRCacheFad_DFad.hpp"
60
61#include "Phalanx_Traits.hpp"
62
63// Include User Data Types
64//#include "Phalanx_Allocator_Contiguous.hpp"
65#include "Panzer_Workset.hpp"
66//#include "Panzer_GlobalEvaluationDataContainer.hpp"
67
68// Debugging information
69//#include "Phalanx_Print.hpp"
70
71// forward declaration
72namespace Intrepid2 {
73class Orientation;
74}
75
76namespace panzer {
77
78 class GlobalEvaluationDataContainer;
79
80 struct Traits {
81
82 // ******************************************************************
83 // *** Scalar Types
84 // ******************************************************************
85
86 // Scalar types we plan to use
87 typedef double RealType;
88 // typedef Sacado::Fad::DFad<double> FadType;
89 // typedef Sacado::CacheFad::DFad<double> FadType;
90 // typedef Sacado::ELRFad::DFad<double> FadType;
91 // typedef Sacado::ELRCacheFad::DFad<double> FadType;
92 // typedef Sacado::Fad::SLFad<double,8> FadType;
93 typedef PANZER_FADTYPE FadType;
94
95#ifdef Panzer_BUILD_HESSIAN_SUPPORT
96 // typedef Sacado::Fad::SFad<FadType,1> HessianType;
97 typedef Sacado::Fad::DFad<Sacado::Fad::SFad<RealType,1> > HessianType;
98#endif
99
100 // ******************************************************************
101 // *** Evaluation Types
102 // ******************************************************************
103 struct Residual { typedef RealType ScalarT; };
104 struct Jacobian { typedef FadType ScalarT; };
105 struct Tangent { typedef FadType ScalarT; };
106
107#ifdef Panzer_BUILD_HESSIAN_SUPPORT
108 struct Hessian { typedef HessianType ScalarT; };
109#endif
110
111 typedef Sacado::mpl::vector< Residual
112 , Jacobian
113 , Tangent
114#ifdef Panzer_BUILD_HESSIAN_SUPPORT
115 , Hessian
116#endif
118
119 // ******************************************************************
120 // *** User Defined Object Passed in for Evaluation Method
121 // ******************************************************************
122
123 struct SD {
124 Teuchos::RCP<const std::vector<panzer::Workset>> worksets_;
125 Teuchos::RCP<const std::vector<Intrepid2::Orientation>> orientations_;
126 };
127 using SetupData = const SD&;
128
129 using EvalData = const panzer::Workset&;
130
131 struct PED {
132 PED();
133 Teuchos::RCP<GlobalEvaluationDataContainer> gedc;
136 };
137 using PreEvalData = const PED&;
138
139 typedef void* PostEvalData;
140
141 };
142
143}
144
145namespace PHX {
146
147 template<>
148 struct eval_scalar_types<panzer::Traits::Residual>
149 { typedef Sacado::mpl::vector<panzer::Traits::RealType,bool> type; };
150
151 template<>
152 struct eval_scalar_types<panzer::Traits::Jacobian>
153 { typedef Sacado::mpl::vector<panzer::Traits::FadType,panzer::Traits::RealType,bool> type; };
154
155 template<>
156 struct eval_scalar_types<panzer::Traits::Tangent>
157 { typedef Sacado::mpl::vector<panzer::Traits::FadType,panzer::Traits::RealType,bool> type; };
158
159#ifdef Panzer_BUILD_HESSIAN_SUPPORT
160 template<>
161 struct eval_scalar_types<panzer::Traits::Hessian>
162 { typedef Sacado::mpl::vector<panzer::Traits::HessianType,bool> type; };
163#endif
164
165}
166
167#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
Teuchos::RCP< GlobalEvaluationDataContainer > gedc
std::string second_sensitivities_name
std::string first_sensitivities_name
Teuchos::RCP< const std::vector< panzer::Workset > > worksets_
Teuchos::RCP< const std::vector< Intrepid2::Orientation > > orientations_
PANZER_FADTYPE FadType
Sacado::mpl::vector< Residual, Jacobian, Tangent, Hessian > EvalTypes
Sacado::Fad::DFad< Sacado::Fad::SFad< RealType, 1 > > HessianType