Panzer Version of the Day
Loading...
Searching...
No Matches
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
50
51class Epetra_Vector;
53class Epetra_Map;
54
55namespace panzer {
56
57 class LinearObjContainer;
58
60 public:
61
62 AssemblyEngineInArgs(const Teuchos::RCP<panzer::LinearObjContainer> & ghostedContainer,
63 const Teuchos::RCP<panzer::LinearObjContainer> & container)
64 : ghostedContainer_(ghostedContainer), container_(container)
65 , alpha(Teuchos::ScalarTraits<double>::nan()) // also setup some painful and
66 , beta(Teuchos::ScalarTraits<double>::nan()) // hopefully loud initial values
67 , time(Teuchos::ScalarTraits<double>::nan())
68 , step_size(Teuchos::ScalarTraits<double>::nan())
69 , stage_number(Teuchos::ScalarTraits<double>::one())
74 , dirichlet_beta(0.0)
75 { }
76
79 , alpha(Teuchos::ScalarTraits<double>::nan()) // also setup some painful and
80 , beta(Teuchos::ScalarTraits<double>::nan()) // hopefully loud initial values
81 , time(Teuchos::ScalarTraits<double>::nan())
82 , step_size(Teuchos::ScalarTraits<double>::nan())
83 , stage_number(Teuchos::ScalarTraits<double>::one())
88 , dirichlet_beta(0.0)
89 { }
90
91 Teuchos::RCP<panzer::LinearObjContainer> ghostedContainer_;
92 Teuchos::RCP<panzer::LinearObjContainer> container_;
93
94 double alpha;
95 double beta;
96 double time;
97 double step_size;
99 std::vector<double> gather_seeds; // generic gather seeds
103
106
113 void addGlobalEvaluationData(const std::string & key,const Teuchos::RCP<GlobalEvaluationData> & ged)
114 {
115 TEUCHOS_TEST_FOR_EXCEPTION(ged_map.find(key)!=ged_map.end(),std::logic_error,
116 "AssemblyEngine::addGlobalEvaluationData: Method cannot over write existing "
117 "data object with key \"" + key + "\"");
118
119 ged_map[key] = ged;
120 }
121
123 {
124 ged_map.insert(gedc.begin(),gedc.end());
125 }
126
129 {
130 std::map<std::string,Teuchos::RCP<GlobalEvaluationData> >::const_iterator itr;
131 for(itr=ged_map.begin();itr!=ged_map.end();++itr)
132 gedc.addDataObject(itr->first,itr->second);
133 }
134
135 const std::map<std::string,Teuchos::RCP<GlobalEvaluationData> > &
137 { return ged_map; }
138
139 private:
140 std::map<std::string,Teuchos::RCP<GlobalEvaluationData> > ged_map;
141 };
142
143
147 inline std::ostream & operator<<(std::ostream & os,const AssemblyEngineInArgs & in)
148 {
149 os << "AE Inargs:\n"
150 << " alpha = " << in.alpha << "\n"
151 << " beta = " << in.beta << "\n"
152 << " time = " << in.time << "\n"
153 << " step_size = " << in.step_size << "\n"
154 << " stage_number = " << in.stage_number << "\n"
155 << " eval_tran = " << in.evaluate_transient_terms << "\n"
156 << " 1st sens_name = " << in.first_sensitivities_name << "\n"
157 << " 2nd sens_name = " << in.second_sensitivities_name << "\n"
158 << " apply_db = " << in.apply_dirichlet_beta << "\n"
159 << " db = " << in.dirichlet_beta << "\n"
160 << " seeds = ";
161 for(std::size_t i=0;i<in.gather_seeds.size();i++)
162 os << in.gather_seeds[i] << " ";
163 os << "\n";
164
165 const std::map<std::string,Teuchos::RCP<GlobalEvaluationData> > & ged_map
167 os << " ged_map = ";
168 for(std::map<std::string,Teuchos::RCP<GlobalEvaluationData> >::const_iterator itr=ged_map.begin();
169 itr!=ged_map.end();++itr) {
170 os << " \"" << itr->first << "\": ";
171 itr->second->print(os);
172 os << "\n";
173 }
174 os << std::endl;
175
176 return os;
177 }
178
179}
180
181#endif
std::map< std::string, Teuchos::RCP< GlobalEvaluationData > > ged_map
AssemblyEngineInArgs(const Teuchos::RCP< panzer::LinearObjContainer > &ghostedContainer, const Teuchos::RCP< panzer::LinearObjContainer > &container)
void addGlobalEvaluationData(const std::string &key, const Teuchos::RCP< GlobalEvaluationData > &ged)
void addGlobalEvaluationData(const GlobalEvaluationDataContainer &gedc)
Teuchos::RCP< panzer::LinearObjContainer > ghostedContainer_
const std::map< std::string, Teuchos::RCP< GlobalEvaluationData > > & getGlobalEvaluationDataMap() const
Teuchos::RCP< panzer::LinearObjContainer > container_
void fillGlobalEvaluationDataContainer(GlobalEvaluationDataContainer &gedc) const
Using internal map fill the global evaluation data container object.
void addDataObject(const std::string &key, const Teuchos::RCP< GlobalEvaluationData > &ged)
std::ostream & operator<<(std::ostream &os, const AssemblyEngineInArgs &in)