Panzer Version of the Day
Loading...
Searching...
No Matches
Panzer_GlobalIndexer_Utilities.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Panzer: A partial differential equation assembly
4// engine for strongly coupled complex multiphysics systems
5//
6// Copyright 2011 NTESS and the Panzer contributors.
7// SPDX-License-Identifier: BSD-3-Clause
8// *****************************************************************************
9// @HEADER
10
11#ifndef __Panzer_GlobalIndexer_Utilities_decl_hpp__
12#define __Panzer_GlobalIndexer_Utilities_decl_hpp__
13
14#include <map>
15#include <string>
16
17#include <unordered_map>
18
19#include <Panzer_NodeType.hpp>
20#include <Tpetra_Vector.hpp>
21#include <Tpetra_MultiVector.hpp>
22
25
26namespace panzer {
27
31std::vector<Teuchos::RCP<const GlobalIndexer>>
32nc2c_vector(const std::vector<Teuchos::RCP<GlobalIndexer>> & ugis);
33
43int getFieldBlock(const std::string & fieldName,
44 const std::vector<Teuchos::RCP<GlobalIndexer>> & ugis);
45
55int getFieldBlock(const std::string & fieldName,
56 const std::vector<Teuchos::RCP<const GlobalIndexer>> & ugis);
57
71void computeBlockOffsets(const std::string & blockId,
72 const std::vector<Teuchos::RCP<GlobalIndexer>> & ugis,
73 std::vector<int> & blockOffsets);
74
88void computeBlockOffsets(const std::string & blockId,
89 const std::vector<Teuchos::RCP<const GlobalIndexer>> & ugis,
90 std::vector<int> & blockOffsets);
91
96std::string printUGILoadBalancingInformation(const GlobalIndexer & ugi);
97
102void printMeshTopology(std::ostream & os,const panzer::GlobalIndexer & ugi);
103
116Teuchos::RCP<Tpetra::Vector<int,int,panzer::GlobalOrdinal,panzer::TpetraNodeType> >
117buildGhostedFieldReducedVector(const GlobalIndexer & ugi);
118
129Teuchos::RCP<const Tpetra::Vector<int,int,panzer::GlobalOrdinal,panzer::TpetraNodeType> >
130buildGhostedFieldVector(const GlobalIndexer & ugi,
131 const Teuchos::RCP<const Tpetra::Vector<int,int,panzer::GlobalOrdinal,panzer::TpetraNodeType> > & reducedVec=Teuchos::null);
132
146void buildGhostedFieldVector(const GlobalIndexer & ugi,
147 std::vector<int> & fieldNumbers,
148 const Teuchos::RCP<const Tpetra::Vector<int,int,panzer::GlobalOrdinal,panzer::TpetraNodeType> > & reducedVec=Teuchos::null);
149
162template <typename ScalarT,typename ArrayT>
163void updateGhostedDataReducedVector(const std::string & fieldName,const std::string blockId,
164 const GlobalIndexer & ugi,
165 const ArrayT & data,
166 Tpetra::MultiVector<ScalarT,int,panzer::GlobalOrdinal,panzer::TpetraNodeType> & dataVector);
167
177Teuchos::RCP<const Tpetra::Map<int,panzer::GlobalOrdinal,panzer::TpetraNodeType> >
178getFieldMap(int fieldNum,const Tpetra::Vector<int,int,panzer::GlobalOrdinal,panzer::TpetraNodeType> & fieldVector);
179
180
181namespace orientation_helpers {
182
192void computePatternEdgeIndices(const FieldPattern & pattern,std::vector<std::pair<int,int> > & edgeIndices);
193
210void computeCellEdgeOrientations(const std::vector<std::pair<int,int> > & topEdgeIndices,
211 const std::vector<panzer::GlobalOrdinal> & topology,
212 const FieldPattern & fieldPattern,
213 std::vector<signed char> & orientation);
214
228void computePatternFaceIndices(const FieldPattern & pattern,std::vector<std::vector<int> > & faceIndices);
229
246void computeCellFaceOrientations(const std::vector<std::vector<int>> & topEdgeIndices,
247 const std::vector<panzer::GlobalOrdinal> & topology,
248 const FieldPattern & fieldPattern,
249 std::vector<signed char> & orientation);
250
251} // end orientations_helpers
252
253
257public:
261 ArrayToFieldVector(const Teuchos::RCP<const GlobalIndexer> & ugi);
262
272 template <typename ScalarT,typename ArrayT>
273 Teuchos::RCP<Tpetra::MultiVector<ScalarT,int,panzer::GlobalOrdinal,panzer::TpetraNodeType> >
274 getGhostedDataVector(const std::string & fieldName,const std::map<std::string,ArrayT> & data) const;
275
285 template <typename ScalarT,typename ArrayT>
286 Teuchos::RCP<Tpetra::MultiVector<ScalarT,int,panzer::GlobalOrdinal,panzer::TpetraNodeType> >
287 getDataVector(const std::string & fieldName,const std::map<std::string,ArrayT> & data) const;
288
293 Teuchos::RCP<const Tpetra::Map<int,panzer::GlobalOrdinal,panzer::TpetraNodeType> >
294 getFieldMap(const std::string & fieldName) const;
295
300 Teuchos::RCP<const Tpetra::Map<int,panzer::GlobalOrdinal,panzer::TpetraNodeType> >
301 getFieldMap(int fieldNum) const;
302
303protected:
304 using IntVector = Tpetra::Vector<int,int,panzer::GlobalOrdinal,panzer::TpetraNodeType>;
305 using Map = Tpetra::Map<int,panzer::GlobalOrdinal,panzer::TpetraNodeType>;
306
308 void buildFieldVector(const Tpetra::Vector<int,int,panzer::GlobalOrdinal,panzer::TpetraNodeType> & source) const;
309
311 Teuchos::RCP<const GlobalIndexer> ugi_;
312
313 Teuchos::RCP<const IntVector> gh_reducedFieldVector_;
314 Teuchos::RCP<const IntVector> gh_fieldVector_;
315
316 mutable std::map<int,Teuchos::RCP<const Map> > gh_reducedFieldMaps_;
317 mutable std::map<int,Teuchos::RCP<const Map> > gh_fieldMaps_;
318
319 mutable Teuchos::RCP<const IntVector> fieldVector_;
320 mutable std::map<int,Teuchos::RCP<const Map> > fieldMaps_;
321
322private:
323 // hide some constructors
326};
327
328
329} // end namspace panzer
330
332
333#endif
Teuchos::RCP< Tpetra::MultiVector< ScalarT, int, panzer::GlobalOrdinal, panzer::TpetraNodeType > > getGhostedDataVector(const std::string &fieldName, const std::map< std::string, ArrayT > &data) const
Teuchos::RCP< const GlobalIndexer > ugi_
DOF mapping.
ArrayToFieldVector(const ArrayToFieldVector &)
std::map< int, Teuchos::RCP< const Map > > fieldMaps_
(unghosted) field vector (as needed)
Teuchos::RCP< const IntVector > gh_reducedFieldVector_
std::map< int, Teuchos::RCP< const Map > > gh_fieldMaps_
Maps for each field (as needed)
Teuchos::RCP< const IntVector > gh_fieldVector_
ghosted reduced field vector
std::map< int, Teuchos::RCP< const Map > > gh_reducedFieldMaps_
ghosted field vector
Teuchos::RCP< const IntVector > fieldVector_
Maps for each field (as needed)
Tpetra::Map< int, panzer::GlobalOrdinal, panzer::TpetraNodeType > Map
Tpetra::Vector< int, int, panzer::GlobalOrdinal, panzer::TpetraNodeType > IntVector
Teuchos::RCP< Tpetra::MultiVector< ScalarT, int, panzer::GlobalOrdinal, panzer::TpetraNodeType > > getDataVector(const std::string &fieldName, const std::map< std::string, ArrayT > &data) const
ArrayToFieldVector()
Maps for each field (as needed)
void buildFieldVector(const Tpetra::Vector< int, int, panzer::GlobalOrdinal, panzer::TpetraNodeType > &source) const
build unghosted field vector from ghosted field vector
Teuchos::RCP< const Tpetra::Map< int, panzer::GlobalOrdinal, panzer::TpetraNodeType > > getFieldMap(const std::string &fieldName) const
void computeCellEdgeOrientations(const std::vector< std::pair< int, int > > &topEdgeIndices, const std::vector< panzer::GlobalOrdinal > &topology, const FieldPattern &fieldPattern, std::vector< signed char > &orientation)
void computePatternEdgeIndices(const FieldPattern &pattern, std::vector< std::pair< int, int > > &edgeIndices)
void computeCellFaceOrientations(const std::vector< std::vector< int > > &topFaceIndices, const std::vector< panzer::GlobalOrdinal > &topology, const FieldPattern &fieldPattern, std::vector< signed char > &orientation)
void computePatternFaceIndices(const FieldPattern &pattern, std::vector< std::vector< int > > &faceIndices)
Teuchos::RCP< const Tpetra::Map< int, panzer::GlobalOrdinal, panzer::TpetraNodeType > > getFieldMap(int fieldNum, const Tpetra::Vector< int, int, panzer::GlobalOrdinal, panzer::TpetraNodeType > &fieldTVector)
std::vector< Teuchos::RCP< const GlobalIndexer > > nc2c_vector(const std::vector< Teuchos::RCP< GlobalIndexer > > &ugis)
void printMeshTopology(std::ostream &os, const panzer::GlobalIndexer &ugi)
void computeBlockOffsets(const std::string &blockId, const std::vector< Teuchos::RCP< GlobalIndexer > > &ugis, std::vector< int > &blockOffsets)
void buildGhostedFieldVector(const GlobalIndexer &ugi, std::vector< int > &fieldNumbers, const Teuchos::RCP< const Tpetra::Vector< int, int, panzer::GlobalOrdinal, panzer::TpetraNodeType > > &reducedVec)
std::string printUGILoadBalancingInformation(const GlobalIndexer &ugi)
int getFieldBlock(const std::string &fieldName, const std::vector< Teuchos::RCP< const GlobalIndexer > > &ugis)
Teuchos::RCP< Tpetra::Vector< int, int, panzer::GlobalOrdinal, panzer::TpetraNodeType > > buildGhostedFieldReducedVector(const GlobalIndexer &ugi)
void updateGhostedDataReducedVector(const std::string &fieldName, const std::string blockId, const GlobalIndexer &ugi, const ArrayT &data, Tpetra::MultiVector< ScalarT, int, panzer::GlobalOrdinal, panzer::TpetraNodeType > &dataVector)