Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_PhysicsBlock.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 
43 #include "Teuchos_RCP.hpp"
45 #include "Teuchos_Assert.hpp"
46 
47 #include "Phalanx_FieldManager.hpp"
48 #include "Phalanx_Evaluator_Factory.hpp"
49 #include "Panzer_Traits.hpp"
50 #include "Panzer_PhysicsBlock.hpp"
51 #include "Panzer_PureBasis.hpp"
54 #include "Shards_CellTopology.hpp"
55 
56 // *******************************************************************
57 
58 void panzer::buildPhysicsBlocks(const std::map<std::string,std::string>& block_ids_to_physics_ids,
59  const std::map<std::string,Teuchos::RCP<const shards::CellTopology> > & block_ids_to_cell_topo,
60  const Teuchos::RCP<Teuchos::ParameterList>& physics_blocks_plist,
61  const int default_integration_order,
62  const std::size_t workset_size,
64  const Teuchos::RCP<panzer::GlobalData>& global_data,
65  const bool build_transient_support,
66  std::vector<Teuchos::RCP<panzer::PhysicsBlock> > & physicsBlocks,
67  const std::vector<std::string>& tangent_param_names)
68 {
69  using Teuchos::RCP;
70  using Teuchos::rcp;
71  using std::map;
72  using std::string;
73 
74  TEUCHOS_ASSERT(nonnull(physics_blocks_plist));
75 
76  // Create a physics block for each element block
77  map<string,string>::const_iterator itr;
78  for (itr = block_ids_to_physics_ids.begin(); itr!=block_ids_to_physics_ids.end();++itr) {
79  string element_block_id = itr->first;
80  string physics_block_id = itr->second;
81 
82  map<string,RCP<const shards::CellTopology> >::const_iterator ct_itr =
83  block_ids_to_cell_topo.find(element_block_id);
84  TEUCHOS_TEST_FOR_EXCEPTION(ct_itr==block_ids_to_cell_topo.end(),
85  std::runtime_error,
86  "Falied to find CellTopology for element block id: \""
87  << element_block_id << "\"!");
88  RCP<const shards::CellTopology> cellTopo = ct_itr->second;
89 
90  const panzer::CellData volume_cell_data(workset_size,cellTopo);
91 
92  // find physics block parameter sublist
93  TEUCHOS_TEST_FOR_EXCEPTION(!physics_blocks_plist->isSublist(physics_block_id),
94  std::runtime_error,
95  "Failed to find physics id: \""
96  << physics_block_id
97  << "\" requested by element block: \""
98  << element_block_id << "\"!");
99 
100  RCP<panzer::PhysicsBlock> pb = rcp(new panzer::PhysicsBlock(Teuchos::sublist(physics_blocks_plist,physics_block_id,true),
101  element_block_id,
102  default_integration_order,
103  volume_cell_data,
104  eqset_factory,
105  global_data,
106  build_transient_support,
107  tangent_param_names
108  ));
109  physicsBlocks.push_back(pb);
110  }
111 }
112 
113 void panzer::readPhysicsBlocks(const std::map<std::string,std::string>& block_ids_to_physics_ids,
114  const Teuchos::RCP<Teuchos::ParameterList>& physics_blocks_plist,
115  std::vector<Teuchos::RCP<panzer::PhysicsBlock> > & physicsBlocks)
116 {
117  using Teuchos::RCP;
118  using Teuchos::rcp;
119  using std::map;
120  using std::string;
121 
122  TEUCHOS_ASSERT(nonnull(physics_blocks_plist));
123 
124  // Create a physics block for each element block
125  map<string,string>::const_iterator itr;
126  for (itr = block_ids_to_physics_ids.begin(); itr!=block_ids_to_physics_ids.end();++itr) {
127  string element_block_id = itr->first;
128  string physics_block_id = itr->second;
129 
130  // find physics block parameter sublist
131  TEUCHOS_TEST_FOR_EXCEPTION(!physics_blocks_plist->isSublist(physics_block_id),
132  std::runtime_error,
133  "Failed to find physics id: \""
134  << physics_block_id
135  << "\" requested by element block: \""
136  << element_block_id << "\"!");
137 
138  RCP<panzer::PhysicsBlock> pb = rcp(new panzer::PhysicsBlock(Teuchos::sublist(physics_blocks_plist,physics_block_id,true),
139  element_block_id));
140  physicsBlocks.push_back(pb);
141  }
142 }
143 
144 // *******************************************************************
145 Teuchos::RCP<panzer::PhysicsBlock> panzer::findPhysicsBlock(const std::string element_block_id,
146  const std::vector<Teuchos::RCP<panzer::PhysicsBlock> > & physics_blocks,
147  bool throw_on_failure)
148 {
149  std::vector<Teuchos::RCP<panzer::PhysicsBlock> >::const_iterator pb = physics_blocks.begin();
150 
151  while (pb != physics_blocks.end()) {
152  if ((*pb)->elementBlockID() == element_block_id)
153  return *pb;
154 
155  ++pb;
156  }
157 
158  TEUCHOS_TEST_FOR_EXCEPTION(throw_on_failure,std::runtime_error,"Error: panzer::findPhysicsBlock(): The requested physics block for element block\"" << element_block_id << "\" was not found in the vecotr of physics blocks!");
159 
161  return null_pb;
162 }
163 
164 // *******************************************************************
167  const std::string & element_block_id,
168  const int default_integration_order,
169  const panzer::CellData & cell_data,
171  const Teuchos::RCP<panzer::GlobalData>& global_data,
172  const bool build_transient_support,
173  const std::vector<std::string>& tangent_param_names) :
174  m_element_block_id(element_block_id),
175  m_default_integration_order(default_integration_order),
176  m_cell_data(cell_data),
177  m_input_parameters(physics_block_plist),
178  m_build_transient_support(build_transient_support),
179  m_global_data(global_data),
180  m_eqset_factory(factory)
181 {
182  TEUCHOS_ASSERT(nonnull(physics_block_plist));
183  TEUCHOS_ASSERT(nonnull(factory));
184  TEUCHOS_ASSERT(nonnull(global_data));
185 
186  m_physics_id = physics_block_plist->name();
187 
191  m_cell_data,
192  build_transient_support,
193  tangent_param_names);
194 }
195 
196 // *******************************************************************
199  const std::string & element_block_id) :
200  m_element_block_id(element_block_id),
201  m_default_integration_order(1),
202  m_input_parameters(physics_block_plist),
203  m_build_transient_support(false)
204 {
205 }
206 
207 // *******************************************************************
209 PhysicsBlock(const std::string & element_block_id,
210  const std::string & physics_block_id,
211  const int integration_order,
212  const panzer::CellData & cell_data,
213  const Teuchos::RCP<panzer::GlobalData>& global_data,
214  const Teuchos::RCP<panzer::PureBasis> & basis) :
215  m_physics_id(physics_block_id),
216  m_element_block_id(element_block_id),
217  m_default_integration_order(integration_order),
218  m_cell_data(cell_data),
219  m_input_parameters(Teuchos::null),
220  m_build_transient_support(false),
221  m_global_data(global_data),
222  m_eqset_factory(Teuchos::null)
223 {
224  using Teuchos::RCP;
226 
227  // there will be no equation sets
228  m_equation_sets.clear();
229 
230 
231  // Generate list of dof names
232  m_dof_names.push_back("FAKE");
233 
234  // Generate dof name (string) / basis pairs
235  m_provided_dofs.push_back(std::make_pair("FAKE",basis));
236 
237  // Generate unique list of bases
238  m_bases[basis->name()] = basis;
239 
240  // Get a unique list of point rules. NOTE: This assumes that the
241  // same point rules are used for all evaluation types. In the
242  // future we could easily change this by adding another level here
243  // to differentiate the point rules for each evaluation type.
244  // This would require some refactoring of the phsyics block
245  // registration routines and the workset builder to support all
246  // combinations of bases and point rules for each evaluation type.
247  m_integration_rules[integration_order] = Teuchos::rcp(new panzer::IntegrationRule(integration_order,cell_data));
248 
249  // build up field library
251  for(std::vector<StrPureBasisPair>::const_iterator itr=m_provided_dofs.begin();
252  itr!=m_provided_dofs.end();++itr)
253  m_field_lib->addFieldAndBasis(itr->first,itr->second);
254 }
255 
256 // *******************************************************************
259  const panzer::CellData & cell_data) :
260  m_physics_id(pb.m_physics_id),
261  m_element_block_id(pb.m_element_block_id),
262  m_default_integration_order(pb.m_default_integration_order),
263  m_cell_data(cell_data), // NOT copied from pb
264  m_input_parameters(pb.m_input_parameters),
265  m_build_transient_support(pb.m_build_transient_support),
266  m_global_data(pb.m_global_data),
267  m_eqset_factory(pb.m_eqset_factory)
268 {
272  m_cell_data,
274 }
275 
276 // *******************************************************************
277 void panzer::PhysicsBlock::initialize(const int default_integration_order,
278  const bool build_transient_support,
279  const panzer::CellData & cell_data,
281  const Teuchos::RCP<panzer::GlobalData>& global_data,
282  const std::vector<std::string>& tangent_param_names)
283 {
284  m_default_integration_order = default_integration_order;
285  m_build_transient_support = build_transient_support;
286  m_cell_data = cell_data;
287  m_global_data = global_data;
288  m_eqset_factory = eqset_factory;
289 
290  initialize(m_input_parameters,
291  m_default_integration_order,
292  m_element_block_id,
293  m_cell_data,
294  m_build_transient_support,
295  tangent_param_names);
296 }
297 
298 // *******************************************************************
300  const int& default_integration_order,
301  const std::string & element_block_id,
302  const panzer::CellData & cell_data,
303  const bool build_transient_support,
304  const std::vector<std::string>& tangent_param_names)
305 {
306  using Teuchos::RCP;
308 
309  TEUCHOS_TEST_FOR_EXCEPTION(input_parameters->numParams() < 1, std::runtime_error,
310  "The physics block \"" << input_parameters->name()
311  << "\" required by element block \"" << element_block_id
312  << "\" does not have any equation sets associated with it."
313  << " Please add at least one equation set to this physics block!");
314 
315  m_equation_sets.clear();
316 
317  // Loop over equation sets
318  typedef ParameterList::ConstIterator pl_iter;
319  for (pl_iter eq = input_parameters->begin(); eq != input_parameters->end(); ++eq) {
320 
321  TEUCHOS_TEST_FOR_EXCEPTION( !(eq->second.isList()), std::logic_error,
322  "All entries in the physics block \"" << m_physics_id
323  << "\" must be an equation set sublist!" );
324 
325  RCP<ParameterList> eq_set_pl = Teuchos::sublist(input_parameters,eq->first,true);
326 
328  = m_eqset_factory->buildEquationSet(eq_set_pl, default_integration_order, cell_data, m_global_data, build_transient_support);
329 
330  // Set tangent parameter names for each equation set
331  for (auto eq_it = eq_set->begin(); eq_it != eq_set->end(); ++eq_it) {
332  eq_it->setTangentParamNames(tangent_param_names);
333  }
334 
335  // add this equation set in
336  m_equation_sets.push_back(eq_set);
337 
338  // Interrogate DOFs
339  const std::vector<StrPureBasisPair> & sbNames = eq_set->begin()->getProvidedDOFs();
340  for(std::size_t j=0;j<sbNames.size();j++) {
341 
342  // Generate list of dof names
343  m_dof_names.push_back(sbNames[j].first);
344 
345  // Generate dof name (string) / basis pairs
346  m_provided_dofs.push_back(sbNames[j]);
347 
348  // Generate unique list of bases
349  m_bases[sbNames[j].second->name()] = sbNames[j].second;
350 
351  // Generate tangent field names
352  for (std::size_t k=0; k<tangent_param_names.size(); ++k)
353  m_tangent_fields.push_back( StrPureBasisPair( sbNames[j].first + " SENSITIVITY " + tangent_param_names[k],
354  sbNames[j].second ) );
355 
356  }
357 
358  // add coordinate dofs to physics block
359  const std::vector<std::vector<std::string> > & coord_dofs = eq_set->begin()->getCoordinateDOFs();
360  m_coordinate_dofs.insert(m_coordinate_dofs.begin(),coord_dofs.begin(),coord_dofs.end());
361 
362  // Get a unique list of point rules. NOTE: This assumes that the
363  // same point rules are used for all evaluation types. In the
364  // future we could easily change this by adding another level here
365  // to differentiate the point rules for each evaluation type.
366  // This would require some refactoring of the phsyics block
367  // registration routines and the workset builder to support all
368  // combinations of bases and point rules for each evaluation type.
369  const std::map<int,Teuchos::RCP<panzer::IntegrationRule> > & ir_map = eq_set->begin()->getIntegrationRules();
370  for(std::map<int,Teuchos::RCP<panzer::IntegrationRule> >::const_iterator ir = ir_map.begin();
371  ir != ir_map.end(); ++ir)
372  m_integration_rules[ir->second->order()] = ir->second;
373 
374  }
375 
376  // build up field library
377  m_field_lib = Teuchos::rcp(new FieldLibrary);
378  for(std::vector<StrPureBasisPair>::const_iterator itr=m_provided_dofs.begin();
379  itr!=m_provided_dofs.end();++itr)
380  m_field_lib->addFieldAndBasis(itr->first,itr->second);
381 
382  // setup element blocks: loop over each evaluation type
383  for(std::size_t eq_i=0;eq_i<m_equation_sets.size();eq_i++) {
384  RCP<panzer::EquationSet_TemplateManager<panzer::Traits> > eq_set = m_equation_sets[eq_i];
386  itr!=eq_set->end();++itr) {
387  itr->setElementBlockId(element_block_id);
388  }
389  }
390 
391 }
392 
393 // *******************************************************************
396  const Teuchos::ParameterList& user_data) const
397 {
398  using namespace std;
399  using namespace panzer;
400  using namespace Teuchos;
401 
402  // Loop over equation set template managers
403  vector< RCP<EquationSet_TemplateManager<panzer::Traits> > >::const_iterator
404  eq_set = m_equation_sets.begin();
405  for (;eq_set != m_equation_sets.end(); ++eq_set) {
406 
407  // Loop over evaluation types
410  eqstm.begin();
411  for (; eval_type != eqstm.end(); ++eval_type) {
412 
413  // Do not loop over integration rules. Only call this for the
414  // ir that the residual is integrated over. Otherwise the
415  // residual gets contributions from multiple integrations of the
416  // same cell! This ir is only known by equaiton set.
417  const int di = eval_type->setDetailsIndex(this->getDetailsIndex());
418  eval_type->buildAndRegisterEquationSetEvaluators(fm, *m_field_lib, user_data);
419  eval_type->setDetailsIndex(di);
420  }
421  }
422 }
423 
424 // *******************************************************************
428  const Teuchos::ParameterList& user_data) const
429 {
430  using namespace std;
431  using namespace panzer;
432  using namespace Teuchos;
433 
434  // Loop over equation set template managers
435  vector< RCP<EquationSet_TemplateManager<panzer::Traits> > >::const_iterator
436  eq_set = m_equation_sets.begin();
437  for (;eq_set != m_equation_sets.end(); ++eq_set) {
438 
439  // Loop over evaluation types
442  eqstm.begin();
443  for (; eval_type != eqstm.end(); ++eval_type) {
444  const int di = eval_type->setDetailsIndex(this->getDetailsIndex());
445  eval_type->buildAndRegisterGatherAndOrientationEvaluators(fm, *m_field_lib, lof, user_data);
446  eval_type->setDetailsIndex(di);
447  }
448  }
449 }
450 
451 // *******************************************************************
455  const Teuchos::ParameterList& user_data) const
456 {
457  using namespace std;
458  using namespace panzer;
459  using namespace Teuchos;
460 
461  // Loop over equation set template managers
462  vector< RCP<EquationSet_TemplateManager<panzer::Traits> > >::const_iterator
463  eq_set = m_equation_sets.begin();
464  for (;eq_set != m_equation_sets.end(); ++eq_set) {
465 
466  // Loop over evaluation types
469  eqstm.begin();
470  for (; eval_type != eqstm.end(); ++eval_type) {
471 
472  // Loop over integration rules
473  for (std::map<int,Teuchos::RCP<panzer::IntegrationRule> >::const_iterator ir_iter = m_integration_rules.begin();
474  ir_iter != m_integration_rules.end(); ++ ir_iter) {
475 
476  Teuchos::RCP<panzer::IntegrationRule> ir = ir_iter->second;
477 
478  const int di = eval_type->setDetailsIndex(this->getDetailsIndex());
479  eval_type->buildAndRegisterDOFProjectionsToIPEvaluators(fm, *m_field_lib->buildFieldLayoutLibrary(*ir), ir, lof, user_data);
480  eval_type->setDetailsIndex(di);
481  }
482  }
483  }
484 }
485 
486 // *******************************************************************
490  const Teuchos::ParameterList& user_data) const
491 {
492  using namespace std;
493  using namespace panzer;
494  using namespace Teuchos;
495 
496  // Loop over equation set template managers
497  vector< RCP<EquationSet_TemplateManager<panzer::Traits> > >::const_iterator
498  eq_set = m_equation_sets.begin();
499  for (;eq_set != m_equation_sets.end(); ++eq_set) {
500 
501  // Loop over evaluation types
504  eqstm.begin();
505  for (; eval_type != eqstm.end(); ++eval_type) {
506  const int di = eval_type->setDetailsIndex(this->getDetailsIndex());
507  eval_type->buildAndRegisterScatterEvaluators(fm, *m_field_lib, lof, user_data);
508  eval_type->setDetailsIndex(di);
509  }
510  }
511 }
512 
513 // *******************************************************************
517  const Teuchos::ParameterList& models,
518  const Teuchos::ParameterList& user_data) const
519 {
520  using namespace std;
521  using namespace panzer;
522  using namespace Teuchos;
523 
524  // Loop over equation set template managers
525  vector< RCP<EquationSet_TemplateManager<panzer::Traits> > >::const_iterator
526  eq_set = m_equation_sets.begin();
527  for (;eq_set != m_equation_sets.end(); ++eq_set) {
528 
529  // Loop over evaluation types
532  eqstm.begin();
533  for (; eval_type != eqstm.end(); ++eval_type) {
534 
535  // Loop over integration rules
536  for (std::map<int,Teuchos::RCP<panzer::IntegrationRule> >::const_iterator ir_iter = m_integration_rules.begin();
537  ir_iter != m_integration_rules.end(); ++ ir_iter) {
538 
539  Teuchos::RCP<panzer::IntegrationRule> ir = ir_iter->second;
540 
541  const int di = eval_type->setDetailsIndex(this->getDetailsIndex());
542  eval_type->buildAndRegisterClosureModelEvaluators(fm, *m_field_lib->buildFieldLayoutLibrary(*ir), ir, factory, models, user_data);
543  eval_type->setDetailsIndex(di);
544  }
545  }
546  }
547 }
548 
549 // *******************************************************************
550 
554  const std::string& model_name,
555  const Teuchos::ParameterList& models,
556  const Teuchos::ParameterList& user_data) const
557 {
558  using namespace std;
559  using namespace panzer;
560  using namespace Teuchos;
561 
562  // Loop over equation set template managers
563  vector< RCP<EquationSet_TemplateManager<panzer::Traits> > >::const_iterator
564  eq_set = m_equation_sets.begin();
565  for (;eq_set != m_equation_sets.end(); ++eq_set) {
566 
567  // Loop over evaluation types
570  eqstm.begin();
571  for (; eval_type != eqstm.end(); ++eval_type) {
572 
573  // Loop over integration rules
574  for (std::map<int,Teuchos::RCP<panzer::IntegrationRule> >::const_iterator ir_iter = m_integration_rules.begin();
575  ir_iter != m_integration_rules.end(); ++ ir_iter) {
576 
577  Teuchos::RCP<panzer::IntegrationRule> ir = ir_iter->second;
578  const int di = eval_type->setDetailsIndex(this->getDetailsIndex());
579  eval_type->buildAndRegisterClosureModelEvaluators(fm, *m_field_lib->buildFieldLayoutLibrary(*ir), ir, factory, model_name, models, user_data);
580  eval_type->setDetailsIndex(di);
581  }
582  }
583  }
584 
585  // if there are no equation sets call the closure model directly
586  if(m_equation_sets.size()==0) {
588  for (;eval_type != factory.end(); ++eval_type) {
589  // setup some place holder parameter list, lets hope no one needs is!
591 
592  // Loop over integration rules
593  for (std::map<int,Teuchos::RCP<panzer::IntegrationRule> >::const_iterator ir_iter = m_integration_rules.begin();
594  ir_iter != m_integration_rules.end(); ++ ir_iter) {
595 
596  Teuchos::RCP<panzer::IntegrationRule> ir = ir_iter->second;
597 
598  // call directly to the closure models
600  eval_type->buildClosureModels(model_name,
601  models,
602  *m_field_lib->buildFieldLayoutLibrary(*ir),
603  ir,
604  plist,
605  user_data,
606  this->globalData(),
607  fm);
608 
609  // register the constructed evaluators
610  const int di = eval_type->setDetailsIndex(this->getDetailsIndex());
611  eval_type->registerEvaluators(*evaluators,fm);
612  eval_type->setDetailsIndex(di);
613  }
614  }
615  }
616 }
617 
618 // *******************************************************************
622  const std::string& model_name,
623  const Teuchos::ParameterList& models,
625  const Teuchos::ParameterList& user_data) const
626 {
627  using namespace std;
628  using namespace panzer;
629  using namespace Teuchos;
630 
631  // Only use the <Residual> evaluation type, so pass through to type specific call
632  this->buildAndRegisterInitialConditionEvaluatorsForType<panzer::Traits::Residual>(fm, factory, model_name, models, lof, user_data);
633 
634 }
635 
636 
637 // *******************************************************************
638 const std::vector<std::string>& panzer::PhysicsBlock::getDOFNames() const
639 {
640  return m_dof_names;
641 }
642 
643 // *******************************************************************
644 const std::vector<panzer::StrPureBasisPair>& panzer::PhysicsBlock::getProvidedDOFs() const
645 {
646  return m_provided_dofs;
647 }
648 
649 // *******************************************************************
650 const std::vector<std::vector<std::string> >& panzer::PhysicsBlock::getCoordinateDOFs() const
651 {
652  return m_coordinate_dofs;
653 }
654 
655 // *******************************************************************
656 const std::vector<panzer::StrPureBasisPair>& panzer::PhysicsBlock::getTangentFields() const
657 {
658  return m_tangent_fields;
659 }
660 
661 // *******************************************************************
663 {
664  panzer::WorksetNeeds needs;
665 
666  needs.cellData = this->cellData();
667  const std::map<int,Teuchos::RCP<panzer::IntegrationRule> >& int_rules = this->getIntegrationRules();
668  for (std::map<int,Teuchos::RCP<panzer::IntegrationRule> >::const_iterator ir_itr = int_rules.begin();
669  ir_itr != int_rules.end(); ++ir_itr)
670  needs.int_rules.push_back(ir_itr->second);
671 
672  const std::map<std::string,Teuchos::RCP<panzer::PureBasis> >& bases= this->getBases();
673  const std::vector<StrPureBasisPair>& fieldToBasis = getProvidedDOFs();
674  for(std::map<std::string,Teuchos::RCP<panzer::PureBasis> >::const_iterator b_itr = bases.begin();
675  b_itr != bases.end(); ++b_itr) {
676 
677  needs.bases.push_back(b_itr->second);
678 
679  bool found = false;
680  for(std::size_t d=0;d<fieldToBasis.size();d++) {
681  if(fieldToBasis[d].second->name()==b_itr->second->name()) {
682  // add representative basis for this field
683  needs.rep_field_name.push_back(fieldToBasis[d].first);
684  found = true;
685 
686  break;
687  }
688  }
689 
690  // this should always work if physics blocks are correctly constructed
691  TEUCHOS_ASSERT(found);
692  }
693 
694  return needs;
695 }
696 
697 // *******************************************************************
698 const std::map<std::string,Teuchos::RCP<panzer::PureBasis> >&
700 {
701  return m_bases;
702 }
703 
704 // *******************************************************************
705 const std::map<int,Teuchos::RCP<panzer::IntegrationRule> >&
707 {
708  return m_integration_rules;
709 }
710 
711 // *******************************************************************
712 const shards::CellTopology panzer::PhysicsBlock::getBaseCellTopology() const
713 {
714  TEUCHOS_TEST_FOR_EXCEPTION(m_bases.size() == 0, std::runtime_error,
715  "Cannot return a basis since none exist in this physics block.");
716  return m_bases.begin()->second->getIntrepid2Basis()->getBaseCellTopology();
717 }
718 
719 // *******************************************************************
721 {
722  return m_physics_id;
723 }
724 
725 // *******************************************************************
727 {
728  return m_element_block_id;
729 }
730 
731 // *******************************************************************
733 {
734  return m_cell_data;
735 }
736 
737 // *******************************************************************
739 {
740  return Teuchos::rcp(new panzer::PhysicsBlock(*this,cell_data));
741 }
742 
743 // *******************************************************************
745 {
746  return m_global_data;
747 }
748 
749 // *******************************************************************
std::string name() const
A unique key that is the combination of the basis type and basis order.
Teuchos::RCP< PhysicsBlock > copyWithCellData(const panzer::CellData &cell_data) const
const std::string & name() const
std::vector< Teuchos::RCP< const PureBasis > > bases
const std::vector< std::string > & getDOFNames() const
ConstIterator end() const
std::vector< StrPureBasisPair > m_provided_dofs
Object that contains information on the physics and discretization of a block of elements with the SA...
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...
const panzer::CellData & cellData() const
void buildAndRegisterClosureModelEvaluators(PHX::FieldManager< panzer::Traits > &fm, const panzer::ClosureModelFactory_TemplateManager< panzer::Traits > &factory, const Teuchos::ParameterList &models, const Teuchos::ParameterList &user_data) const
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void buildAndRegisterScatterEvaluators(PHX::FieldManager< panzer::Traits > &fm, const panzer::LinearObjFactory< panzer::Traits > &lof, const Teuchos::ParameterList &user_data) const
Ordinal numParams() const
std::vector< Teuchos::RCP< const IntegrationRule > > int_rules
std::string physicsBlockID() const
void buildAndRegisterInitialConditionEvaluators(PHX::FieldManager< panzer::Traits > &fm, const panzer::ClosureModelFactory_TemplateManager< panzer::Traits > &factory, const std::string &model_name, const Teuchos::ParameterList &models, const panzer::LinearObjFactory< panzer::Traits > &lof, const Teuchos::ParameterList &user_data) const
std::vector< std::string > rep_field_name
void buildAndRegisterGatherAndOrientationEvaluators(PHX::FieldManager< panzer::Traits > &fm, const panzer::LinearObjFactory< panzer::Traits > &lof, const Teuchos::ParameterList &user_data) const
Teuchos::RCP< panzer::GlobalData > globalData() const
std::vector< Teuchos::RCP< panzer::EquationSet_TemplateManager< panzer::Traits > > > m_equation_sets
void buildAndRegisterDOFProjectionsToIPEvaluators(PHX::FieldManager< panzer::Traits > &fm, const Teuchos::Ptr< const panzer::LinearObjFactory< panzer::Traits > > &lof, const Teuchos::ParameterList &user_data) const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Data for determining cell topology and dimensionality.
panzer::CellData m_cell_data
bool isSublist(const std::string &name) const
std::string elementBlockID() const
const std::vector< std::vector< std::string > > & getCoordinateDOFs() const
std::map< std::string, Teuchos::RCP< panzer::PureBasis > > m_bases
map of unique bases, key is the panzer::PureBasis::name() corresponding to its value ...
Teuchos::RCP< Teuchos::ParameterList > m_input_parameters
store the input parameter list for copy ctors
std::map< int, Teuchos::RCP< panzer::IntegrationRule > > m_integration_rules
map of unique integration rules, key is panzer::IntegrationRule::order() corresponding to its value ...
ConstIterator begin() const
const shards::CellTopology getBaseCellTopology() const
const std::vector< StrPureBasisPair > & getTangentFields() const
Returns list of tangent fields from DOFs and tangent param names.
WorksetNeeds getWorksetNeeds() const
bool nonnull(const boost::shared_ptr< T > &p)
const std::map< int, Teuchos::RCP< panzer::IntegrationRule > > & getIntegrationRules() const
Returns the unique set of point rules, key is the unique panzer::PointRule::name() ...
void initialize(const int default_integration_order, const bool build_transient_support, const panzer::CellData &cell_data, const Teuchos::RCP< const panzer::EquationSetFactory > &factory, const Teuchos::RCP< panzer::GlobalData > &global_data, const std::vector< std::string > &tangent_param_names=std::vector< std::string >())
std::pair< std::string, Teuchos::RCP< panzer::PureBasis > > StrPureBasisPair
Teuchos::RCP< FieldLibrary > m_field_lib
#define TEUCHOS_ASSERT(assertion_test)
std::vector< std::string > m_dof_names
void buildAndRegisterEquationSetEvaluators(PHX::FieldManager< panzer::Traits > &fm, const Teuchos::ParameterList &user_data) const
const std::vector< StrPureBasisPair > & getProvidedDOFs() const