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 // 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_INTEGRATION_VALUES2_HPP
12 #define PANZER_INTEGRATION_VALUES2_HPP
13 
14 #include "Teuchos_RCP.hpp"
15 
16 #include "PanzerDiscFE_config.hpp"
18 #include "Panzer_ArrayTraits.hpp"
19 #include "Panzer_Dimension.hpp"
20 #include "Phalanx_MDField.hpp"
21 #include "Intrepid2_Cubature.hpp"
22 
23 namespace panzer {
24 
25  class SubcellConnectivity;
26 
27  template <typename Scalar>
29  public:
31 
34 
42 
50 
57  IntegrationValues2(const std::string & pre="",
58  const bool allocArrays=false);
59 
60 
61  // =====================================================================================================
62  // Classic Interface (DEPRECATED)
63 
66 
78  void evaluateValues(const PHX::MDField<Scalar,Cell,NODE,Dim> & cell_node_coordinates,
79  const int num_cells = -1,
80  const Teuchos::RCP<const SubcellConnectivity> & face_connectivity = Teuchos::null,
81  const int num_virtual_cells = -1);
82 
97  void evaluateValues(const PHX::MDField<Scalar,Cell,NODE,Dim> & cell_node_coordinates,
98  const PHX::MDField<Scalar,Cell,IP,Dim> & other_ip_coordinates,
99  const int num_cells = -1);
100 
101  // Reference space quantities
102  mutable Array_IPDim cub_points; // <IP,Dim>
103  mutable Array_IPDim side_cub_points; // <IP,Dim> points on face topology (dim-1)
104  mutable Array_IP cub_weights; // <IP>
105 
106  // Physical space quantities
107  mutable Array_CellBASISDim node_coordinates; // <Cell,BASIS,Dim>
108  mutable Array_CellIPDimDim jac; // <Cell,IP,Dim,Dim>
109  mutable Array_CellIPDimDim jac_inv; // <Cell,IP,Dim,Dim>
110  mutable Array_CellIP jac_det; // <Cell,IP>
111  mutable Array_CellIP weighted_measure; // <Cell,IP>
112  mutable Array_CellIPDim weighted_normals; // <Cell,IP,Dim>
113  mutable Array_CellIPDim surface_normals; // <Cell,IP,Dim>
114  mutable Array_CellIPDimDim surface_rotation_matrices; // <Cell,IP,Dim,Dim>
115  // this (appears) is a matrix where the first row is the "normal" direction
116  // and the remaining two rows lie in the hyperplane
117 
118  // for Shakib stabilization <Cell,IP,Dim,Dim>
122 
123  // integration points
124  mutable Array_CellIPDim ip_coordinates; // <Cell,IP,Dim>
125  mutable Array_CellIPDim ref_ip_coordinates; // <Cell,IP,Dim> for Control Volumes or Surface integrals
126 
127 
129 
131 
132  // =====================================================================================================
133  // Lazy evaluation interface
134 
157  void
159  const PHX::MDField<Scalar,Cell,NODE,Dim> & cell_node_coordinates,
160  const int num_cells = -1);
161 
172  void
174  const int num_virtual_cells);
175 
184  void
185  setupPermutations(const PHX::MDField<Scalar,Cell,IP,Dim> & other_ip_coordinates);
186 
200  getUniformCubaturePointsRef(const bool cache = true,
201  const bool force = false,
202  const bool apply_permutation = true) const;
203 
217  getUniformSideCubaturePointsRef(const bool cache = true,
218  const bool force = false,
219  const bool apply_permutation = true) const;
220 
234  getUniformCubatureWeightsRef(const bool cache = true,
235  const bool force = false,
236  const bool apply_permutation = true) const;
237 
238 
245  getNodeCoordinates() const;
246 
258  getJacobian(const bool cache = true,
259  const bool force = false) const;
260 
261 
273  getJacobianInverse(const bool cache = true,
274  const bool force = false) const;
275 
287  getJacobianDeterminant(const bool cache = true,
288  const bool force = false) const;
289 
301  getWeightedMeasure(const bool cache = true,
302  const bool force = false) const;
303 
315  getWeightedNormals(const bool cache = true,
316  const bool force = false) const;
317 
329  getSurfaceNormals(const bool cache = true,
330  const bool force = false) const;
331 
343  getSurfaceRotationMatrices(const bool cache = true,
344  const bool force = false) const;
345 
359  getCovarientMatrix(const bool cache = true,
360  const bool force = false) const;
361 
375  getContravarientMatrix(const bool cache = true,
376  const bool force = false) const;
377 
391  getNormContravarientMatrix(const bool cache = true,
392  const bool force = false) const;
393 
405  getCubaturePoints(const bool cache = true,
406  const bool force = false) const;
407 
419  getCubaturePointsRef(const bool cache = true,
420  const bool force = false) const;
421 
429  {return int_rule;}
430 
431  // =====================================================================================================
432 
433  protected:
434 
435  // Reset all the lazy evaluation arrays
436  void
437  resetArrays();
438 
439  // Number of cells in mesh
441 
442  // Number of cells in mesh to evaluate
444 
445  // Number of virtual cells in the mesh - used for surface evaluations
447 
448  // Permutations (used to re-orient arrays similar to orientations in BasisValues2)
450 
451  // Array contains the mapping from uniform reference space to permuted space
453 
454  // TODO: There is a way around this, but it will require some work
455  // Subcell connectivity is required for surface evaluations (normals and rotation matrices)
457 
458  // Lazy evaluation checks
459  mutable bool cub_points_evaluated_;
463  mutable bool jac_evaluated_;
464  mutable bool jac_inv_evaluated_;
465  mutable bool jac_det_evaluated_;
470  mutable bool covarient_evaluated_;
475 
476  // Backward compatibility call that evaluates all internal values for CV, surface, side, or volume integration schemes
477  void
479 
480  private:
481 
483  std::string prefix_;
484  std::vector<PHX::index_size_type> ddims_;
485 
486  };
487 
488 } // namespace panzer
489 
490 #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