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  template<typename LO, typename GO>
68  struct LocalMeshPartition;
69 
70  class SubcellConnectivity;
71 
77  public:
78  typedef PHX::MDField<double,Cell,NODE,Dim> CellCoordArray;
79 
80  typedef std::size_t GO;
81  typedef int LO;
82 
85  : _num_owned_cells(-1)
86  , _num_ghost_cells(-1)
87  , _num_virtual_cells(-1)
88  { }
89 
92 
94  const Kokkos::View<double***,PHX::Device> & cell_vertices,
95  const panzer::WorksetNeeds & needs);
96 
97  Kokkos::View<const int*,PHX::Device> cell_local_ids_k;
98  std::vector<GO> cell_local_ids;
100  std::string block_id;
101 
103 
105  //TEUCHOS_DEPRECATED
107 
108  //TEUCHOS_DEPRECATED
109  std::vector<Teuchos::RCP<panzer::IntegrationValues2<double> > > int_rules;
110 
112  //TEUCHOS_DEPRECATED
114 
116  //TEUCHOS_DEPRECATED
117  std::vector<Teuchos::RCP< panzer::BasisValues2<double> > > bases;
118 
121 
124 
127 
130  const panzer::IntegrationDescriptor & integration_description);
131 
133  const panzer::BasisValues2<double> & getBasisValues(const panzer::BasisDescriptor & basis_description,
134  const panzer::IntegrationDescriptor & integration_description) const;
135 
137  const panzer::BasisValues2<double> & getBasisValues(const panzer::BasisDescriptor & basis_description,
138  const panzer::PointDescriptor & point_description) const;
139 
141  const panzer::PointValues2<double> & getPointValues(const panzer::PointDescriptor & point_description) const;
142 
144  const panzer::PureBasis & getBasis(const panzer::BasisDescriptor & description) const;
145 
147  int numOwnedCells() const {return _num_owned_cells;}
148 
150  int numGhostCells() const {return _num_ghost_cells;}
151 
153  int numVirtualCells() const {return _num_virtual_cells;}
154 
156  void setNumberOfCells(int o_cells,int g_cells,int v_cells)
157  {
158  _num_owned_cells = o_cells;
159  _num_ghost_cells = g_cells;
160  _num_virtual_cells = v_cells;
161  }
162 
163  protected:
164 
168 
169  std::map<size_t,Teuchos::RCP<const panzer::IntegrationRule > > _integration_rule_map;
170  std::map<size_t,Teuchos::RCP<const panzer::IntegrationValues2<double> > > _integrator_map;
171 
172  std::map<size_t,Teuchos::RCP<const panzer::PureBasis > > _pure_basis_map;
173  std::map<size_t,std::map<size_t,Teuchos::RCP<panzer::BasisValues2<double> > > > _basis_map;
174 
175  std::map<size_t,Teuchos::RCP<const panzer::PointRule > > _point_rule_map;
176  std::map<size_t,Teuchos::RCP<const panzer::PointValues2<double> > > _point_map;
177 
179 
180  };
181 
186  class Workset : public WorksetDetails {
187  public:
190 
192  Workset(std::size_t identifier) : identifier_(identifier) {}
193 
195  void setIdentifier(std::size_t identifier) { identifier_ = identifier; }
196 
198  std::size_t getIdentifier() const { return identifier_; }
199 
200  index_t num_cells;
202 
203  double alpha;
204  double beta;
205  double time;
206  double step_size;
207  double stage_number;
208  std::vector<double> gather_seeds; // generic gather seeds
210 
215 
217  WorksetDetails& operator()(const int i) {
218  TEUCHOS_ASSERT(i == 0 || (i == 1 && Teuchos::nonnull(other)));
219  return i == 0 ? static_cast<WorksetDetails&>(*this) : *other;
220  }
222  const WorksetDetails& operator()(const int i) const {
223  TEUCHOS_ASSERT(i == 0 || (i == 1 && Teuchos::nonnull(other)));
224  return i == 0 ? static_cast<const WorksetDetails&>(*this) : *other;
225  }
227  WorksetDetails& details(const int i) { return operator()(i); }
228  const WorksetDetails& details(const int i) const { return operator()(i); }
230  size_t numDetails() const { return Teuchos::nonnull(other) ? 2 : 1; }
231 
232  private:
233  std::size_t identifier_;
234  };
235 
236  std::ostream& operator<<(std::ostream& os, const panzer::Workset& w);
237 
245  public:
249  void setDetailsIndex(const int di) { details_index_ = di; }
252  int getDetailsIndex() const { return details_index_; }
254  WorksetDetails& operator()(Workset& workset) const {
255  return workset(details_index_);
256  }
258  const WorksetDetails& operator()(const Workset& workset) const {
259  return workset(details_index_);
260  }
261  private:
263  };
264 
265 } // namespace panzer
266 
267 #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.
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.
void setup(const panzer::LocalMeshPartition< int, panzer::Ordinal64 > &partition, const panzer::WorksetNeeds &needs)
Constructs the workset details from a given chunk of the mesh.