Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_FieldManagerBuilder.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 #ifndef PANZER_FIELD_MANAGER_BUILDER_HPP
44 #define PANZER_FIELD_MANAGER_BUILDER_HPP
45 
46 #include <iostream>
47 #include <vector>
48 #include <map>
49 #include "Teuchos_RCP.hpp"
50 #include "Panzer_BC.hpp"
54 
55 // Forward Declarations
56 namespace panzer {
57  struct Traits;
58  class Workset;
59  struct EquationSetFactory;
60  struct BCStrategyFactory;
61  class PhysicsBlock;
62 }
63 
64 namespace PHX {
65  template<typename T> class FieldManager;
66 }
67 
68 namespace panzer {
69 
71  public:
72  virtual bool registerEvaluators(PHX::FieldManager<panzer::Traits> & fm,const WorksetDescriptor & wd, const PhysicsBlock & pb) const = 0;
73  };
74 
76  public:
77  bool registerEvaluators(PHX::FieldManager<panzer::Traits> & /* fm */, const WorksetDescriptor & /* wd */, const PhysicsBlock & /* pb */) const
78  { return false; }
79  };
80 
82 
83  public:
84 
85  typedef std::map<unsigned,panzer::Workset> BCFaceWorksetMap;
86 
87  FieldManagerBuilder(bool disablePhysicsBlockScatter=false,bool disablePhysicsBlockGather=false)
88  : disablePhysicsBlockScatter_(disablePhysicsBlockScatter)
89  , disablePhysicsBlockGather_(disablePhysicsBlockGather) {}
90 
91  void print(std::ostream& os) const;
92 
94  { return disablePhysicsBlockScatter_; }
95 
97  { return disablePhysicsBlockGather_; }
98 
100  { worksetContainer_ = wc; }
101 
103  { return worksetContainer_; }
104 
105  const
106  std::vector< Teuchos::RCP< PHX::FieldManager<panzer::Traits> > >&
108 
112  {
113  const std::vector<WorksetDescriptor> & wkstDesc = getVolumeWorksetDescriptors();
114  std::vector<WorksetDescriptor>::const_iterator itr = std::find(wkstDesc.begin(),wkstDesc.end(),wd);
115  TEUCHOS_ASSERT(itr!=wkstDesc.end());
116 
117  // get volume field manager associated with the block ID
118  int index = itr - wkstDesc.begin();
119  return getVolumeFieldManagers()[index];
120  }
121 
122  const std::vector<WorksetDescriptor> &
124 
125  const std::map<panzer::BC,
126  std::map<unsigned,PHX::FieldManager<panzer::Traits> >,
127  panzer::LessBC>&
129 
130  // The intention of the next set of functions is to simplify and eventually
131  // replace the setup routine above. Its not clear that these functions
132  // belong in the field manager builder. Additionally this will add increased
133  // flexibility to the field manager build in that the DOFManager will be
134  // specified in a more flexable and generic way. Onward.... (ECC - 1/13/11)
135 
139  void setupVolumeFieldManagers(const std::vector<Teuchos::RCP<panzer::PhysicsBlock> >& physicsBlocks,
141  const Teuchos::ParameterList& closure_models,
142  const LinearObjFactory<panzer::Traits> & lo_factory,
143  const Teuchos::ParameterList& user_data);
144 
145  void setupVolumeFieldManagers(const std::vector<Teuchos::RCP<panzer::PhysicsBlock> >& physicsBlocks,
146  const std::vector<WorksetDescriptor> & wkstDesc,
148  const Teuchos::ParameterList& closure_models,
149  const LinearObjFactory<panzer::Traits> & lo_factory,
150  const Teuchos::ParameterList& user_data,
151  const GenericEvaluatorFactory & gEvalFact,
152  bool closureModelByEBlock=false);
153 
156  void setupBCFieldManagers(const std::vector<panzer::BC> & bcs,
157  const std::vector<Teuchos::RCP<panzer::PhysicsBlock> >& physicsBlocks,
158  const panzer::EquationSetFactory & eqset_factory,
160  const panzer::BCStrategyFactory& bc_factory,
161  const Teuchos::ParameterList& closure_models,
162  const LinearObjFactory<panzer::Traits> & lo_factory,
163  const Teuchos::ParameterList& user_data)
164  { setupBCFieldManagers(bcs,physicsBlocks,Teuchos::ptrFromRef(eqset_factory),cm_factory,bc_factory,closure_models,lo_factory,user_data); }
165 
166  void setupBCFieldManagers(const std::vector<panzer::BC> & bcs,
167  const std::vector<Teuchos::RCP<panzer::PhysicsBlock> >& physicsBlocks,
169  const panzer::BCStrategyFactory& bc_factory,
170  const Teuchos::ParameterList& closure_models,
171  const LinearObjFactory<panzer::Traits> & lo_factory,
172  const Teuchos::ParameterList& user_data)
173  { setupBCFieldManagers(bcs,physicsBlocks,Teuchos::null,cm_factory,bc_factory,closure_models,lo_factory,user_data); }
174 
175  void writeVolumeGraphvizDependencyFiles(std::string filename_prefix,
176  const std::vector<Teuchos::RCP<panzer::PhysicsBlock> >& physicsBlocks) const;
177 
178  void writeBCGraphvizDependencyFiles(std::string filename_prefix) const;
179 
180  void writeVolumeTextDependencyFiles(std::string filename_prefix,
181  const std::vector<Teuchos::RCP<panzer::PhysicsBlock> >& physicsBlocks) const;
182 
183  void writeBCTextDependencyFiles(std::string filename_prefix) const;
184 
185  private:
188  void setupBCFieldManagers(const std::vector<panzer::BC> & bcs,
189  const std::vector<Teuchos::RCP<panzer::PhysicsBlock> >& physicsBlocks,
192  const panzer::BCStrategyFactory& bc_factory,
193  const Teuchos::ParameterList& closure_models,
194  const LinearObjFactory<panzer::Traits> & lo_factory,
195  const Teuchos::ParameterList& user_data);
196 
197  void setKokkosExtendedDataTypeDimensions(const std::string & eblock,
198  const panzer::UniqueGlobalIndexerBase & globalIndexer,
199  const Teuchos::ParameterList& user_data,
201 
203  std::vector< Teuchos::RCP< PHX::FieldManager<panzer::Traits> > >
205 
209  std::vector<WorksetDescriptor> volume_workset_desc_;
210 
217  std::map<panzer::BC,
218  std::map<unsigned,PHX::FieldManager<panzer::Traits> >,
220 
222 
227 
232  };
233 
234 std::ostream& operator<<(std::ostream& os, const panzer::FieldManagerBuilder & rfd);
235 
236 } // namespace panzer
237 
238 #endif
Interface for constructing a BCStrategy_TemplateManager.
void setupVolumeFieldManagers(const std::vector< Teuchos::RCP< panzer::PhysicsBlock > > &physicsBlocks, const panzer::ClosureModelFactory_TemplateManager< panzer::Traits > &cm_factory, const Teuchos::ParameterList &closure_models, const LinearObjFactory< panzer::Traits > &lo_factory, const Teuchos::ParameterList &user_data)
Allocates and initializes an equation set template manager.
const std::map< panzer::BC, std::map< unsigned, PHX::FieldManager< panzer::Traits > >, panzer::LessBC > & getBCFieldManagers() const
Object that contains information on the physics and discretization of a block of elements with the SA...
void writeVolumeGraphvizDependencyFiles(std::string filename_prefix, const std::vector< Teuchos::RCP< panzer::PhysicsBlock > > &physicsBlocks) const
void writeBCGraphvizDependencyFiles(std::string filename_prefix) const
void setKokkosExtendedDataTypeDimensions(const std::string &eblock, const panzer::UniqueGlobalIndexerBase &globalIndexer, const Teuchos::ParameterList &user_data, PHX::FieldManager< panzer::Traits > &fm) const
void writeBCTextDependencyFiles(std::string filename_prefix) const
void setWorksetContainer(const Teuchos::RCP< WorksetContainer > &wc)
Teuchos::RCP< WorksetContainer > getWorksetContainer() const
bool registerEvaluators(PHX::FieldManager< panzer::Traits > &, const WorksetDescriptor &, const PhysicsBlock &) const
void print(std::ostream &os) const
void writeVolumeTextDependencyFiles(std::string filename_prefix, const std::vector< Teuchos::RCP< panzer::PhysicsBlock > > &physicsBlocks) const
const std::vector< Teuchos::RCP< PHX::FieldManager< panzer::Traits > > > & getVolumeFieldManagers() const
Teuchos::RCP< WorksetContainer > worksetContainer_
std::vector< WorksetDescriptor > volume_workset_desc_
Matches volume field managers so you can determine the appropriate set of worksets for each field man...
std::vector< Teuchos::RCP< PHX::FieldManager< panzer::Traits > > > phx_volume_field_managers_
Phalanx volume field managers for each element block.
void setupBCFieldManagers(const std::vector< panzer::BC > &bcs, const std::vector< Teuchos::RCP< panzer::PhysicsBlock > > &physicsBlocks, const panzer::ClosureModelFactory_TemplateManager< panzer::Traits > &cm_factory, const panzer::BCStrategyFactory &bc_factory, const Teuchos::ParameterList &closure_models, const LinearObjFactory< panzer::Traits > &lo_factory, const Teuchos::ParameterList &user_data)
virtual bool registerEvaluators(PHX::FieldManager< panzer::Traits > &fm, const WorksetDescriptor &wd, const PhysicsBlock &pb) const =0
std::ostream & operator<<(std::ostream &os, const AssemblyEngineInArgs &in)
FieldManagerBuilder(bool disablePhysicsBlockScatter=false, bool disablePhysicsBlockGather=false)
std::map< panzer::BC, std::map< unsigned, PHX::FieldManager< panzer::Traits > >, panzer::LessBC > bc_field_managers_
Field managers for the boundary conditions.
Teuchos::RCP< PHX::FieldManager< panzer::Traits > > getVolumeFieldManager(const WorksetDescriptor &wd) const
Look up field manager by an element block ID.
Stores input information for a boundary condition.
Definition: Panzer_BC.hpp:81
void setupBCFieldManagers(const std::vector< panzer::BC > &bcs, const std::vector< Teuchos::RCP< panzer::PhysicsBlock > > &physicsBlocks, const panzer::EquationSetFactory &eqset_factory, const panzer::ClosureModelFactory_TemplateManager< panzer::Traits > &cm_factory, const panzer::BCStrategyFactory &bc_factory, const Teuchos::ParameterList &closure_models, const LinearObjFactory< panzer::Traits > &lo_factory, const Teuchos::ParameterList &user_data)
std::map< unsigned, panzer::Workset > BCFaceWorksetMap
#define TEUCHOS_ASSERT(assertion_test)
const std::vector< WorksetDescriptor > & getVolumeWorksetDescriptors() const