Panzer  Version of the Day
Panzer_PointValues2_impl.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_POINT_VALUES2_IMPL_HPP
44 #define PANZER_POINT_VALUES2_IMPL_HPP
45 
46 #include "Intrepid2_CellTools.hpp"
47 
48 // ***********************************************************
49 // * Evaluation and SetupArrays are NOT specialized
50 // ***********************************************************
51 
52 namespace panzer {
53 
54  template <typename Scalar,
55  template <typename DataT,
56  typename Tag0, typename Tag1, typename Tag2,
57  typename Tag3, typename Tag4, typename Tag5,
58  typename Tag6, typename Tag7> class Array >
59  template <typename ArrayFactory>
60  void PointValues2<Scalar,Array>::
61  setupArrays(const Teuchos::RCP<const PointRule> & pr, const ArrayFactory & af)
62  {
63  point_rule = pr;
64 
65  int num_nodes = point_rule->topology->getNodeCount();
66  int num_cells = point_rule->workset_size;
67  int num_space_dim = point_rule->spatial_dimension;
68 
69  if (point_rule->isSide()) {
70  TEUCHOS_ASSERT(false); // not implemented!!!!
71  }
72 
73  int num_points = point_rule->num_points;
74 
75  coords_ref = af.template buildStaticArray<Scalar,IP,Dim>("coords_ref",num_points, num_space_dim);
76 
77  node_coordinates = af.template buildStaticArray<Scalar,Cell,NODE,Dim>("node_coordinates",num_cells, num_nodes, num_space_dim);
78 
79  jac = af.template buildStaticArray<Scalar,Cell,IP,Dim,Dim>("jac",num_cells, num_points, num_space_dim,num_space_dim);
80  jac_inv = af.template buildStaticArray<Scalar,Cell,IP,Dim,Dim>("jac_inv",num_cells, num_points, num_space_dim,num_space_dim);
81  jac_det = af.template buildStaticArray<Scalar,Cell,IP>("jac_det",num_cells, num_points);
82 
83  point_coords = af.template buildStaticArray<Scalar,Cell,IP,Dim>("point_coords",num_cells, num_points, num_space_dim);
84  }
85 
86  template <typename Scalar,
87  template <typename DataT,
88  typename Tag0, typename Tag1, typename Tag2,
89  typename Tag3, typename Tag4, typename Tag5,
90  typename Tag6, typename Tag7> class Array >
91  template <typename CoordinateArray>
92  void PointValues2<Scalar,Array>::
93  copyNodeCoords(const CoordinateArray& in_node_coords)
94  {
95  // copy cell node coordinates
96  {
97  size_type num_cells = in_node_coords.dimension(0);
98  size_type num_nodes = in_node_coords.dimension(1);
99  size_type num_dims = in_node_coords.dimension(2);
100 
101  for (size_type cell = 0; cell < num_cells; ++cell)
102  for (size_type node = 0; node < num_nodes; ++node)
103  for (size_type dim = 0; dim < num_dims; ++dim)
104  node_coordinates(cell,node,dim) = in_node_coords(cell,node,dim);
105  }
106  }
107 
108  template <typename Scalar,
109  template <typename DataT,
110  typename Tag0, typename Tag1, typename Tag2,
111  typename Tag3, typename Tag4, typename Tag5,
112  typename Tag6, typename Tag7> class Array >
113  template <typename CoordinateArray>
114  void PointValues2<Scalar,Array>::
115  copyPointCoords(const CoordinateArray& in_point_coords)
116  {
117  // copy reference point values
118  {
119  size_type num_points = in_point_coords.dimension(0);
120  size_type num_dims = in_point_coords.dimension(1);
121 
122  for (size_type point = 0; point < num_points; ++point)
123  for (size_type dim = 0; dim < num_dims; ++dim)
124  coords_ref(point,dim) = in_point_coords(point,dim);
125  }
126  }
127 
128 }
129 
130 #endif
ArrayTraits< ScalarT, PHX::MDField< ScalarT, void, void, void, void, void, void, void, void > >::size_type size_type
#define TEUCHOS_ASSERT(assertion_test)