Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_EpetraVector_ReadOnly_GlobalEvaluationData.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_EpetraVector_ReadOnly_GlobalEvaluationData_hpp__
44 #define __Panzer_EpetraVector_ReadOnly_GlobalEvaluationData_hpp__
45 
47 //
48 // Include Files
49 //
51 
52 // Epetra
53 #include "Epetra_Import.h"
54 #include "Epetra_Map.h"
55 #include "Epetra_Vector.h"
56 
57 // Panzer
59 
60 // Teuchos
61 #include "Teuchos_RCP.hpp"
62 
64 //
65 // Forward Declarations
66 //
68 
69 namespace panzer
70 {
79  :
81  {
82  public:
83 
88  :
89  isInitialized_(false)
90  {
91  } // end of Default Constructor
92 
100  :
101  isInitialized_(false)
102  {
103  initialize(src.importer_, src.ghostedMap_, src.ownedMap_);
104  } // end of Copy Constructor
105 
118  const Teuchos::RCP<const Epetra_Import>& importer,
119  const Teuchos::RCP<const Epetra_Map>& ghostedMap,
120  const Teuchos::RCP<const Epetra_Map>& ownedMap)
121  :
122  isInitialized_(false)
123  {
124  initialize(importer, ghostedMap, ownedMap);
125  } // end of Initializing Constructor
126 
140  void
142  const std::vector<int>& indices,
143  double value);
144 
156  void
157  initialize(
158  const Teuchos::RCP<const Epetra_Import>& importer,
159  const Teuchos::RCP<const Epetra_Map>& ghostedMap,
160  const Teuchos::RCP<const Epetra_Map>& ownedMap);
161 
170  virtual void
172  int mem = 0);
173 
177  virtual void
178  initializeData();
179 
188  virtual void
190  int mem = 0);
191 
199  virtual bool
201  {
202  return false;
203  } // end of requiresDirichletAdjustment()
204 
211  void
213  const Teuchos::RCP<const Epetra_Vector>& ownedVector);
214 
221  getGhostedVector_Epetra() const;
222 
229  void
231  const Teuchos::RCP<const Thyra::VectorBase<double>>& ownedVector);
232 
239  getOwnedVector() const;
240 
247  getGhostedVector() const;
248 
254  bool
256  {
257  return isInitialized_;
258  } // end of isInitialized()
259 
268  void
269  print(
270  std::ostream& os) const;
271 
272  private:
273 
279 
284 
289 
294 
299 
305 
310 
315 
320  typedef std::pair<std::vector<int>, double> FilteredPair;
321 
326  std::vector<FilteredPair> filteredPairs_;
327 
328  }; // end of class EpetraVector_ReadOnly_GlobalEvaluationData
329 
330 } // end of namespace panzer
331 
332 #endif // __Panzer_EpetraVector_ReadOnly_GlobalEvaluationData_hpp__
virtual void globalToGhost(int mem=0)
Communicate the owned data to the ghosted vector.
EpetraVector_ReadOnly_GlobalEvaluationData(const EpetraVector_ReadOnly_GlobalEvaluationData &src)
Copy Constructor.
Teuchos::RCP< const Epetra_Import > importer_
The importer used to communicate between the owned and ghosted vectors.
void setOwnedVector_Epetra(const Teuchos::RCP< const Epetra_Vector > &ownedVector)
Set the owned vector (Epetra version).
void useConstantValues(const std::vector< int > &indices, double value)
Choose a few GIDs and, instead of zeroing them out in the ghosted vector, set them to a specified val...
Teuchos::RCP< Epetra_Vector > getGhostedVector_Epetra() const
Get the ghosted vector (Epetra version).
This class provides a boundary exchange communication mechanism for vectors.
virtual void ghostToGlobal(int mem=0)
Communicate the ghosted data to the owned vector.
Teuchos::RCP< const Thyra::VectorBase< double > > ownedVector_
The owned vector.
void setOwnedVector(const Teuchos::RCP< const Thyra::VectorBase< double >> &ownedVector)
Set the owned vector (Thyra version).
std::vector< FilteredPair > filteredPairs_
The list of filtered pairs, used to initialize values on the ghostedVector_.
Teuchos::RCP< const Thyra::VectorSpaceBase< double > > ownedSpace_
The vector space corresponding to the owned vector.
Teuchos::RCP< const Thyra::VectorSpaceBase< double > > ghostedSpace_
The vector space corresponding to the ghosted vector.
std::pair< std::vector< int >, double > FilteredPair
A list of global IDs (which will be translated to local IDs), paired with a value to be assigned in t...
Teuchos::RCP< Thyra::VectorBase< double > > getGhostedVector() const
Get the ghosted vector (Thyra version).
Teuchos::RCP< const Epetra_Map > ownedMap_
The map corresponding to the owned vector.
bool isInitialized_
A flag indicating whether or not the object has been initialized.
virtual bool requiresDirichletAdjustment() const
Determine if a Dirichlet adjustment is necessary.
Teuchos::RCP< const Thyra::VectorBase< double > > getOwnedVector() const
Get the owned vector (Thyra version).
Teuchos::RCP< const Epetra_Map > ghostedMap_
The map corresponding to the ghosted vector.
EpetraVector_ReadOnly_GlobalEvaluationData(const Teuchos::RCP< const Epetra_Import > &importer, const Teuchos::RCP< const Epetra_Map > &ghostedMap, const Teuchos::RCP< const Epetra_Map > &ownedMap)
Initializing Constructor.
void initialize(const Teuchos::RCP< const Epetra_Import > &importer, const Teuchos::RCP< const Epetra_Map > &ghostedMap, const Teuchos::RCP< const Epetra_Map > &ownedMap)
Initialize this object with some Epetra communication objects.