Panzer Version of the Day
Loading...
Searching...
No Matches
Panzer_GlobalIndexer_Utilities.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_GlobalIndexer_Utilities_decl_hpp__
44#define __Panzer_GlobalIndexer_Utilities_decl_hpp__
45
46#include <map>
47#include <string>
48
49#include <unordered_map>
50
51#include <Panzer_NodeType.hpp>
52#include <Tpetra_Vector.hpp>
53#include <Tpetra_MultiVector.hpp>
54
57
58namespace panzer {
59
63std::vector<Teuchos::RCP<const GlobalIndexer>>
64nc2c_vector(const std::vector<Teuchos::RCP<GlobalIndexer>> & ugis);
65
75int getFieldBlock(const std::string & fieldName,
76 const std::vector<Teuchos::RCP<GlobalIndexer>> & ugis);
77
87int getFieldBlock(const std::string & fieldName,
88 const std::vector<Teuchos::RCP<const GlobalIndexer>> & ugis);
89
103void computeBlockOffsets(const std::string & blockId,
104 const std::vector<Teuchos::RCP<GlobalIndexer>> & ugis,
105 std::vector<int> & blockOffsets);
106
120void computeBlockOffsets(const std::string & blockId,
121 const std::vector<Teuchos::RCP<const GlobalIndexer>> & ugis,
122 std::vector<int> & blockOffsets);
123
128std::string printUGILoadBalancingInformation(const GlobalIndexer & ugi);
129
134void printMeshTopology(std::ostream & os,const panzer::GlobalIndexer & ugi);
135
148Teuchos::RCP<Tpetra::Vector<int,int,panzer::GlobalOrdinal,panzer::TpetraNodeType> >
149buildGhostedFieldReducedVector(const GlobalIndexer & ugi);
150
161Teuchos::RCP<const Tpetra::Vector<int,int,panzer::GlobalOrdinal,panzer::TpetraNodeType> >
162buildGhostedFieldVector(const GlobalIndexer & ugi,
163 const Teuchos::RCP<const Tpetra::Vector<int,int,panzer::GlobalOrdinal,panzer::TpetraNodeType> > & reducedVec=Teuchos::null);
164
178void buildGhostedFieldVector(const GlobalIndexer & ugi,
179 std::vector<int> & fieldNumbers,
180 const Teuchos::RCP<const Tpetra::Vector<int,int,panzer::GlobalOrdinal,panzer::TpetraNodeType> > & reducedVec=Teuchos::null);
181
194template <typename ScalarT,typename ArrayT>
195void updateGhostedDataReducedVector(const std::string & fieldName,const std::string blockId,
196 const GlobalIndexer & ugi,
197 const ArrayT & data,
198 Tpetra::MultiVector<ScalarT,int,panzer::GlobalOrdinal,panzer::TpetraNodeType> & dataVector);
199
209Teuchos::RCP<const Tpetra::Map<int,panzer::GlobalOrdinal,panzer::TpetraNodeType> >
210getFieldMap(int fieldNum,const Tpetra::Vector<int,int,panzer::GlobalOrdinal,panzer::TpetraNodeType> & fieldVector);
211
212
213namespace orientation_helpers {
214
224void computePatternEdgeIndices(const FieldPattern & pattern,std::vector<std::pair<int,int> > & edgeIndices);
225
242void computeCellEdgeOrientations(const std::vector<std::pair<int,int> > & topEdgeIndices,
243 const std::vector<panzer::GlobalOrdinal> & topology,
244 const FieldPattern & fieldPattern,
245 std::vector<signed char> & orientation);
246
260void computePatternFaceIndices(const FieldPattern & pattern,std::vector<std::vector<int> > & faceIndices);
261
278void computeCellFaceOrientations(const std::vector<std::vector<int>> & topEdgeIndices,
279 const std::vector<panzer::GlobalOrdinal> & topology,
280 const FieldPattern & fieldPattern,
281 std::vector<signed char> & orientation);
282
283} // end orientations_helpers
284
285
289public:
293 ArrayToFieldVector(const Teuchos::RCP<const GlobalIndexer> & ugi);
294
304 template <typename ScalarT,typename ArrayT>
305 Teuchos::RCP<Tpetra::MultiVector<ScalarT,int,panzer::GlobalOrdinal,panzer::TpetraNodeType> >
306 getGhostedDataVector(const std::string & fieldName,const std::map<std::string,ArrayT> & data) const;
307
317 template <typename ScalarT,typename ArrayT>
318 Teuchos::RCP<Tpetra::MultiVector<ScalarT,int,panzer::GlobalOrdinal,panzer::TpetraNodeType> >
319 getDataVector(const std::string & fieldName,const std::map<std::string,ArrayT> & data) const;
320
325 Teuchos::RCP<const Tpetra::Map<int,panzer::GlobalOrdinal,panzer::TpetraNodeType> >
326 getFieldMap(const std::string & fieldName) const;
327
332 Teuchos::RCP<const Tpetra::Map<int,panzer::GlobalOrdinal,panzer::TpetraNodeType> >
333 getFieldMap(int fieldNum) const;
334
335protected:
336 using IntVector = Tpetra::Vector<int,int,panzer::GlobalOrdinal,panzer::TpetraNodeType>;
337 using Map = Tpetra::Map<int,panzer::GlobalOrdinal,panzer::TpetraNodeType>;
338
340 void buildFieldVector(const Tpetra::Vector<int,int,panzer::GlobalOrdinal,panzer::TpetraNodeType> & source) const;
341
343 Teuchos::RCP<const GlobalIndexer> ugi_;
344
345 Teuchos::RCP<const IntVector> gh_reducedFieldVector_;
346 Teuchos::RCP<const IntVector> gh_fieldVector_;
347
348 mutable std::map<int,Teuchos::RCP<const Map> > gh_reducedFieldMaps_;
349 mutable std::map<int,Teuchos::RCP<const Map> > gh_fieldMaps_;
350
351 mutable Teuchos::RCP<const IntVector> fieldVector_;
352 mutable std::map<int,Teuchos::RCP<const Map> > fieldMaps_;
353
354private:
355 // hide some constructors
358};
359
360
361} // end namspace panzer
362
364
365#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)