Panzer  Version of the Day
Panzer_Workset.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_WORKSET_HPP
45 #define PANZER_WORKSET_HPP
46 
47 #include <cstddef>
48 #include <vector>
49 #include <map>
50 #include <iostream>
51 
52 #include "Panzer_Dimension.hpp"
53 #include "Panzer_BasisValues2.hpp"
55 #include "Panzer_Dimension.hpp"
56 
57 #include "Phalanx_KokkosDeviceTypes.hpp"
58 
59 namespace panzer {
60 
61  class LinearObjContainer;
62 
67  struct WorksetDetails {
68  typedef PHX::MDField<double,Cell,NODE,Dim> CellCoordArray;
69 
70  Kokkos::View<const int*,PHX::Device> cell_local_ids_k;
71  std::vector<std::size_t> cell_local_ids;
73  std::string block_id;
74 
76 
78  Teuchos::RCP< std::vector<int> > ir_degrees;
79 
80  std::vector<Teuchos::RCP<panzer::IntegrationValues2<double> > > int_rules;
81 
83  Teuchos::RCP< std::vector<std::string> > basis_names;
84 
86  std::vector<Teuchos::RCP< panzer::BasisValues2<double> > > bases;
87  };
88 
93  struct Workset : public WorksetDetails {
94  Workset() {}
95 
96  index_t num_cells;
98 
99  double alpha;
100  double beta;
101  double time;
102  double step_size;
103  double stage_number;
104  std::vector<double> gather_seeds; // generic gather seeds
106 
110  Teuchos::RCP<WorksetDetails> other;
111 
113  WorksetDetails& operator()(const int i) {
114  TEUCHOS_ASSERT(i == 0 || (i == 1 && Teuchos::nonnull(other)));
115  return i == 0 ? static_cast<WorksetDetails&>(*this) : *other;
116  }
118  const WorksetDetails& operator()(const int i) const {
119  TEUCHOS_ASSERT(i == 0 || (i == 1 && Teuchos::nonnull(other)));
120  return i == 0 ? static_cast<const WorksetDetails&>(*this) : *other;
121  }
123  WorksetDetails& details(const int i) { return operator()(i); }
124  const WorksetDetails& details(const int i) const { return operator()(i); }
126  size_t numDetails() const { return Teuchos::nonnull(other) ? 2 : 1; }
127  };
128 
129  std::ostream& operator<<(std::ostream& os, const panzer::Workset& w);
130 
138  public:
142  void setDetailsIndex(const int di) { details_index_ = di; }
145  int getDetailsIndex() const { return details_index_; }
147  WorksetDetails& operator()(Workset& workset) const {
148  return workset(details_index_);
149  }
151  const WorksetDetails& operator()(const Workset& workset) const {
152  return workset(details_index_);
153  }
154  private:
156  };
157 
158 } // namespace panzer
159 
160 #endif
std::vector< std::size_t > cell_local_ids
double alpha
If workset corresponds to a sub cell, what is the dimension?
void setDetailsIndex(const int di)
An evaluator builder sets the details index.
Teuchos::RCP< std::vector< int > > ir_degrees
If workset corresponds to a sub cell, what is the index?
std::vector< double > gather_seeds
PHX::MDField< double, Cell, NODE, Dim > CellCoordArray
Kokkos::View< const int *, PHX::Device > cell_local_ids_k
size_t numDetails() const
Return the number of WorksetDetails this Workset holds.
Teuchos::RCP< std::vector< std::string > > basis_names
Value corresponds to basis type. Use the offest for indexing.
std::vector< Teuchos::RCP< panzer::IntegrationValues2< double > > > int_rules
CellCoordArray cell_vertex_coordinates
WorksetDetailsAccessor()
Default value is 0, which is backwards compatible.
const WorksetDetails & operator()(const Workset &workset) const
const accessor.
const WorksetDetails & operator()(const int i) const
const accessor.
WorksetDetails & operator()(const int i)
op(0) return *this; op(1) returns *other.
std::ostream & operator<<(std::ostream &os, const AssemblyEngineInArgs &in)
WorksetDetails & operator()(Workset &workset) const
Workset wrapper to extract the correct details. Example: wda(workset).bases[i].
Teuchos::RCP< WorksetDetails > other
std::vector< Teuchos::RCP< panzer::BasisValues2< double > > > bases
Static basis function data, key is basis name, value is index in the static_bases vector...
WorksetDetails & details(const int i)
Convenience wrapper to operator() for pointer access.
const WorksetDetails & details(const int i) const