Panzer  Version of the Day
Panzer_STK_WorksetFactory.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 
44 
47 #include "Panzer_STK_Interface.hpp"
48 
49 namespace panzer_stk {
50 
53 void WorksetFactory::setMesh(const Teuchos::RCP<const panzer_stk::STK_Interface> & mesh)
54 {
55  mesh_ = mesh;
56 }
57 
60 Teuchos::RCP<std::map<unsigned,panzer::Workset> > WorksetFactory::
62  const panzer::PhysicsBlock & pb) const
63 {
64  using Teuchos::RCP;
65  using Teuchos::rcp;
66 
68  needs.cellData = pb.cellData();
69 
70  const std::map<int,RCP<panzer::IntegrationRule> >& int_rules = pb.getIntegrationRules();
71  for(std::map<int,RCP<panzer::IntegrationRule> >::const_iterator ir_itr = int_rules.begin();
72  ir_itr != int_rules.end(); ++ir_itr)
73  needs.int_rules.push_back(ir_itr->second);
74 
75  const std::map<std::string,Teuchos::RCP<panzer::PureBasis> >& bases= pb.getBases();
76  for(std::map<std::string,Teuchos::RCP<panzer::PureBasis> >::const_iterator b_itr = bases.begin();
77  b_itr != bases.end(); ++b_itr)
78  needs.bases.push_back(b_itr->second);
79 
80  return getSideWorksets(bc,needs);
81 }
82 
83 Teuchos::RCP<std::map<unsigned,panzer::Workset> > WorksetFactory::
85  const panzer::WorksetNeeds & needs) const
86 {
88 }
89 
90 Teuchos::RCP<std::map<unsigned,panzer::Workset> > WorksetFactory::
92  const panzer::PhysicsBlock & pb_a,
93  const panzer::PhysicsBlock & pb_b) const
94 {
95  TEUCHOS_ASSERT(bc.bcType() == panzer::BCT_Interface);
96  return panzer_stk::buildBCWorksets(*mesh_, pb_a, pb_b, bc.sidesetID());
97 }
98 
99 Teuchos::RCP<std::vector<panzer::Workset> > WorksetFactory::
101  const panzer::PhysicsBlock & pb) const
102 {
103  using Teuchos::RCP;
104  using Teuchos::rcp;
105 
106  panzer::WorksetNeeds needs;
107  needs.cellData = pb.cellData();
108 
109  const std::map<int,RCP<panzer::IntegrationRule> >& int_rules = pb.getIntegrationRules();
110  for(std::map<int,RCP<panzer::IntegrationRule> >::const_iterator ir_itr = int_rules.begin();
111  ir_itr != int_rules.end(); ++ir_itr)
112  needs.int_rules.push_back(ir_itr->second);
113 
114  const std::map<std::string,Teuchos::RCP<panzer::PureBasis> >& bases= pb.getBases();
115  for(std::map<std::string,Teuchos::RCP<panzer::PureBasis> >::const_iterator b_itr = bases.begin();
116  b_itr != bases.end(); ++b_itr)
117  needs.bases.push_back(b_itr->second);
118 
119  return getWorksets(worksetDesc,needs);
120 }
121 
122 Teuchos::RCP<std::vector<panzer::Workset> > WorksetFactory::
124  const panzer::WorksetNeeds & needs) const
125 {
126  if(!worksetDesc.useSideset()) {
127  return panzer_stk::buildWorksets(*mesh_,worksetDesc.getElementBlock(), needs);
128  }
129  else if(worksetDesc.useSideset() && worksetDesc.sideAssembly()) {
130  // uses cascade by default, each subcell has its own workset
131  return panzer_stk::buildWorksets(*mesh_,needs,worksetDesc.getSideset(),worksetDesc.getElementBlock(),true);
132  }
133  else {
134  TEUCHOS_ASSERT(false);
135 
136  // The following code does not yet function in full generality, we need
137  // to fix how the assembly process is handled for sidesets
138  /*
139  Teuchos::RCP<std::map<unsigned,panzer::Workset> > workset_map =
140  panzer_stk::buildBCWorksets(*mesh_,pb,worksetDesc.getSideset());
141 
142  // loop over worksets, adding them to vector
143  Teuchos::RCP<std::vector<panzer::Workset> > worksets = Teuchos::rcp(new std::vector<panzer::Workset>);
144  for(std::map<unsigned,panzer::Workset>::const_iterator itr=workset_map->begin();
145  itr!=workset_map->end();++itr)
146  worksets->push_back(itr->second);
147 
148  return worksets;
149  */
150  }
151 }
152 
153 }
std::vector< Teuchos::RCP< const PureBasis > > bases
Object that contains information on the physics and discretization of a block of elements with the SA...
BCType bcType() const
Returns the boundary condition type (Dirichlet or Neumann or Interface).
Definition: Panzer_BC.cpp:184
std::vector< Teuchos::RCP< const IntegrationRule > > int_rules
Teuchos::RCP< std::vector< panzer::Workset > > buildWorksets(const panzer_stk::STK_Interface &mesh, const panzer::PhysicsBlock &pb)
virtual Teuchos::RCP< std::map< unsigned, panzer::Workset > > getSideWorksets(const panzer::BC &bc, const panzer::PhysicsBlock &pb) const
bool sideAssembly() const
Expects side set assembly on volume.
std::string getSideset() const
Get the side set.
const panzer::CellData & cellData() const
bool useSideset() const
This descriptor is for a side set.
std::string getElementBlock() const
Get element block.
const std::map< std::string, Teuchos::RCP< panzer::PureBasis > > & getBases() const
Returns the unique set of bases, key is the unique panzer::PureBasis::name() of the basis...
std::string elementBlockID() const
Returns the element block id associated with this sideset.
Definition: Panzer_BC.cpp:198
virtual void setMesh(const Teuchos::RCP< const panzer_stk::STK_Interface > &mesh)
Teuchos::RCP< const STK_Interface > mesh_
Teuchos::RCP< std::map< unsigned, panzer::Workset > > buildBCWorksets(const panzer_stk::STK_Interface &mesh, const panzer::PhysicsBlock &pb_a, const panzer::PhysicsBlock &pb_b, const std::string &sideset)
Stores input information for a boundary condition.
Definition: Panzer_BC.hpp:80
std::string sidesetID() const
Returns the set id.
Definition: Panzer_BC.cpp:191
const std::map< int, Teuchos::RCP< panzer::IntegrationRule > > & getIntegrationRules() const
Returns the unique set of point rules, key is the unique panzer::PointRule::name() ...
virtual Teuchos::RCP< std::vector< panzer::Workset > > getWorksets(const panzer::WorksetDescriptor &worksetDesc, const panzer::PhysicsBlock &pb) const