Panzer  Version of the Day
Panzer_IntegrationValues2.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 
44 #ifndef PANZER_INTEGRATION_VALUES2_HPP
45 #define PANZER_INTEGRATION_VALUES2_HPP
46 
47 #include "Teuchos_RCP.hpp"
48 
49 #include "PanzerDiscFE_config.hpp"
51 #include "Panzer_ArrayTraits.hpp"
52 #include "Panzer_Dimension.hpp"
53 #include "Phalanx_MDField.hpp"
54 #include "Intrepid2_Cubature.hpp"
55 
56 namespace panzer {
57 
58  template <typename Scalar>
60  public:
62 
63  typedef PHX::MDField<Scalar> ArrayDynamic;
64  typedef PHX::MDField<double> DblArrayDynamic;
65 
66  typedef PHX::MDField<Scalar,IP> Array_IP;
67  typedef PHX::MDField<Scalar,IP,Dim> Array_IPDim;
68 
69  typedef PHX::MDField<Scalar,Point> Array_Point;
70  typedef PHX::MDField<Scalar,Cell,IP> Array_CellIP;
71  typedef PHX::MDField<Scalar,Cell,IP,Dim> Array_CellIPDim;
72  typedef PHX::MDField<Scalar,Cell,IP,Dim,Dim> Array_CellIPDimDim;
73 
74  typedef PHX::MDField<Scalar,Cell,BASIS,Dim> Array_CellBASISDim;
75 
76  IntegrationValues2(const std::string & pre="",bool allocArrays=false)
77  : alloc_arrays(allocArrays), prefix(pre), ddims_(1,0) {}
78 
80  void setupArrays(const Teuchos::RCP<const panzer::IntegrationRule>& ir);
81 
82  void setupArraysForNodeRule(const Teuchos::RCP<const panzer::IntegrationRule>& ir);
83 
85  void evaluateValues(const PHX::MDField<Scalar,Cell,NODE,Dim> & vertex_coordinates);
86 
88  //
89  // Optionally provide IP coordinates for an element 'other' that shares the
90  // same side. If provided, a permutation of the cubature points is
91  // calculated so that the integration values are ordered according to the
92  // other element's. This permutation is then applied so that all fields are
93  // ordered accordingly in their IP dimension.
94  void evaluateValues(const PHX::MDField<Scalar,Cell,NODE,Dim> & vertex_coordinates,
95  const PHX::MDField<Scalar,Cell,IP,Dim> & other_ip_coordinates);
96 
97  Array_IPDim cub_points; // <IP,Dim>
98  Array_IPDim side_cub_points; // <IP,Dim> points on face topology (dim-1)
101  Array_CellIPDimDim jac; // <Cell,IP,Dim,Dim>
102  Array_CellIPDimDim jac_inv; // <Cell,IP,Dim,Dim>
103  Array_CellIP jac_det; // <Cell,IP>
106 
109  // this (appears) is a matrix where the first row is the "normal" direction
110  // and the remaining two rows lie in the hyperplane
111 
112  Teuchos::RCP<const panzer::IntegrationRule> int_rule;
113 
114  Teuchos::RCP<Intrepid2::Cubature<PHX::Device::execution_space,double,double>> intrepid_cubature;
115 
116  // for Shakib stabilization <Cell,IP,Dim,Dim>
120 
121  // integration points
122  Array_CellIPDim ip_coordinates; // <Cell,IP,Dim>
123  Array_CellIPDim ref_ip_coordinates; // <Cell,IP,Dim> for Control Volumes or Surface integrals
124 
127 
128  Array_Point scratch_for_compute_side_measure; // <Point> size: span() == jac.span()
129 
130 
143  static void uniqueCoordOrdering(Array_CellIPDim & coords,
144  int cell,
145  int offset,
146  std::vector<int> & order);
147 
155  void swapQuadraturePoints(int cell,int a,int b);
156 
157  protected:
158 
159 
160 
161  // TODO: Make this a utility function that only exists in source file
162  Teuchos::RCP<Intrepid2::Cubature<PHX::Device::execution_space,double,double>> getIntrepidCubature(const panzer::IntegrationRule & ir) const;
163 
164 
165  private:
167  std::string prefix;
168  std::vector<PHX::index_size_type> ddims_;
169 
170  void generateSurfaceCubatureValues(const PHX::MDField<Scalar,Cell,NODE,Dim> & in_node_coordinates);
171  void getCubature(const PHX::MDField<Scalar,Cell,NODE,Dim> & in_node_coordinates);
172  void getCubatureCV(const PHX::MDField<Scalar,Cell,NODE,Dim> & in_node_coordinates);
173  void evaluateRemainingValues(const PHX::MDField<Scalar,Cell,NODE,Dim> & in_node_coordinates);
174  void evaluateValuesCV(const PHX::MDField<Scalar,Cell,NODE,Dim> & vertex_coordinates);
175  };
176 
177 } // namespace panzer
178 
179 #endif
void generateSurfaceCubatureValues(const PHX::MDField< Scalar, Cell, NODE, Dim > &in_node_coordinates)
void evaluateValues(const PHX::MDField< Scalar, Cell, NODE, Dim > &vertex_coordinates)
Cell vertex coordinates, not basis coordinates.
static void uniqueCoordOrdering(Array_CellIPDim &coords, int cell, int offset, std::vector< int > &order)
Using coordinate build an arrray that specifies a unique ordering.
IntegrationValues2(const std::string &pre="", bool allocArrays=false)
PHX::MDField< Scalar, Cell, IP > Array_CellIP
PHX::MDField< Scalar, Point > Array_Point
PHX::MDField< Scalar, IP > Array_IP
void evaluateRemainingValues(const PHX::MDField< Scalar, Cell, NODE, Dim > &in_node_coordinates)
void swapQuadraturePoints(int cell, int a, int b)
Swap the ordering of quadrature points in a specified cell.
PHX::MDField< Scalar, Cell, IP, Dim, Dim > Array_CellIPDimDim
Teuchos::RCP< Intrepid2::Cubature< PHX::Device::execution_space, double, double > > intrepid_cubature
Teuchos::RCP< const panzer::IntegrationRule > int_rule
Teuchos::RCP< Intrepid2::Cubature< PHX::Device::execution_space, double, double > > getIntrepidCubature(const panzer::IntegrationRule &ir) const
PHX::MDField< Scalar, Cell, BASIS, Dim > Array_CellBASISDim
ArrayTraits< Scalar, PHX::MDField< Scalar > >::size_type size_type
void setupArrays(const Teuchos::RCP< const panzer::IntegrationRule > &ir)
Sizes/allocates memory for arrays.
PHX::MDField< Scalar, Cell, IP, Dim > Array_CellIPDim
PHX::MDField< double > DblArrayDynamic
PHX::MDField< Scalar, IP, Dim > Array_IPDim
void getCubature(const PHX::MDField< Scalar, Cell, NODE, Dim > &in_node_coordinates)
void evaluateValuesCV(const PHX::MDField< Scalar, Cell, NODE, Dim > &vertex_coordinates)
std::vector< PHX::index_size_type > ddims_
void getCubatureCV(const PHX::MDField< Scalar, Cell, NODE, Dim > &in_node_coordinates)
void setupArraysForNodeRule(const Teuchos::RCP< const panzer::IntegrationRule > &ir)