Panzer  Version of the Day
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  struct Workset;
59  template <typename LO, typename GO> class ConnManager;
60  template <typename LO, typename GO> class DOFManager;
61  struct EquationSetFactory;
62  struct BCStrategyFactory;
63  class PhysicsBlock;
64 }
65 
66 namespace PHX {
67  template<typename T> class FieldManager;
68 }
69 
70 namespace panzer {
71 
73  public:
74  virtual bool registerEvaluators(PHX::FieldManager<panzer::Traits> & fm,const WorksetDescriptor & wd, const PhysicsBlock & pb) const = 0;
75  };
76 
78  public:
80  { return false; }
81  };
82 
84 
85  public:
86 
87  typedef std::map<unsigned,panzer::Workset> BCFaceWorksetMap;
88 
89  FieldManagerBuilder(bool disablePhysicsBlockScatter=false,bool disablePhysicsBlockGather=false)
90  : disablePhysicsBlockScatter_(disablePhysicsBlockScatter)
91  , disablePhysicsBlockGather_(disablePhysicsBlockGather) {}
92 
93  void print(std::ostream& os) const;
94 
96  { return disablePhysicsBlockScatter_; }
97 
99  { return disablePhysicsBlockGather_; }
100 
102  { worksetContainer_ = wc; }
103 
105  { return worksetContainer_; }
106 
107  const
108  std::vector< Teuchos::RCP< PHX::FieldManager<panzer::Traits> > >&
110 
114  {
115  const std::vector<WorksetDescriptor> & wkstDesc = getVolumeWorksetDescriptors();
116  std::vector<WorksetDescriptor>::const_iterator itr = std::find(wkstDesc.begin(),wkstDesc.end(),wd);
117  TEUCHOS_ASSERT(itr!=wkstDesc.end());
118 
119  // get volume field manager associated with the block ID
120  int index = itr - wkstDesc.begin();
121  return getVolumeFieldManagers()[index];
122  }
123 
124  const std::vector<WorksetDescriptor> &
126 
127  const std::map<panzer::BC,
128  std::map<unsigned,PHX::FieldManager<panzer::Traits> >,
129  panzer::LessBC>&
131 
132  // The intention of the next set of functions is to simplify and eventually
133  // replace the setup routine above. Its not clear that these functions
134  // belong in the field manager builder. Additionally this will add increased
135  // flexibility to the field manager build in that the DOFManager will be
136  // specified in a more flexable and generic way. Onward.... (ECC - 1/13/11)
137 
143  const Teuchos::ParameterList& closure_models,
144  const LinearObjFactory<panzer::Traits> & lo_factory,
145  const Teuchos::ParameterList& user_data);
146 
148  const std::vector<WorksetDescriptor> & wkstDesc,
150  const Teuchos::ParameterList& closure_models,
151  const LinearObjFactory<panzer::Traits> & lo_factory,
152  const Teuchos::ParameterList& user_data,
153  const GenericEvaluatorFactory & gEvalFact,
154  bool closureModelByEBlock=false);
155 
158  void setupBCFieldManagers(const std::vector<panzer::BC> & bcs,
159  const std::vector<Teuchos::RCP<panzer::PhysicsBlock> >& physicsBlocks,
160  const panzer::EquationSetFactory & eqset_factory,
162  const panzer::BCStrategyFactory& bc_factory,
163  const Teuchos::ParameterList& closure_models,
164  const LinearObjFactory<panzer::Traits> & lo_factory,
165  const Teuchos::ParameterList& user_data)
166  { setupBCFieldManagers(bcs,physicsBlocks,Teuchos::ptrFromRef(eqset_factory),cm_factory,bc_factory,closure_models,lo_factory,user_data); }
167 
168  void setupBCFieldManagers(const std::vector<panzer::BC> & bcs,
169  const std::vector<Teuchos::RCP<panzer::PhysicsBlock> >& physicsBlocks,
171  const panzer::BCStrategyFactory& bc_factory,
172  const Teuchos::ParameterList& closure_models,
173  const LinearObjFactory<panzer::Traits> & lo_factory,
174  const Teuchos::ParameterList& user_data)
175  { setupBCFieldManagers(bcs,physicsBlocks,Teuchos::null,cm_factory,bc_factory,closure_models,lo_factory,user_data); }
176 
177  void writeVolumeGraphvizDependencyFiles(std::string filename_prefix,
178  const std::vector<Teuchos::RCP<panzer::PhysicsBlock> >& physicsBlocks) const;
179 
180  void writeBCGraphvizDependencyFiles(std::string filename_prefix) const;
181 
182  void writeVolumeTextDependencyFiles(std::string filename_prefix,
183  const std::vector<Teuchos::RCP<panzer::PhysicsBlock> >& physicsBlocks) const;
184 
185  void writeBCTextDependencyFiles(std::string filename_prefix) const;
186 
187  private:
190  void setupBCFieldManagers(const std::vector<panzer::BC> & bcs,
191  const std::vector<Teuchos::RCP<panzer::PhysicsBlock> >& physicsBlocks,
194  const panzer::BCStrategyFactory& bc_factory,
195  const Teuchos::ParameterList& closure_models,
196  const LinearObjFactory<panzer::Traits> & lo_factory,
197  const Teuchos::ParameterList& user_data);
198 
199  void setKokkosExtendedDataTypeDimensions(const std::string & eblock,
200  const panzer::UniqueGlobalIndexerBase & globalIndexer,
201  const Teuchos::ParameterList& user_data,
203 
205  std::vector< Teuchos::RCP< PHX::FieldManager<panzer::Traits> > >
207 
211  std::vector<WorksetDescriptor> volume_workset_desc_;
212 
219  std::map<panzer::BC,
220  std::map<unsigned,PHX::FieldManager<panzer::Traits> >,
222 
224 
229 
234  };
235 
236 std::ostream& operator<<(std::ostream& os, const panzer::FieldManagerBuilder & rfd);
237 
238 } // namespace panzer
239 
240 #endif
void writeVolumeTextDependencyFiles(std::string filename_prefix, const std::vector< Teuchos::RCP< panzer::PhysicsBlock > > &physicsBlocks) const
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.
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
PHX::MDField< ScalarT > vector
Teuchos::RCP< PHX::FieldManager< panzer::Traits > > getVolumeFieldManager(const WorksetDescriptor &wd) const
Look up field manager by an element block ID.
void writeBCTextDependencyFiles(std::string filename_prefix) const
const std::vector< Teuchos::RCP< PHX::FieldManager< panzer::Traits > > > & getVolumeFieldManagers() const
void setWorksetContainer(const Teuchos::RCP< WorksetContainer > &wc)
void writeBCGraphvizDependencyFiles(std::string filename_prefix) const
const std::map< panzer::BC, std::map< unsigned, PHX::FieldManager< panzer::Traits > >, panzer::LessBC > & getBCFieldManagers() const
void print(std::ostream &os) const
const std::vector< WorksetDescriptor > & getVolumeWorksetDescriptors() const
Teuchos::RCP< WorksetContainer > getWorksetContainer() 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...
void setKokkosExtendedDataTypeDimensions(const std::string &eblock, const panzer::UniqueGlobalIndexerBase &globalIndexer, const Teuchos::ParameterList &user_data, PHX::FieldManager< panzer::Traits > &fm) const
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.
Stores input information for a boundary condition.
Definition: Panzer_BC.hpp:80
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)
bool registerEvaluators(PHX::FieldManager< panzer::Traits > &fm, const WorksetDescriptor &wd, const PhysicsBlock &pb) const
std::map< unsigned, panzer::Workset > BCFaceWorksetMap
#define TEUCHOS_ASSERT(assertion_test)