Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_SGEpetraLinearObjFactory_decl.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_SGEpetraLinearObjFactory_decl_hpp__
44 #define __Panzer_SGEpetraLinearObjFactory_decl_hpp__
45 
46 #include "Panzer_config.hpp"
47 #ifdef HAVE_STOKHOS
48 
49 #include <map>
50 
51 // Epetra includes
52 #include "Epetra_Map.h"
53 #include "Epetra_CrsGraph.h"
54 #include "Epetra_Import.h"
55 #include "Epetra_Export.h"
56 
57 #include "Panzer_config.hpp"
60 #include "Panzer_EpetraLinearObjFactory.hpp"
62 
63 #include "Teuchos_RCP.hpp"
65 
66 #include "Stokhos_OrthogPolyBasis.hpp"
67 #include "Stokhos_EpetraVectorOrthogPoly.hpp"
68 
69 #include <vector>
70 
71 namespace panzer {
72 
77 template <typename Traits,typename LocalOrdinalT>
79 public:
80 
83  const Teuchos::RCP<const EpetraExt::MultiComm> & globalMultiComm);
84 
85  virtual ~SGEpetraLinearObjFactory();
86 
87 /*************** Linear object factory methods *******************/
88 
89  virtual void readVector(const std::string & identifier,LinearObjContainer & loc,int id) const
90  { TEUCHOS_ASSERT(false); }
91 
92  virtual void writeVector(const std::string & identifier,const LinearObjContainer & loc,int id) const
93  { TEUCHOS_ASSERT(false); }
94 
97 
100 
101  virtual void globalToGhostContainer(const LinearObjContainer & container,
102  LinearObjContainer & ghostContainer,int mem) const;
103  virtual void ghostToGlobalContainer(const LinearObjContainer & ghostContainer,
104  LinearObjContainer & container,int mem) const;
105 
112  virtual void adjustForDirichletConditions(const LinearObjContainer & localBCRows,
113  const LinearObjContainer & globalBCRows,
114  LinearObjContainer & ghostedObjs,
115  bool zeroVectorRows=false, bool adjustX=false) const;
116 
120  virtual void applyDirichletBCs(const LinearObjContainer & counter,
121  LinearObjContainer & result) const;
122 
125  virtual Teuchos::MpiComm<int> getComm() const;
126 
128  template <typename EvalT>
130  { return epetraFact_->template buildScatter<EvalT>(); }
131 
133  template <typename EvalT>
135  { return epetraFact_->template buildGather<EvalT>(); }
136 
138  template <typename EvalT>
140  { return epetraFact_->template buildGatherTangent<EvalT>(); }
141 
143  template <typename EvalT>
145  { return epetraFact_->template buildGatherOrientation<EvalT>(); }
146 
148  template <typename EvalT>
150  { return epetraFact_->template buildScatterDirichlet<EvalT>(); }
151 
152 /*************** Generic helper functions for container setup *******************/
153 
159  void initializeContainer(int mem,LinearObjContainer & loc) const;
160 
166  void initializeGhostedContainer(int mem,LinearObjContainer & loc) const;
167 
171  { return epetraFact_; }
172 
175  { return expansion_; }
176 
179  { return expansion_; }
180 
183 
186 
189 
192  { return epetraFact_->getUniqueGlobalIndexerBase(); }
193 
194 protected:
195 
199 
200  mutable Teuchos::RCP<const Epetra_Map> sgBlockMap_; // constructed via lazy evaluation
201 };
202 
203 }
204 
205 #endif
206 #endif
Teuchos::RCP< const Stokhos::OrthogPolyExpansion< int, double > > getExpansion() const
Accessor for the expansion object.
virtual void applyDirichletBCs(const LinearObjContainer &counter, LinearObjContainer &result) const
Teuchos::RCP< const panzer::UniqueGlobalIndexerBase > getUniqueGlobalIndexerBase() const
Get the unique global indexer this factory was created with.
virtual Teuchos::MpiComm< int > getComm() const
virtual void readVector(const std::string &identifier, LinearObjContainer &loc, int id) const
Teuchos::RCP< panzer::CloneableEvaluator > buildScatterDirichlet() const
Use preconstructed dirichlet scatter evaluators.
Teuchos::RCP< panzer::CloneableEvaluator > buildScatter() const
Use preconstructed scatter evaluators.
virtual Teuchos::RCP< LinearObjContainer > buildPrimitiveLinearObjContainer() const
virtual void adjustForDirichletConditions(const LinearObjContainer &localBCRows, const LinearObjContainer &globalBCRows, LinearObjContainer &ghostedObjs, bool zeroVectorRows=false, bool adjustX=false) const
void initializeGhostedContainer(int mem, LinearObjContainer &loc) const
Teuchos::RCP< Stokhos::OrthogPolyExpansion< int, double > > expansion_
Teuchos::RCP< EpetraLinearObjFactory< Traits, LocalOrdinalT > > epetraFact_
void initializeContainer(int mem, LinearObjContainer &loc) const
Teuchos::RCP< const Epetra_Map > getSGBlockMap() const
get the block map needed by Stokhos to describe the parallel layout of the SG unknowns ...
virtual Teuchos::RCP< LinearObjContainer > buildPrimitiveGhostedLinearObjContainer() const
Teuchos::RCP< const EpetraExt::MultiComm > globalMultiComm_
virtual void ghostToGlobalContainer(const LinearObjContainer &ghostContainer, LinearObjContainer &container, int mem) const
SGEpetraLinearObjFactory(const Teuchos::RCP< EpetraLinearObjFactory< Traits, LocalOrdinalT > > &epetraFact, const Teuchos::RCP< Stokhos::OrthogPolyExpansion< int, double > > &expansion, const Teuchos::RCP< const EpetraExt::MultiComm > &globalMultiComm)
Teuchos::RCP< panzer::CloneableEvaluator > buildGatherTangent() const
Use preconstructed gather evaluators.
Teuchos::RCP< const Epetra_Map > getMap()
get the map from the matrix, this is the map for the solution vector
virtual Teuchos::RCP< LinearObjContainer > buildGhostedLinearObjContainer() const
virtual void globalToGhostContainer(const LinearObjContainer &container, LinearObjContainer &ghostContainer, int mem) const
virtual void writeVector(const std::string &identifier, const LinearObjContainer &loc, int id) const
virtual Teuchos::RCP< LinearObjContainer > buildLinearObjContainer() const
Teuchos::RCP< Stokhos::OrthogPolyExpansion< int, double > > getExpansion()
Accessor for the expansion object.
Teuchos::RCP< panzer::CloneableEvaluator > buildGather() const
Use preconstructed gather evaluators.
#define TEUCHOS_ASSERT(assertion_test)
Teuchos::RCP< Stokhos::EpetraVectorOrthogPoly > getVectorOrthogPoly() const
Set orthog poly object, this serves as a template for converting vectors to block vectors...
Teuchos::RCP< panzer::CloneableEvaluator > buildGatherOrientation() const
Use preconstructed gather evaluators.
Teuchos::RCP< EpetraLinearObjFactory< Traits, LocalOrdinalT > > getEpetraFactory() const