Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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"
54 #include "Panzer_PointValues2.hpp"
56 #include "Panzer_Dimension.hpp"
57 
60 
61 #include "Phalanx_KokkosDeviceTypes.hpp"
62 
63 namespace panzer {
64 
65  struct WorksetNeeds;
66 
67  struct LocalMeshPartition;
68 
69  class SubcellConnectivity;
70 
76  public:
77  typedef PHX::MDField<double,Cell,NODE,Dim> CellCoordArray;
78 
79  typedef std::size_t GO;
80  typedef int LO;
81 
84  : _num_owned_cells(-1)
85  , _num_ghost_cells(-1)
86  , _num_virtual_cells(-1)
87  { }
88 
90  void setup(const panzer::LocalMeshPartition & partition, const panzer::WorksetNeeds & needs);
91 
93  const Kokkos::View<double***,PHX::Device> & cell_vertices,
94  const panzer::WorksetNeeds & needs);
95 
96  Kokkos::View<const int*,PHX::Device> cell_local_ids_k;
97  std::vector<GO> cell_local_ids;
99  std::string block_id;
100 
102 
104  //TEUCHOS_DEPRECATED
106 
107  //TEUCHOS_DEPRECATED
108  std::vector<Teuchos::RCP<panzer::IntegrationValues2<double> > > int_rules;
109 
111  //TEUCHOS_DEPRECATED
113 
115  //TEUCHOS_DEPRECATED
116  std::vector<Teuchos::RCP< panzer::BasisValues2<double> > > bases;
117 
120 
123 
126 
129  const panzer::IntegrationDescriptor & integration_description);
130 
132  const panzer::BasisValues2<double> & getBasisValues(const panzer::BasisDescriptor & basis_description,
133  const panzer::IntegrationDescriptor & integration_description) const;
134 
136  const panzer::BasisValues2<double> & getBasisValues(const panzer::BasisDescriptor & basis_description,
137  const panzer::PointDescriptor & point_description) const;
138 
140  const panzer::PointValues2<double> & getPointValues(const panzer::PointDescriptor & point_description) const;
141 
143  const panzer::PureBasis & getBasis(const panzer::BasisDescriptor & description) const;
144 
146  int numOwnedCells() const {return _num_owned_cells;}
147 
149  int numGhostCells() const {return _num_ghost_cells;}
150 
152  int numVirtualCells() const {return _num_virtual_cells;}
153 
155  void setNumberOfCells(int o_cells,int g_cells,int v_cells)
156  {
157  _num_owned_cells = o_cells;
158  _num_ghost_cells = g_cells;
159  _num_virtual_cells = v_cells;
160  }
161 
162  protected:
163 
167 
168  std::map<size_t,Teuchos::RCP<const panzer::IntegrationRule > > _integration_rule_map;
169  std::map<size_t,Teuchos::RCP<const panzer::IntegrationValues2<double> > > _integrator_map;
170 
171  std::map<size_t,Teuchos::RCP<const panzer::PureBasis > > _pure_basis_map;
172  std::map<size_t,std::map<size_t,Teuchos::RCP<panzer::BasisValues2<double> > > > _basis_map;
173 
174  std::map<size_t,Teuchos::RCP<const panzer::PointRule > > _point_rule_map;
175  std::map<size_t,Teuchos::RCP<const panzer::PointValues2<double> > > _point_map;
176 
178 
179  };
180 
185  class Workset : public WorksetDetails {
186  public:
189 
191  Workset(std::size_t identifier) : identifier_(identifier) {}
192 
194  void setIdentifier(std::size_t identifier) { identifier_ = identifier; }
195 
197  std::size_t getIdentifier() const { return identifier_; }
198 
199  index_t num_cells;
201 
202  double alpha;
203  double beta;
204  double time;
205  double step_size;
206  double stage_number;
207  std::vector<double> gather_seeds; // generic gather seeds
209 
214 
216  WorksetDetails& operator()(const int i) {
217  TEUCHOS_ASSERT(i == 0 || (i == 1 && Teuchos::nonnull(other)));
218  return i == 0 ? static_cast<WorksetDetails&>(*this) : *other;
219  }
221  const WorksetDetails& operator()(const int i) const {
222  TEUCHOS_ASSERT(i == 0 || (i == 1 && Teuchos::nonnull(other)));
223  return i == 0 ? static_cast<const WorksetDetails&>(*this) : *other;
224  }
226  WorksetDetails& details(const int i) { return operator()(i); }
227  const WorksetDetails& details(const int i) const { return operator()(i); }
229  size_t numDetails() const { return Teuchos::nonnull(other) ? 2 : 1; }
230 
231  private:
232  std::size_t identifier_;
233  };
234 
235  std::ostream& operator<<(std::ostream& os, const panzer::Workset& w);
236 
244  public:
248  void setDetailsIndex(const int di) { details_index_ = di; }
251  int getDetailsIndex() const { return details_index_; }
253  WorksetDetails& operator()(Workset& workset) const {
254  return workset(details_index_);
255  }
257  const WorksetDetails& operator()(const Workset& workset) const {
258  return workset(details_index_);
259  }
260  private:
262  };
263 
264 } // namespace panzer
265 
266 #endif
std::map< size_t, std::map< size_t, Teuchos::RCP< panzer::BasisValues2< double > > > > _basis_map
std::map< size_t, Teuchos::RCP< const panzer::IntegrationRule > > _integration_rule_map
std::size_t getIdentifier() const
Get the unique identifier for this workset, this is not an index!
void setDetailsIndex(const int di)
An evaluator builder sets the details index.
bool nonnull(const std::shared_ptr< T > &p)
void setIdentifier(std::size_t identifier)
Set the unique identifier for this workset, this is not an index!
Teuchos::RCP< std::vector< int > > ir_degrees
If workset corresponds to a sub cell, what is the index?
panzer::BasisValues2< double > & getBasisValues(const panzer::BasisDescriptor &basis_description, const panzer::IntegrationDescriptor &integration_description)
Grab the basis values for a given basis description and integration description (throws error if it d...
std::vector< Teuchos::RCP< panzer::BasisValues2< double > > > bases
Static basis function data, key is basis name, value is index in the static_bases vector...
Teuchos::RCP< std::vector< std::string > > basis_names
Value corresponds to basis type. Use the offest for indexing.
int numOwnedCells() const
Number of cells owned by this workset.
void setup(const panzer::LocalMeshPartition &partition, const panzer::WorksetNeeds &needs)
Constructs the workset details from a given chunk of the mesh.
std::map< size_t, Teuchos::RCP< const panzer::PureBasis > > _pure_basis_map
std::size_t identifier_
int numGhostCells() const
Number of cells owned by a different workset.
CellCoordArray cell_vertex_coordinates
double alpha
If workset corresponds to a sub cell, what is the dimension?
Workset(std::size_t identifier)
Constructor that that requires a unique identifier.
const panzer::IntegrationValues2< double > & getIntegrationValues(const panzer::IntegrationDescriptor &description) const
Grab the integration values for a given integration description (throws error if integration doesn&#39;t ...
std::map< size_t, Teuchos::RCP< const panzer::PointRule > > _point_rule_map
void setupNeeds(Teuchos::RCP< const shards::CellTopology > cell_topology, const Kokkos::View< double ***, PHX::Device > &cell_vertices, const panzer::WorksetNeeds &needs)
const panzer::PureBasis & getBasis(const panzer::BasisDescriptor &description) const
Grab the pure basis (contains data layouts) for a given basis description (throws error if integratio...
Teuchos::RCP< panzer::SubcellConnectivity > _face_connectivity
Teuchos::RCP< WorksetDetails > other
PHX::MDField< double, Cell, NODE, Dim > CellCoordArray
std::map< size_t, Teuchos::RCP< const panzer::IntegrationValues2< double > > > _integrator_map
void setNumberOfCells(int o_cells, int g_cells, int v_cells)
Provides access to set numbers of cells (required for backwards compatibility)
WorksetDetailsAccessor()
Default value is 0, which is backwards compatible.
std::vector< Teuchos::RCP< panzer::IntegrationValues2< double > > > int_rules
std::vector< double > gather_seeds
size_t numDetails() const
Return the number of WorksetDetails this Workset holds.
const WorksetDetails & operator()(const Workset &workset) const
const accessor.
WorksetDetails & operator()(const int i)
op(0) return *this; op(1) returns *other.
const WorksetDetails & details(const int i) const
WorksetDetails()
Default constructor.
const panzer::IntegrationRule & getIntegrationRule(const panzer::IntegrationDescriptor &description) const
Grab the integration rule (contains data layouts) for a given integration description (throws error i...
Kokkos::View< const int *, PHX::Device > cell_local_ids_k
std::ostream & operator<<(std::ostream &os, const AssemblyEngineInArgs &in)
WorksetDetails & details(const int i)
Convenience wrapper to operator() for pointer access.
std::map< size_t, Teuchos::RCP< const panzer::PointValues2< double > > > _point_map
int numVirtualCells() const
Number of cells not owned by any workset - these are used for boundary conditions.
Description and data layouts associated with a particular basis.
#define TEUCHOS_ASSERT(assertion_test)
WorksetDetails & operator()(Workset &workset) const
Workset wrapper to extract the correct details. Example: wda(workset).bases[i].
const panzer::SubcellConnectivity & getFaceConnectivity() const
Grab the face connectivity for this workset.
const panzer::PointValues2< double > & getPointValues(const panzer::PointDescriptor &point_description) const
Grab the basis values for a given basis description and integration description (throws error if it d...
Workset()
Default constructor, identifier is a useless 0 by default.
std::vector< GO > cell_local_ids
const WorksetDetails & operator()(const int i) const
const accessor.