Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_Filtered_UniqueGlobalIndexer.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_UniqueGlobalIndexer_hpp__
44 #define __Panzer_Filtered_UniqueGlobalIndexer_hpp__
45 
47 
48 namespace panzer {
49 
52 template <typename LocalOrdinalT,typename GlobalOrdinalT>
53 class Filtered_UniqueGlobalIndexer : public UniqueGlobalIndexer<LocalOrdinalT,GlobalOrdinalT> {
54 public:
55  // These functions are unique to this class (including constructors)
56 
60 
71  const std::vector<GlobalOrdinalT> & filteredIndices);
72 
81  void getOwnedAndGhostedNotFilteredIndicator(std::vector<int> & indicator) const;
82 
87  void getFilteredOwnedAndGhostedIndices(std::vector<GlobalOrdinalT> & indices) const ;
88 
89  // This functions are overriden, and the filtered indices removed
90 
100  virtual void
102  std::vector<GlobalOrdinalT>& indices) const
103  {
104  indices = owned_;
105  } // end of getOwnedIndices()
106 
117  virtual void
119  std::vector<GlobalOrdinalT>& indices) const
120  {
121  indices = ghosted_;
122  } // end of getGhostedIndices()
123 
133  virtual void
135  std::vector<GlobalOrdinalT>& indices) const
136  {
137  using std::size_t;
138  indices.resize(owned_.size() + ghosted_.size());
139  for (size_t i(0); i < owned_.size(); ++i)
140  indices[i] = owned_[i];
141  for (size_t i(0); i < ghosted_.size(); ++i)
142  indices[owned_.size() + i] = ghosted_[i];
143  } // end of getOwnedAndGhostedIndices()
144 
153  virtual int
154  getNumOwned() const
155  {
156  return owned_.size();
157  } // end of getNumOwned()
158 
168  virtual int
170  {
171  return ghosted_.size();
172  } // end of getNumGhosted()
173 
182  virtual int
184  {
185  return owned_.size() + ghosted_.size();
186  } // end of getNumOwnedAndGhosted()
187 
188  virtual void ownedIndices(const std::vector<GlobalOrdinalT> & indices,std::vector<bool> & isOwned) const;
189 
190  // The following functions are simply part of the decorator pattern and
191  // are simple pass throughs
192 
194 
196  { return base_->getComm(); }
197 
198  virtual int getNumFields() const
199  { return base_->getNumFields(); }
200 
201  virtual const std::string & getFieldString(int fieldNum) const
202  { return base_->getFieldString(fieldNum); }
203 
204  virtual int getFieldNum(const std::string & str) const
205  { return base_->getFieldNum(str); }
206 
207  virtual void getFieldOrder(std::vector<std::string> & fieldOrder) const
208  { base_->getFieldOrder(fieldOrder); }
209 
210  virtual void getElementBlockIds(std::vector<std::string> & elementBlockIds) const
211  { base_->getElementBlockIds(elementBlockIds); }
212 
213  virtual bool fieldInBlock(const std::string & field, const std::string & block) const
214  { return base_->fieldInBlock(field,block); }
215 
216  virtual const std::vector<int> & getBlockFieldNumbers(const std::string & blockId) const
217  { return base_->getBlockFieldNumbers(blockId); }
218 
219  virtual const std::vector<int> & getGIDFieldOffsets(const std::string & blockId,int fieldNum) const
220  { return base_->getGIDFieldOffsets(blockId,fieldNum); }
221 
222  virtual const std::pair<std::vector<int>,std::vector<int> > &
223  getGIDFieldOffsets_closure(const std::string & blockId, int fieldNum,
224  int subcellDim,int subcellId) const
225  { return base_->getGIDFieldOffsets_closure(blockId,fieldNum,subcellDim,subcellId); }
226 
227  virtual void getElementOrientation(LocalOrdinalT localElmtId,std::vector<double> & gidsOrientation) const
228  { base_->getElementOrientation(localElmtId,gidsOrientation); }
229 
230  virtual const std::vector<LocalOrdinalT> & getElementBlock(const std::string & blockId) const
231  { return base_->getElementBlock(blockId); }
232 
233  virtual void getElementGIDs(LocalOrdinalT localElmtId,std::vector<GlobalOrdinalT> & gids,const std::string & blockIdHint="") const
234  { base_->getElementGIDs(localElmtId,gids,blockIdHint); }
235 
236  virtual int getElementBlockGIDCount(const std::string & blockId) const
237  { return base_->getElementBlockGIDCount(blockId); }
238 
239  virtual int getElementBlockGIDCount(const std::size_t & blockIndex) const
240  { return base_->getElementBlockGIDCount(blockIndex); }
241 
243  { return base_->getConnManagerBase(); }
244 
245 private:
246 
248 
255  std::vector<GlobalOrdinalT> owned_;
256 
264  std::vector<GlobalOrdinalT> ghosted_;
265 };
266 
267 }
268 
269 #endif
virtual void getOwnedIndices(std::vector< GlobalOrdinalT > &indices) const
Get the set of indices owned by this processor.
void getFilteredOwnedAndGhostedIndices(std::vector< GlobalOrdinalT > &indices) const
void initialize(const Teuchos::RCP< const UniqueGlobalIndexer< LocalOrdinalT, GlobalOrdinalT > > &ugi, const std::vector< GlobalOrdinalT > &filteredIndices)
virtual const std::vector< LocalOrdinalT > & getElementBlock(const std::string &blockId) const
virtual int getElementBlockGIDCount(const std::size_t &blockIndex) const
How any GIDs are associate with a particular element block.
virtual int getNumOwned() const
Get the number of indices owned by this processor.
Teuchos::RCP< const UniqueGlobalIndexer< LocalOrdinalT, GlobalOrdinalT > > base_
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 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 void getElementBlockIds(std::vector< std::string > &elementBlockIds) const
void getOwnedAndGhostedNotFilteredIndicator(std::vector< int > &indicator) const
virtual int getNumGhosted() const
Get the number of indices ghosted for this processor.
virtual Teuchos::RCP< Teuchos::Comm< int > > getComm() const
virtual int getElementBlockGIDCount(const std::string &blockId) const
How many GIDs are associate with a particular element block.
virtual bool fieldInBlock(const std::string &field, const std::string &block) const
virtual void getGhostedIndices(std::vector< GlobalOrdinalT > &indices) const
Get the set of indices ghosted for this processor.
virtual const std::vector< int > & getBlockFieldNumbers(const std::string &blockId) const
virtual int getNumOwnedAndGhosted() const
Get the number 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 getFieldNum(const std::string &str) const
Get the number used for access to this field.
std::vector< GlobalOrdinalT > ghosted_
The list of ghosted indices.
virtual void ownedIndices(const std::vector< GlobalOrdinalT > &indices, std::vector< bool > &isOwned) const
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 void getFieldOrder(std::vector< std::string > &fieldOrder) const
virtual Teuchos::RCP< const ConnManagerBase< LocalOrdinalT > > getConnManagerBase() const
Returns the connection manager currently being used.
std::vector< GlobalOrdinalT > owned_
The list of owned indices.
virtual void getElementGIDs(LocalOrdinalT localElmtId, std::vector< GlobalOrdinalT > &gids, const std::string &blockIdHint="") const
Get the global IDs for a particular element. This function overwrites the gids variable.
virtual void getOwnedAndGhostedIndices(std::vector< GlobalOrdinalT > &indices) const
Get the set of owned and ghosted indices for this processor.
virtual void getElementOrientation(LocalOrdinalT localElmtId, std::vector< double > &gidsOrientation) const
Get a vector containg the orientation of the GIDs relative to the neighbors.