Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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  class SubcellConnectivity;
59 
60  template <typename Scalar>
62  public:
64 
67 
75 
83 
90  IntegrationValues2(const std::string & pre="",
91  const bool allocArrays=false);
92 
93 
94  // =====================================================================================================
95  // Classic Interface (DEPRECATED)
96 
99 
111  void evaluateValues(const PHX::MDField<Scalar,Cell,NODE,Dim> & cell_node_coordinates,
112  const int num_cells = -1,
113  const Teuchos::RCP<const SubcellConnectivity> & face_connectivity = Teuchos::null,
114  const int num_virtual_cells = -1);
115 
130  void evaluateValues(const PHX::MDField<Scalar,Cell,NODE,Dim> & cell_node_coordinates,
131  const PHX::MDField<Scalar,Cell,IP,Dim> & other_ip_coordinates,
132  const int num_cells = -1);
133 
134  // Reference space quantities
135  mutable Array_IPDim cub_points; // <IP,Dim>
136  mutable Array_IPDim side_cub_points; // <IP,Dim> points on face topology (dim-1)
137  mutable Array_IP cub_weights; // <IP>
138 
139  // Physical space quantities
140  mutable Array_CellBASISDim node_coordinates; // <Cell,BASIS,Dim>
141  mutable Array_CellIPDimDim jac; // <Cell,IP,Dim,Dim>
142  mutable Array_CellIPDimDim jac_inv; // <Cell,IP,Dim,Dim>
143  mutable Array_CellIP jac_det; // <Cell,IP>
144  mutable Array_CellIP weighted_measure; // <Cell,IP>
145  mutable Array_CellIPDim weighted_normals; // <Cell,IP,Dim>
146  mutable Array_CellIPDim surface_normals; // <Cell,IP,Dim>
147  mutable Array_CellIPDimDim surface_rotation_matrices; // <Cell,IP,Dim,Dim>
148  // this (appears) is a matrix where the first row is the "normal" direction
149  // and the remaining two rows lie in the hyperplane
150 
151  // for Shakib stabilization <Cell,IP,Dim,Dim>
155 
156  // integration points
157  mutable Array_CellIPDim ip_coordinates; // <Cell,IP,Dim>
158  mutable Array_CellIPDim ref_ip_coordinates; // <Cell,IP,Dim> for Control Volumes or Surface integrals
159 
160 
162 
164 
165  // =====================================================================================================
166  // Lazy evaluation interface
167 
190  void
192  const PHX::MDField<Scalar,Cell,NODE,Dim> & cell_node_coordinates,
193  const int num_cells = -1);
194 
205  void
207  const int num_virtual_cells);
208 
217  void
218  setupPermutations(const PHX::MDField<Scalar,Cell,IP,Dim> & other_ip_coordinates);
219 
233  getUniformCubaturePointsRef(const bool cache = true,
234  const bool force = false,
235  const bool apply_permutation = true) const;
236 
250  getUniformSideCubaturePointsRef(const bool cache = true,
251  const bool force = false,
252  const bool apply_permutation = true) const;
253 
267  getUniformCubatureWeightsRef(const bool cache = true,
268  const bool force = false,
269  const bool apply_permutation = true) const;
270 
271 
278  getNodeCoordinates() const;
279 
291  getJacobian(const bool cache = true,
292  const bool force = false) const;
293 
294 
306  getJacobianInverse(const bool cache = true,
307  const bool force = false) const;
308 
320  getJacobianDeterminant(const bool cache = true,
321  const bool force = false) const;
322 
334  getWeightedMeasure(const bool cache = true,
335  const bool force = false) const;
336 
348  getWeightedNormals(const bool cache = true,
349  const bool force = false) const;
350 
362  getSurfaceNormals(const bool cache = true,
363  const bool force = false) const;
364 
376  getSurfaceRotationMatrices(const bool cache = true,
377  const bool force = false) const;
378 
392  getCovarientMatrix(const bool cache = true,
393  const bool force = false) const;
394 
408  getContravarientMatrix(const bool cache = true,
409  const bool force = false) const;
410 
424  getNormContravarientMatrix(const bool cache = true,
425  const bool force = false) const;
426 
438  getCubaturePoints(const bool cache = true,
439  const bool force = false) const;
440 
452  getCubaturePointsRef(const bool cache = true,
453  const bool force = false) const;
454 
462  {return int_rule;}
463 
464  // =====================================================================================================
465 
466  protected:
467 
468  // Reset all the lazy evaluation arrays
469  void
470  resetArrays();
471 
472  // Number of cells in mesh
474 
475  // Number of cells in mesh to evaluate
477 
478  // Number of virtual cells in the mesh - used for surface evaluations
480 
481  // Permutations (used to re-orient arrays similar to orientations in BasisValues2)
483 
484  // Array contains the mapping from uniform reference space to permuted space
486 
487  // TODO: There is a way around this, but it will require some work
488  // Subcell connectivity is required for surface evaluations (normals and rotation matrices)
490 
491  // Lazy evaluation checks
492  mutable bool cub_points_evaluated_;
496  mutable bool jac_evaluated_;
497  mutable bool jac_inv_evaluated_;
498  mutable bool jac_det_evaluated_;
503  mutable bool covarient_evaluated_;
508 
509  // Backward compatibility call that evaluates all internal values for CV, surface, side, or volume integration schemes
510  void
512 
513  private:
514 
516  std::string prefix_;
517  std::vector<PHX::index_size_type> ddims_;
518 
519  };
520 
521 } // namespace panzer
522 
523 #endif
ConstArray_IPDim getUniformSideCubaturePointsRef(const bool cache=true, const bool force=false, const bool apply_permutation=true) const
Get the uniform cubature points for a side.
void setupPermutations(const Teuchos::RCP< const SubcellConnectivity > &face_connectivity, const int num_virtual_cells)
Initialize the permutation arrays given a face connectivity.
ConstArray_CellIPDimDim getContravarientMatrix(const bool cache=true, const bool force=false) const
Get the contravarient matrix.
PHX::MDField< Scalar, Cell, IP > Array_CellIP
PHX::MDField< Scalar, Point > Array_Point
void setup(const Teuchos::RCP< const panzer::IntegrationRule > &ir, const PHX::MDField< Scalar, Cell, NODE, Dim > &cell_node_coordinates, const int num_cells=-1)
Main setup call for the lazy evaluation interface.
ConstArray_CellIP getWeightedMeasure(const bool cache=true, const bool force=false) const
Get the weighted measure (integration weights)
PHX::MDField< const int, Cell, IP > permutations_
PHX::MDField< const Scalar, Point > ConstArray_Point
PHX::MDField< Scalar, IP > Array_IP
PHX::MDField< const Scalar, IP > ConstArray_IP
PHX::MDField< const Scalar, Cell, IP > ConstArray_CellIP
ConstArray_CellIPDimDim getJacobianInverse(const bool cache=true, const bool force=false) const
Get the inverse of the Jacobian matrix evaluated at the cubature points.
PHX::MDField< Scalar, Cell, IP, Dim, Dim > Array_CellIPDimDim
Teuchos::RCP< Intrepid2::Cubature< PHX::Device::execution_space, double, double > > intrepid_cubature
ConstArray_CellIPDimDim getCovarientMatrix(const bool cache=true, const bool force=false) const
Get the covarient matrix.
PHX::MDField< const Scalar, IP, Dim > ConstArray_IPDim
ConstArray_CellIPDim getWeightedNormals(const bool cache=true, const bool force=false) const
Get the weighted normals.
ConstArray_CellIP getNormContravarientMatrix(const bool cache=true, const bool force=false) const
Get the contravarient matrix.
Teuchos::RCP< const panzer::IntegrationRule > int_rule
ConstArray_CellIPDimDim getSurfaceRotationMatrices(const bool cache=true, const bool force=false) const
Get the surface rotation matrices.
PHX::MDField< Scalar, Cell, BASIS, Dim > Array_CellBASISDim
ArrayTraits< Scalar, PHX::MDField< Scalar > >::size_type size_type
ConstArray_CellIPDim getCubaturePoints(const bool cache=true, const bool force=false) const
Get the cubature points in physical space.
void setupArrays(const Teuchos::RCP< const panzer::IntegrationRule > &ir)
Sizes/allocates memory for arrays.
ConstArray_CellIPDim getCubaturePointsRef(const bool cache=true, const bool force=false) const
Get the cubature points in the reference space.
PHX::MDField< Scalar, Cell, IP, Dim > Array_CellIPDim
ConstArray_IPDim getUniformCubaturePointsRef(const bool cache=true, const bool force=false, const bool apply_permutation=true) const
Get the uniform cubature points.
ConstArray_CellIPDimDim getJacobian(const bool cache=true, const bool force=false) const
Get the Jacobian matrix evaluated at the cubature points.
PHX::MDField< double > DblArrayDynamic
Teuchos::RCP< const panzer::IntegrationRule > getIntegrationRule() const
Returns the IntegrationRule.
ConstArray_CellIP getJacobianDeterminant(const bool cache=true, const bool force=false) const
Get the determinant of the Jacobian matrix evaluated at the cubature points.
PHX::MDField< Scalar, IP, Dim > Array_IPDim
IntegrationValues2(const std::string &pre="", const bool allocArrays=false)
Base constructor.
PHX::MDField< const Scalar, Cell, IP, Dim > ConstArray_CellIPDim
ConstArray_CellBASISDim getNodeCoordinates() const
Get the node coordinates describing the geometry of the mesh.
std::vector< PHX::index_size_type > ddims_
void evaluateValues(const PHX::MDField< Scalar, Cell, NODE, Dim > &cell_node_coordinates, const int num_cells=-1, const Teuchos::RCP< const SubcellConnectivity > &face_connectivity=Teuchos::null, const int num_virtual_cells=-1)
Evaluate basis values.
ConstArray_IP getUniformCubatureWeightsRef(const bool cache=true, const bool force=false, const bool apply_permutation=true) const
Get the uniform cubature weights.
ConstArray_CellIPDim getSurfaceNormals(const bool cache=true, const bool force=false) const
Get the surface normals.
PHX::MDField< const Scalar, Cell, IP, Dim, Dim > ConstArray_CellIPDimDim
Teuchos::RCP< const SubcellConnectivity > side_connectivity_
PHX::MDField< const Scalar, Cell, BASIS, Dim > ConstArray_CellBASISDim