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 
89  void print(std::ostream& os) const;
90 
92  { return disablePhysicsBlockScatter_; }
93 
95  { return disablePhysicsBlockGather_; }
96 
98  { worksetContainer_ = wc; }
99 
101  { return worksetContainer_; }
102 
103  const std::vector< Teuchos::RCP< PHX::FieldManager<panzer::Traits> > >&
105 
109  {
110  const std::vector<WorksetDescriptor> & wkstDesc = getVolumeWorksetDescriptors();
111  std::vector<WorksetDescriptor>::const_iterator itr = std::find(wkstDesc.begin(),wkstDesc.end(),wd);
112  TEUCHOS_ASSERT(itr!=wkstDesc.end());
113 
114  // get volume field manager associated with the block ID
115  int index = itr - wkstDesc.begin();
116  return getVolumeFieldManagers()[index];
117  }
118 
119  const std::vector<WorksetDescriptor> &
121 
122  const std::map<panzer::BC,
123  std::map<unsigned,PHX::FieldManager<panzer::Traits> >,
126 
127  // The intention of the next set of functions is to simplify and eventually
128  // replace the setup routine above. Its not clear that these functions
129  // belong in the field manager builder. Additionally this will add increased
130  // flexibility to the field manager build in that the DOFManager will be
131  // specified in a more flexable and generic way. Onward.... (ECC - 1/13/11)
132 
136  void setupVolumeFieldManagers(const std::vector<Teuchos::RCP<panzer::PhysicsBlock> >& physicsBlocks,
138  const Teuchos::ParameterList& closure_models,
139  const LinearObjFactory<panzer::Traits> & lo_factory,
140  const Teuchos::ParameterList& user_data);
141 
142  void setupVolumeFieldManagers(const std::vector<Teuchos::RCP<panzer::PhysicsBlock> >& physicsBlocks,
143  const std::vector<WorksetDescriptor> & wkstDesc,
145  const Teuchos::ParameterList& closure_models,
146  const LinearObjFactory<panzer::Traits> & lo_factory,
147  const Teuchos::ParameterList& user_data,
148  const GenericEvaluatorFactory & gEvalFact,
149  bool closureModelByEBlock=false);
150 
153  void setupBCFieldManagers(const std::vector<panzer::BC> & bcs,
154  const std::vector<Teuchos::RCP<panzer::PhysicsBlock> >& physicsBlocks,
155  const panzer::EquationSetFactory & eqset_factory,
157  const panzer::BCStrategyFactory& bc_factory,
158  const Teuchos::ParameterList& closure_models,
159  const LinearObjFactory<panzer::Traits> & lo_factory,
160  const Teuchos::ParameterList& user_data)
161  { setupBCFieldManagers(bcs,physicsBlocks,Teuchos::ptrFromRef(eqset_factory),cm_factory,bc_factory,closure_models,lo_factory,user_data); }
162 
163  void setupBCFieldManagers(const std::vector<panzer::BC> & bcs,
164  const std::vector<Teuchos::RCP<panzer::PhysicsBlock> >& physicsBlocks,
166  const panzer::BCStrategyFactory& bc_factory,
167  const Teuchos::ParameterList& closure_models,
168  const LinearObjFactory<panzer::Traits> & lo_factory,
169  const Teuchos::ParameterList& user_data)
170  { setupBCFieldManagers(bcs,physicsBlocks,Teuchos::null,cm_factory,bc_factory,closure_models,lo_factory,user_data); }
171 
172  void writeVolumeGraphvizDependencyFiles(std::string filename_prefix,
173  const std::vector<Teuchos::RCP<panzer::PhysicsBlock> >& physicsBlocks) const;
174 
175  void writeBCGraphvizDependencyFiles(std::string filename_prefix) const;
176 
177  void writeVolumeTextDependencyFiles(std::string filename_prefix,
178  const std::vector<Teuchos::RCP<panzer::PhysicsBlock> >& physicsBlocks) const;
179 
180  void writeBCTextDependencyFiles(std::string filename_prefix) const;
181 
183  void clearVolumeFieldManagers(bool clearVolumeWorksets = true);
184 
186  void setActiveEvaluationTypes(const std::vector<bool>& aet);
187 
188  private:
191  void setupBCFieldManagers(const std::vector<panzer::BC> & bcs,
192  const std::vector<Teuchos::RCP<panzer::PhysicsBlock> >& physicsBlocks,
195  const panzer::BCStrategyFactory& bc_factory,
196  const Teuchos::ParameterList& closure_models,
197  const LinearObjFactory<panzer::Traits> & lo_factory,
198  const Teuchos::ParameterList& user_data);
199 
200  void setKokkosExtendedDataTypeDimensions(const std::string & eblock,
201  const panzer::GlobalIndexer & globalIndexer,
202  const Teuchos::ParameterList& user_data,
204 
206  std::vector< Teuchos::RCP< PHX::FieldManager<panzer::Traits> > >
208 
212  std::vector<WorksetDescriptor> volume_workset_desc_;
213 
220  std::map<panzer::BC,
221  std::map<unsigned,PHX::FieldManager<panzer::Traits> >,
223 
225 
230 
235 
237  std::vector<bool> active_evaluation_types_;
238  };
239 
240 std::ostream& operator<<(std::ostream& os, const panzer::FieldManagerBuilder & rfd);
241 
242 } // namespace panzer
243 
244 #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 clearVolumeFieldManagers(bool clearVolumeWorksets=true)
Delete all volume field managers, retaining the BC ones.
void setKokkosExtendedDataTypeDimensions(const std::string &eblock, const panzer::GlobalIndexer &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)
std::vector< bool > active_evaluation_types_
Entries correspond to evaluation type mpl vector in traits. A value of true means the evaluation type...
void setActiveEvaluationTypes(const std::vector< bool > &aet)
Set a vector of active evaluation types to allocate.
const std::vector< WorksetDescriptor > & getVolumeWorksetDescriptors() const