Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_Filtered_GlobalIndexer.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_Filtered_GlobalIndexer_hpp__
44 #define __Panzer_Filtered_GlobalIndexer_hpp__
45 
46 #include "Panzer_GlobalIndexer.hpp"
47 
48 namespace panzer {
49 
55 public:
56  // These functions are unique to this class (including constructors)
57 
60 
71  const std::vector<panzer::GlobalOrdinal> & filteredIndices);
72 
81  void getOwnedAndGhostedNotFilteredIndicator(std::vector<int> & indicator) const;
82 
87  void getFilteredOwnedAndGhostedIndices(std::vector<panzer::GlobalOrdinal> & indices) const ;
88 
89  // This functions are overriden, and the filtered indices removed
90 
100  virtual void getOwnedIndices(std::vector<panzer::GlobalOrdinal>& indices) const
101  {
102  indices = owned_;
103  }
104 
115  virtual void getGhostedIndices(std::vector<panzer::GlobalOrdinal>& indices) const
116  {
117  indices = ghosted_;
118  }
119 
129  virtual void
130  getOwnedAndGhostedIndices(std::vector<panzer::GlobalOrdinal>& indices) const
131  {
132  using std::size_t;
133  indices.resize(owned_.size() + ghosted_.size());
134  for (size_t i(0); i < owned_.size(); ++i)
135  indices[i] = owned_[i];
136  for (size_t i(0); i < ghosted_.size(); ++i)
137  indices[owned_.size() + i] = ghosted_[i];
138  }
139 
140  // For backwards compatibility with Epetra. Will be deprecated.
141  virtual void getElementGIDsAsInt(panzer::LocalOrdinal localElmtId,std::vector<int> & gids,const std::string & blockIdHint="") const
142  { base_->getElementGIDsAsInt(localElmtId,gids,blockIdHint); }
143 
144  // For backwards compatibility with Epetra. Will be deprecated.
145  virtual void getOwnedIndicesAsInt(std::vector<int>& indices) const
146  {
147  indices.resize(owned_.size());
148  for (std::size_t i=0; i < owned_.size(); ++i)
149  indices[i] = owned_[i];
150  }
151 
152  // For backwards compatibility with Epetra. Will be deprecated.
153  virtual void getGhostedIndicesAsInt(std::vector<int>& indices) const
154  {
155  indices.resize(ghosted_.size());
156  for (std::size_t i=0; i < ghosted_.size(); ++i)
157  indices[i] = ghosted_[i];
158  }
159 
160  // For backwards compatibility with Epetra. Will be deprecated.
161  virtual void
162  getOwnedAndGhostedIndicesAsInt(std::vector<int>& indices) const
163  {
164  indices.resize(owned_.size() + ghosted_.size());
165  for (std::size_t i=0; i < owned_.size(); ++i)
166  indices[i] = owned_[i];
167  for (std::size_t i=0; i < ghosted_.size(); ++i)
168  indices[owned_.size() + i] = ghosted_[i];
169  }
170 
171 
180  virtual int getNumOwned() const
181  { return owned_.size(); }
182 
192  virtual int getNumGhosted() const
193  { return ghosted_.size(); }
194 
203  virtual int getNumOwnedAndGhosted() const
204  { return owned_.size() + ghosted_.size(); }
205 
206  virtual void ownedIndices(const std::vector<panzer::GlobalOrdinal> & indices,std::vector<bool> & isOwned) const;
207 
208  // The following functions are simply part of the decorator pattern and
209  // are simple pass throughs
210 
212 
214  { return base_->getComm(); }
215 
216  virtual int getNumFields() const
217  { return base_->getNumFields(); }
218 
219  virtual const std::string & getFieldString(int fieldNum) const
220  { return base_->getFieldString(fieldNum); }
221 
222  virtual int getFieldNum(const std::string & str) const
223  { return base_->getFieldNum(str); }
224 
225  virtual void getFieldOrder(std::vector<std::string> & fieldOrder) const
226  { base_->getFieldOrder(fieldOrder); }
227 
228  virtual void getElementBlockIds(std::vector<std::string> & elementBlockIds) const
229  { base_->getElementBlockIds(elementBlockIds); }
230 
231  virtual bool fieldInBlock(const std::string & field, const std::string & block) const
232  { return base_->fieldInBlock(field,block); }
233 
234  virtual const std::vector<int> & getBlockFieldNumbers(const std::string & blockId) const
235  { return base_->getBlockFieldNumbers(blockId); }
236 
237  virtual const std::vector<int> & getGIDFieldOffsets(const std::string & blockId,int fieldNum) const
238  { return base_->getGIDFieldOffsets(blockId,fieldNum); }
239 
240  virtual const std::pair<std::vector<int>,std::vector<int> > &
241  getGIDFieldOffsets_closure(const std::string & blockId, int fieldNum,
242  int subcellDim,int subcellId) const
243  { return base_->getGIDFieldOffsets_closure(blockId,fieldNum,subcellDim,subcellId); }
244 
245  virtual void getElementOrientation(panzer::LocalOrdinal localElmtId,std::vector<double> & gidsOrientation) const
246  { base_->getElementOrientation(localElmtId,gidsOrientation); }
247 
248  virtual const std::vector<panzer::LocalOrdinal> & getElementBlock(const std::string & blockId) const
249  { return base_->getElementBlock(blockId); }
250 
251  virtual void getElementGIDs(panzer::LocalOrdinal localElmtId,std::vector<panzer::GlobalOrdinal> & gids,const std::string & blockIdHint="") const
252  { base_->getElementGIDs(localElmtId,gids,blockIdHint); }
253 
254  virtual int getElementBlockGIDCount(const std::string & blockId) const
255  { return base_->getElementBlockGIDCount(blockId); }
256 
257  virtual int getElementBlockGIDCount(const std::size_t & blockIndex) const
258  { return base_->getElementBlockGIDCount(blockIndex); }
259 
261  { return base_->getConnManager(); }
262 
263 private:
264 
266 
273  std::vector<panzer::GlobalOrdinal> owned_;
274 
282  std::vector<panzer::GlobalOrdinal> ghosted_;
283 };
284 
285 }
286 
287 #endif
void getOwnedAndGhostedNotFilteredIndicator(std::vector< int > &indicator) const
virtual void getElementGIDs(panzer::LocalOrdinal localElmtId, std::vector< panzer::GlobalOrdinal > &gids, const std::string &blockIdHint="") const
Get the global IDs for a particular element. This function overwrites the gids variable.
virtual void getOwnedIndices(std::vector< panzer::GlobalOrdinal > &indices) const
Get the set of indices owned by this processor.
virtual int getNumOwned() const
Get the number of indices owned by this processor.
virtual int getFieldNum(const std::string &str) const
Get the number used for access to this field.
virtual void getElementBlockIds(std::vector< std::string > &elementBlockIds) const
std::vector< panzer::GlobalOrdinal > ghosted_
The list of ghosted indices.
std::vector< panzer::GlobalOrdinal > owned_
The list of owned indices.
virtual void getOwnedIndicesAsInt(std::vector< int > &indices) const
Get the set of indices owned by this processor.
virtual void getOwnedAndGhostedIndicesAsInt(std::vector< int > &indices) const
Get the set of owned and ghosted indices for this processor.
void getFilteredOwnedAndGhostedIndices(std::vector< panzer::GlobalOrdinal > &indices) const
virtual void getElementOrientation(panzer::LocalOrdinal localElmtId, std::vector< double > &gidsOrientation) const
Get a vector containg the orientation of the GIDs relative to the neighbors.
virtual void ownedIndices(const std::vector< panzer::GlobalOrdinal > &indices, std::vector< bool > &isOwned) const
virtual const std::vector< panzer::LocalOrdinal > & getElementBlock(const std::string &blockId) const
virtual Teuchos::RCP< Teuchos::Comm< int > > getComm() const
virtual void getOwnedAndGhostedIndices(std::vector< panzer::GlobalOrdinal > &indices) const
Get the set of owned and ghosted indices for this processor.
virtual const std::string & getFieldString(int fieldNum) const
Reverse lookup of the field string from a field number.
virtual int getNumOwnedAndGhosted() const
Get the number of owned and ghosted indices for this processor.
virtual void getElementGIDsAsInt(panzer::LocalOrdinal localElmtId, std::vector< int > &gids, const std::string &blockIdHint="") const
Get the global IDs for a particular element. This function overwrites the gids variable.
virtual void getGhostedIndicesAsInt(std::vector< int > &indices) const
Get the set of indices ghosted for this processor.
virtual int getElementBlockGIDCount(const std::size_t &blockIndex) const
How any GIDs are associate with each element in a particular element block.
virtual Teuchos::RCP< const ConnManager > getConnManager() const
Returns the connection manager currently being used.
PHX::MDField< ScalarT, panzer::Cell, panzer::BASIS > field
A field to which we&#39;ll contribute, or in which we&#39;ll store, the result of computing this integral...
virtual const std::pair< std::vector< int >, std::vector< int > > & getGIDFieldOffsets_closure(const std::string &blockId, int fieldNum, int subcellDim, int subcellId) const
Use the field pattern so that you can find a particular field in the GIDs array. This version lets yo...
virtual const std::vector< int > & getBlockFieldNumbers(const std::string &blockId) const
virtual const std::vector< int > & getGIDFieldOffsets(const std::string &blockId, int fieldNum) const
Use the field pattern so that you can find a particular field in the GIDs array.
virtual int getElementBlockGIDCount(const std::string &blockId) const
How many GIDs are associated with each element in a particular element block.
virtual bool fieldInBlock(const std::string &field, const std::string &block) const
Teuchos::RCP< const GlobalIndexer > base_
virtual int getNumGhosted() const
Get the number of indices ghosted for this processor.
void initialize(const Teuchos::RCP< const GlobalIndexer > &ugi, const std::vector< panzer::GlobalOrdinal > &filteredIndices)
virtual void getFieldOrder(std::vector< std::string > &fieldOrder) const
virtual void getGhostedIndices(std::vector< panzer::GlobalOrdinal > &indices) const
Get the set of indices ghosted for this processor.