Panzer Version of the Day
Loading...
Searching...
No Matches
Panzer_STKConnManager.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_STKConnManager_hpp__
44#define __Panzer_STKConnManager_hpp__
45
46#include <vector>
47
48// Teuchos includes
49#include "Teuchos_RCP.hpp"
50
51// Kokkos includes
52#include "Kokkos_DynRankView.hpp"
53
54// Panzer includes
56
59
60namespace panzer_stk {
61
63public:
66 typedef typename Kokkos::DynRankView<GlobalOrdinal,PHX::Device>::HostMirror GlobalOrdinalView;
67 typedef typename Kokkos::DynRankView<LocalOrdinal, PHX::Device>::HostMirror LocalOrdinalView;
68
69 STKConnManager(const Teuchos::RCP<const STK_Interface> & stkMeshDB);
70
71 virtual ~STKConnManager() {}
72
78 virtual void buildConnectivity(const panzer::FieldPattern & fp);
79
84 virtual Teuchos::RCP<panzer::ConnManager> noConnectivityClone() const;
85
93 virtual const panzer::GlobalOrdinal * getConnectivity(LocalOrdinal localElmtId) const
94 { return &connectivity_[elmtLidToConn_[localElmtId]]; }
95
103 virtual panzer::GlobalOrdinal * getConnectivity(LocalOrdinal localElmtId)
104 { return &connectivity_[elmtLidToConn_[localElmtId]]; }
105
113 { return connSize_[localElmtId]; }
114
116 { return GlobalOrdinalView(connectivity_.data(), connectivity_.size()); }
117
119 { return LocalOrdinalView(connSize_.data(), connSize_.size()); }
120
122 { return LocalOrdinalView(elmtLidToConn_.data(), elmtLidToConn_.size()); }
123
128 virtual std::string getBlockId(LocalOrdinal localElmtId) const;
129
132 virtual std::size_t numElementBlocks() const
133 { return stkMeshDB_->getNumElementBlocks(); }
134
137 virtual void getElementBlockIds(std::vector<std::string> & elementBlockIds) const
138 { return stkMeshDB_->getElementBlockNames(elementBlockIds); }
141 virtual void getElementBlockTopologies(std::vector<shards::CellTopology> & elementBlockTopologies) const{
142 std::vector<std::string> elementBlockIds;
143 getElementBlockIds(elementBlockIds);
144 elementBlockTopologies.reserve(elementBlockIds.size());
145 for (unsigned i=0; i<elementBlockIds.size(); ++i) {
146 elementBlockTopologies.push_back(*(stkMeshDB_->getCellTopology(elementBlockIds[i])));
147 }
148 }
156 virtual const std::vector<LocalOrdinal> & getElementBlock(const std::string & blockId) const
157 { return *(elementBlocks_.find(blockId)->second); }
158
167 virtual const std::vector<LocalOrdinal> & getNeighborElementBlock(const std::string & blockId) const
168 { return *(neighborElementBlocks_.find(blockId)->second); }
169
178 virtual void getDofCoords(const std::string & blockId,
179 const panzer::Intrepid2FieldPattern & coordProvider,
180 std::vector<std::size_t> & localCellIds,
181 Kokkos::DynRankView<double,PHX::Device> & points) const;
182
185 Teuchos::RCP<const STK_Interface> getSTKInterface() const
186 { return stkMeshDB_; }
187
195 std::size_t getOwnedElementCount() const
196 { return ownedElementCount_; }
197
201 void associateElementsInSideset(const std::string sideset_id);
202
208 std::vector<std::string> checkAssociateElementsInSidesets(const Teuchos::Comm<int>& comm) const;
209
213 virtual const std::vector<LocalOrdinal>& getAssociatedNeighbors(const LocalOrdinal& el) const;
214
218 virtual bool hasAssociatedNeighbors() const;
219
220protected:
226 void applyPeriodicBCs( const panzer::FieldPattern & fp, GlobalOrdinal nodeOffset, GlobalOrdinal edgeOffset,
227 GlobalOrdinal faceOffset, GlobalOrdinal cellOffset);
229
233 LocalOrdinal & nodeIdCnt, LocalOrdinal & edgeIdCnt,
234 LocalOrdinal & faceIdCnt, LocalOrdinal & cellIdCnt,
235 GlobalOrdinal & nodeOffset, GlobalOrdinal & edgeOffset,
236 GlobalOrdinal & faceOffset, GlobalOrdinal & cellOffset) const;
237
238 LocalOrdinal addSubcellConnectivities(stk::mesh::Entity element,unsigned subcellRank,
239 LocalOrdinal idCnt,GlobalOrdinal offset);
240
241 void modifySubcellConnectivities(const panzer::FieldPattern & fp, stk::mesh::Entity element,
242 unsigned subcellRank,unsigned subcellId,GlobalOrdinal newId,GlobalOrdinal offset);
243
244 Teuchos::RCP<const STK_Interface> stkMeshDB_;
245
246 Teuchos::RCP<std::vector<stk::mesh::Entity> > elements_;
247
248 // element block information
249 std::map<std::string,Teuchos::RCP<std::vector<LocalOrdinal> > > elementBlocks_;
250 std::map<std::string,Teuchos::RCP<std::vector<LocalOrdinal> > > neighborElementBlocks_;
251 std::map<std::string,GlobalOrdinal> blockIdToIndex_;
252
253 std::vector<LocalOrdinal> elmtLidToConn_; // element LID to Connectivity map
254 std::vector<LocalOrdinal> connSize_; // element LID to Connectivity map
255 std::vector<GlobalOrdinal> connectivity_; // Connectivity
256
258
259 std::vector<std::string> sidesetsToAssociate_;
261 std::vector<std::vector<LocalOrdinal> > elmtToAssociatedElmts_;
262};
263
264}
265
266#endif
Pure virtual base class for supplying mesh connectivity information to the DOF Manager.
panzer::GlobalOrdinal GlobalOrdinal
std::vector< std::string > checkAssociateElementsInSidesets(const Teuchos::Comm< int > &comm) const
void applyPeriodicBCs(const panzer::FieldPattern &fp, GlobalOrdinal nodeOffset, GlobalOrdinal edgeOffset, GlobalOrdinal faceOffset, GlobalOrdinal cellOffset)
Teuchos::RCP< std::vector< stk::mesh::Entity > > elements_
const LocalOrdinalView getElementLidToConnView()
virtual Teuchos::RCP< panzer::ConnManager > noConnectivityClone() const
virtual const panzer::GlobalOrdinal * getConnectivity(LocalOrdinal localElmtId) const
std::map< std::string, Teuchos::RCP< std::vector< LocalOrdinal > > > neighborElementBlocks_
panzer::ConnManager::LocalOrdinal LocalOrdinal
virtual void getDofCoords(const std::string &blockId, const panzer::Intrepid2FieldPattern &coordProvider, std::vector< std::size_t > &localCellIds, Kokkos::DynRankView< double, PHX::Device > &points) const
std::vector< std::vector< LocalOrdinal > > elmtToAssociatedElmts_
std::vector< LocalOrdinal > connSize_
void buildOffsetsAndIdCounts(const panzer::FieldPattern &fp, LocalOrdinal &nodeIdCnt, LocalOrdinal &edgeIdCnt, LocalOrdinal &faceIdCnt, LocalOrdinal &cellIdCnt, GlobalOrdinal &nodeOffset, GlobalOrdinal &edgeOffset, GlobalOrdinal &faceOffset, GlobalOrdinal &cellOffset) const
panzer::ConnManager::GlobalOrdinal GlobalOrdinal
virtual panzer::GlobalOrdinal * getConnectivity(LocalOrdinal localElmtId)
virtual void buildConnectivity(const panzer::FieldPattern &fp)
std::vector< bool > sidesetYieldedAssociations_
const LocalOrdinalView getConnectivitySizeView()
Kokkos::DynRankView< GlobalOrdinal, PHX::Device >::HostMirror GlobalOrdinalView
virtual bool hasAssociatedNeighbors() const
virtual void getElementBlockIds(std::vector< std::string > &elementBlockIds) const
virtual LocalOrdinal getConnectivitySize(LocalOrdinal localElmtId) const
std::vector< std::string > sidesetsToAssociate_
virtual void getElementBlockTopologies(std::vector< shards::CellTopology > &elementBlockTopologies) const
virtual const std::vector< LocalOrdinal > & getAssociatedNeighbors(const LocalOrdinal &el) const
std::map< std::string, Teuchos::RCP< std::vector< LocalOrdinal > > > elementBlocks_
std::size_t getOwnedElementCount() const
virtual const std::vector< LocalOrdinal > & getNeighborElementBlock(const std::string &blockId) const
Teuchos::RCP< const STK_Interface > getSTKInterface() const
Kokkos::DynRankView< LocalOrdinal, PHX::Device >::HostMirror LocalOrdinalView
std::map< std::string, GlobalOrdinal > blockIdToIndex_
virtual const std::vector< LocalOrdinal > & getElementBlock(const std::string &blockId) const
Teuchos::RCP< const STK_Interface > stkMeshDB_
virtual std::string getBlockId(LocalOrdinal localElmtId) const
std::vector< LocalOrdinal > elmtLidToConn_
void associateElementsInSideset(const std::string sideset_id)
void modifySubcellConnectivities(const panzer::FieldPattern &fp, stk::mesh::Entity element, unsigned subcellRank, unsigned subcellId, GlobalOrdinal newId, GlobalOrdinal offset)
std::vector< GlobalOrdinal > connectivity_
virtual std::size_t numElementBlocks() const
LocalOrdinal addSubcellConnectivities(stk::mesh::Entity element, unsigned subcellRank, LocalOrdinal idCnt, GlobalOrdinal offset)
const GlobalOrdinalView getConnectivityView()