Panzer  Version of the Day
Panzer_AssemblyEngine_InArgs.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_ASSEMBLY_ENGINE_INARGS_HPP
44 #define PANZER_ASSEMBLY_ENGINE_INARGS_HPP
45 
46 #include "Teuchos_RCP.hpp"
47 #include "Teuchos_ScalarTraits.hpp"
48 
49 class Epetra_Vector;
50 class Epetra_CrsMatrix;
51 class Epetra_Map;
52 
53 namespace panzer {
54 
55  class LinearObjContainer;
56 
58  public:
59 
60  AssemblyEngineInArgs(const Teuchos::RCP<panzer::LinearObjContainer> & ghostedContainer,
61  const Teuchos::RCP<panzer::LinearObjContainer> & container)
62  : ghostedContainer_(ghostedContainer), container_(container)
63  , alpha(Teuchos::ScalarTraits<double>::nan()) // also setup some painful and
64  , beta(Teuchos::ScalarTraits<double>::nan()) // hopefully loud initial values
65  , time(Teuchos::ScalarTraits<double>::nan())
66  , step_size(Teuchos::ScalarTraits<double>::nan())
67  , stage_number(Teuchos::ScalarTraits<double>::one())
71  , apply_dirichlet_beta(false)
72  , dirichlet_beta(0.0)
73  { }
74 
77  , alpha(Teuchos::ScalarTraits<double>::nan()) // also setup some painful and
78  , beta(Teuchos::ScalarTraits<double>::nan()) // hopefully loud initial values
79  , time(Teuchos::ScalarTraits<double>::nan())
80  , step_size(Teuchos::ScalarTraits<double>::nan())
81  , stage_number(Teuchos::ScalarTraits<double>::one())
85  , apply_dirichlet_beta(false)
86  , dirichlet_beta(0.0)
87  { }
88 
89  Teuchos::RCP<panzer::LinearObjContainer> ghostedContainer_;
90  Teuchos::RCP<panzer::LinearObjContainer> container_;
91 
92  double alpha;
93  double beta;
94  double time;
95  double step_size;
96  double stage_number;
97  std::vector<double> gather_seeds; // generic gather seeds
101 
104 
111  void addGlobalEvaluationData(const std::string & key,const Teuchos::RCP<GlobalEvaluationData> & ged)
112  {
113  TEUCHOS_TEST_FOR_EXCEPTION(ged_map.find(key)!=ged_map.end(),std::logic_error,
114  "AssemblyEngine::addGlobalEvaluationData: Method cannot over write existing "
115  "data object with key \"" + key + "\"");
116 
117  ged_map[key] = ged;
118  }
119 
121  {
122  ged_map.insert(gedc.begin(),gedc.end());
123  }
124 
127  {
128  std::map<std::string,Teuchos::RCP<GlobalEvaluationData> >::const_iterator itr;
129  for(itr=ged_map.begin();itr!=ged_map.end();++itr)
130  gedc.addDataObject(itr->first,itr->second);
131  }
132 
133  const std::map<std::string,Teuchos::RCP<GlobalEvaluationData> > &
135  { return ged_map; }
136 
137  private:
138  std::map<std::string,Teuchos::RCP<GlobalEvaluationData> > ged_map;
139  };
140 
141 
145  inline std::ostream & operator<<(std::ostream & os,const AssemblyEngineInArgs & in)
146  {
147  os << "AE Inargs:\n"
148  << " alpha = " << in.alpha << "\n"
149  << " beta = " << in.beta << "\n"
150  << " time = " << in.time << "\n"
151  << " step_size = " << in.step_size << "\n"
152  << " stage_number = " << in.stage_number << "\n"
153  << " eval_tran = " << in.evaluate_transient_terms << "\n"
154  << " 1st sens_name = " << in.first_sensitivities_name << "\n"
155  << " 2nd sens_name = " << in.second_sensitivities_name << "\n"
156  << " apply_db = " << in.apply_dirichlet_beta << "\n"
157  << " db = " << in.dirichlet_beta << "\n"
158  << " seeds = ";
159  for(std::size_t i=0;i<in.gather_seeds.size();i++)
160  os << in.gather_seeds[i] << " ";
161  os << "\n";
162 
163  const std::map<std::string,Teuchos::RCP<GlobalEvaluationData> > & ged_map
165  os << " ged_map = ";
166  for(std::map<std::string,Teuchos::RCP<GlobalEvaluationData> >::const_iterator itr=ged_map.begin();
167  itr!=ged_map.end();++itr) {
168  os << " \"" << itr->first << "\": ";
169  itr->second->print(os);
170  os << "\n";
171  }
172  os << std::endl;
173 
174  return os;
175  }
176 
177 }
178 
179 #endif
void addDataObject(const std::string &key, const Teuchos::RCP< GlobalEvaluationData > &ged)
Teuchos::RCP< panzer::LinearObjContainer > ghostedContainer_
void fillGlobalEvaluationDataContainer(GlobalEvaluationDataContainer &gedc) const
Using internal map fill the global evaluation data container object.
Teuchos::RCP< panzer::LinearObjContainer > container_
void addGlobalEvaluationData(const std::string &key, const Teuchos::RCP< GlobalEvaluationData > &ged)
void addGlobalEvaluationData(const GlobalEvaluationDataContainer &gedc)
AssemblyEngineInArgs(const Teuchos::RCP< panzer::LinearObjContainer > &ghostedContainer, const Teuchos::RCP< panzer::LinearObjContainer > &container)
std::ostream & operator<<(std::ostream &os, const AssemblyEngineInArgs &in)
const std::map< std::string, Teuchos::RCP< GlobalEvaluationData > > & getGlobalEvaluationDataMap() const
std::map< std::string, Teuchos::RCP< GlobalEvaluationData > > ged_map