Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_BasisIRLayout.cpp
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 #include "Panzer_BasisIRLayout.hpp"
44 #include "Panzer_PointRule.hpp"
46 #include "Teuchos_Assert.hpp"
47 #include "Phalanx_DataLayout_MDALayout.hpp"
49 
50 
51 // ***********************************************************************
52 // Nonmember ctors
53 
55 panzer::basisIRLayout(std::string basis_type, const int basis_order, const panzer::PointRule& pt_rule)
56 {
57  return Teuchos::rcp(new panzer::BasisIRLayout(basis_type,basis_order,pt_rule),true);
58 }
59 
62 {
63  return Teuchos::rcp(new panzer::BasisIRLayout(b,pt_rule),true);
64 }
65 
66 
67 // ***********************************************************************
68 // Class implementation
69 
71 BasisIRLayout(std::string basis_type, const int basis_order, const panzer::PointRule& point_rule)
72 {
73  basis_data_ = Teuchos::rcp(new PureBasis(basis_type,basis_order,point_rule.workset_size,point_rule.topology));
74 
75  setup(point_rule);
76 }
77 
80  basis_data_(b)
81 {
82  setup(point_rule);
83 }
84 
86 setup(const panzer::PointRule & point_rule)
87 {
88  basis_name_ = basis_data_->name() + ":" + point_rule.getName();
89  num_cells_ = point_rule.dl_vector->extent(0);
90  num_points_ = point_rule.dl_vector->extent(1);
91  dimension_ = point_rule.dl_vector->extent(2);
92 
93  using Teuchos::rcp;
94  using PHX::MDALayout;
95 
96  basis_ref = rcp(new MDALayout<BASIS,IP>(cardinality(), numPoints()));
97 
98  basis =
99  rcp(new MDALayout<Cell,BASIS,IP>(numCells(), cardinality(), numPoints()));
100 
101  basis_grad_ref =
102  rcp(new MDALayout<BASIS,IP,Dim>(cardinality(), numPoints(), dimension()));
103 
104  basis_grad = rcp(new MDALayout<Cell,BASIS,IP,Dim>(numCells(),
105  cardinality(),
106  numPoints(),
107  dimension()));
108 
109  basis_D2_ref = rcp(new MDALayout<BASIS,IP,Dim,Dim>(cardinality(),
110  numPoints(),
111  dimension(),
112  dimension()));
113 
114  basis_D2 = rcp(new MDALayout<Cell,BASIS,IP,Dim,Dim>(numCells(),
115  cardinality(),
116  numPoints(),
117  dimension(),
118  dimension()));
119 
120  functional = rcp(new MDALayout<Cell,BASIS>(numCells(), cardinality()));
121 
122  functional_grad = rcp(new MDALayout<Cell,BASIS,Dim>(numCells(),
123  cardinality(),
124  dimension()));
125 
126  functional_D2 = rcp(new MDALayout<Cell,BASIS,Dim,Dim>(numCells(),
127  cardinality(),
128  dimension(),
129  dimension()));
130 
131  const Teuchos::RCP<const shards::CellTopology>& topology = basis_data_->getCellTopology();
132  cell_topo_info = rcp(new panzer::CellTopologyInfo(numCells(), topology) );
133 
134 }
135 
137 {
138  return basis_data_->cardinality();
139 }
140 
142 {
143  return num_cells_;
144 }
145 
147 {
148  return num_points_;
149 }
150 
152 {
153  return dimension_;
154 }
155 
156 std::string panzer::BasisIRLayout::name() const
157 {
158  return basis_name_;
159 }
160 
162 {
163  return basis_data_->fieldName();
164 }
165 
167 {
168  return basis_data_->fieldNameD1();
169 }
170 
172 {
173  return basis_data_->fieldNameD2();
174 }
175 
178 {
179  return basis_data_->getIntrepid2Basis();
180 }
181 
184 {
185  return basis_data_;
186 }
187 
188 void panzer::BasisIRLayout::print(std::ostream & os) const
189 {
190  os << "Name = " << name()
191  << ", Dimension = " << dimension()
192  << ", Cells = " << numCells()
193  << ", Num Points = " << numPoints();
194 }
Teuchos::RCP< Intrepid2::Basis< PHX::Device::execution_space, double, double > > getIntrepid2Basis() const
BasisIRLayout(std::string basis_type, const int basis_order, const PointRule &int_rule)
void print(std::ostream &os) const
int numPoints
const std::string & getName() const
Teuchos::RCP< const PureBasis > getBasis() const
Teuchos::RCP< panzer::BasisIRLayout > basisIRLayout(std::string basis_type, const int basis_order, const PointRule &pt_rule)
Nonmember constructor.
std::string fieldNameD2() const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
std::string fieldName() const
Teuchos::RCP< const shards::CellTopology > topology
std::string name() const
Unique key for workset indexing composed of basis name and point rule name.
Teuchos::RCP< PHX::DataLayout > dl_vector
Data layout for vector fields.
std::string fieldNameD1() const
const int num_points_
void setup(const panzer::PointRule &int_rule)
Description and data layouts associated with a particular basis.
Teuchos::RCP< const PureBasis > basis_data_