Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_UniqueGlobalIndexer_EpetraUtilities.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_UniqueGlobalIndexer_EpetraUtilities_decl_hpp__
44 #define __Panzer_UniqueGlobalIndexer_EpetraUtilities_decl_hpp__
45 
46 #include <map>
47 #include <string>
48 
49 #include <unordered_map>
50 
51 #include <Panzer_NodeType.hpp>
52 #include <Epetra_Vector.h>
53 #include <Epetra_IntVector.h>
54 #include <Epetra_MultiVector.h>
55 
57 #include "Panzer_FieldPattern.hpp"
58 
59 namespace panzer {
60 
61 
74 template <typename LocalOrdinalT,typename GlobalOrdinalT>
76 buildGhostedFieldReducedVectorEpetra(const UniqueGlobalIndexer<LocalOrdinalT,GlobalOrdinalT> & ugi);
77 
88 template <typename LocalOrdinalT,typename GlobalOrdinalT,typename Node>
90 buildGhostedFieldVectorEpetra(const UniqueGlobalIndexer<LocalOrdinalT,GlobalOrdinalT> & ugi,
91  const Teuchos::RCP<const Epetra_IntVector> & reducedVec=Teuchos::null);
92 
95 template <typename LocalOrdinalT,typename GlobalOrdinalT>
98  const Teuchos::RCP<const Epetra_IntVector> & reducedVec=Teuchos::null)
99 { return buildGhostedFieldVectorEpetra<LocalOrdinalT,GlobalOrdinalT,panzer::TpetraNodeType>(ugi,reducedVec); }
100 
114 template <typename LocalOrdinalT,typename GlobalOrdinalT,typename Node>
115 void buildGhostedFieldVectorEpetra(const UniqueGlobalIndexer<LocalOrdinalT,GlobalOrdinalT> & ugi,
116  std::vector<int> & fieldNumbers,
117  const Teuchos::RCP<const Epetra_IntVector> & reducedVec=Teuchos::null);
118 
121 template <typename LocalOrdinalT,typename GlobalOrdinalT>
123  std::vector<int> & fieldNumbers,
124  const Teuchos::RCP<const Epetra_IntVector> & reducedVec=Teuchos::null)
125 { buildGhostedFieldVectorEpetra<LocalOrdinalT,GlobalOrdinalT,panzer::TpetraNodeType>(ugi,fieldNumbers,reducedVec); }
126 
139 template <typename ScalarT,typename ArrayT,typename LocalOrdinalT,typename GlobalOrdinalT,typename Node>
140 void updateGhostedDataReducedVectorEpetra(const std::string & fieldName,const std::string blockId,
141  const UniqueGlobalIndexer<LocalOrdinalT,GlobalOrdinalT> & ugi,
142  const ArrayT & data,
143  Epetra_MultiVector & dataVector);
144 
155 getFieldMapEpetra(int fieldNum,const Epetra_IntVector & fieldVector);
156 
157 
160 template <typename LocalOrdinalT,typename GlobalOrdinalT,typename Node>
162 public:
167 
177  template <typename ScalarT,typename ArrayT>
179  getGhostedDataVector(const std::string & fieldName,const std::map<std::string,ArrayT> & data) const;
180 
190  template <typename ScalarT,typename ArrayT>
192  getDataVector(const std::string & fieldName,const std::map<std::string,ArrayT> & data) const;
193 
199  getFieldMap(const std::string & fieldName) const;
200 
206  getFieldMap(int fieldNum) const;
207 
208 protected:
212 
214  void buildFieldVector(const Epetra_IntVector & source) const;
215 
218 
221 
222  mutable std::map<int,Teuchos::RCP<const Map> > gh_reducedFieldMaps_;
223  mutable std::map<int,Teuchos::RCP<const Map> > gh_fieldMaps_;
224 
226  mutable std::map<int,Teuchos::RCP<const Map> > fieldMaps_;
227 
228 private:
229  // hide some constructors
232 };
233 
234 
235 } // end namspace panzer
236 
238 
239 #endif
void buildFieldVector(const Epetra_IntVector &source) const
build unghosted field vector from ghosted field vector
Teuchos::RCP< Epetra_MultiVector > getDataVector(const std::string &fieldName, const std::map< std::string, ArrayT > &data) const
ArrayToFieldVectorEpetra()
Maps for each field (as needed)
Teuchos::RCP< const IntVector > fieldVector_
Maps for each field (as needed)
Teuchos::RCP< Epetra_MultiVector > getGhostedDataVector(const std::string &fieldName, const std::map< std::string, ArrayT > &data) const
Teuchos::RCP< Epetra_IntVector > buildGhostedFieldReducedVectorEpetra(const UniqueGlobalIndexer< LocalOrdinalT, GlobalOrdinalT > &ugi)
void updateGhostedDataReducedVectorEpetra(const std::string &fieldName, const std::string blockId, const UniqueGlobalIndexer< LocalOrdinalT, GlobalOrdinalT > &ugi, const ArrayT &data, Epetra_MultiVector &dataVector)
std::map< int, Teuchos::RCP< const Map > > gh_reducedFieldMaps_
ghosted field vector
std::map< int, Teuchos::RCP< const Map > > gh_fieldMaps_
Maps for each field (as needed)
Teuchos::RCP< const Epetra_BlockMap > getFieldMapEpetra(int fieldNum, const Epetra_IntVector &fieldTVector)
Teuchos::RCP< const Epetra_IntVector > buildGhostedFieldVectorEpetra(const UniqueGlobalIndexer< LocalOrdinalT, GlobalOrdinalT > &ugi, const Teuchos::RCP< const Epetra_IntVector > &reducedVec=Teuchos::null)
Teuchos::RCP< const IntVector > gh_fieldVector_
ghosted reduced field vector
std::map< int, Teuchos::RCP< const Map > > fieldMaps_
(unghosted) field vector (as needed)
Teuchos::RCP< const UniqueGlobalIndexer< LocalOrdinalT, GlobalOrdinalT > > ugi_
DOF mapping.
Teuchos::RCP< const Epetra_Map > getFieldMap(const std::string &fieldName) const