Epetra Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Epetra_FEVector.h
Go to the documentation of this file.
1 /*
2 //@HEADER
3 // ************************************************************************
4 //
5 // Epetra: Linear Algebra Services Package
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 Michael A. Heroux (maherou@sandia.gov)
39 //
40 // ************************************************************************
41 //@HEADER
42 */
43 
44 #ifndef EPETRA_FEVECTOR_H
45 #define EPETRA_FEVECTOR_H
46 
47 #if defined(Epetra_SHOW_DEPRECATED_WARNINGS)
48 #ifdef __GNUC__
49 #warning "The Epetra package is deprecated"
50 #endif
51 #endif
52 
53 
54 
55 #include <Epetra_ConfigDefs.h>
56 #include <Epetra_CombineMode.h>
57 #include <Epetra_Map.h>
58 #include <Epetra_MultiVector.h>
59 
60 #include <vector>
61 
63 
64 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
66 #endif
67 
69 
70 
86 class EPETRA_LIB_DLL_EXPORT Epetra_FEVector : public Epetra_MultiVector {
87  public:
103  Epetra_FEVector(const Epetra_BlockMap& Map,
104  int numVectors=1,
105  bool ignoreNonLocalEntries=false);
106 
108 
128  double *A, int MyLDA, int NumVectors,
129  bool ignoreNonLocalEntries=false);
130 
132 
148  double **ArrayOfPointers, int NumVectors,
149  bool ignoreNonLocalEntries=false);
150 
152  Epetra_FEVector(const Epetra_FEVector& source);
153 
155  virtual ~Epetra_FEVector();
156 
160 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
161  int SumIntoGlobalValues(int numIDs,
162  const int* GIDs, const double* values,
163  int vectorIndex=0);
164 #endif
165 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
166  int SumIntoGlobalValues(int numIDs,
167  const long long* GIDs, const double* values,
168  int vectorIndex=0);
169 #endif
170 
180  int SumIntoGlobalValues(const Epetra_IntSerialDenseVector& GIDs,
181  const Epetra_SerialDenseVector& values,
182  int vectorIndex=0);
183 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
184  int SumIntoGlobalValues(const Epetra_LongLongSerialDenseVector& GIDs,
185  const Epetra_SerialDenseVector& values,
186  int vectorIndex=0);
187 #endif
188 
192 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
193  int ReplaceGlobalValues(int numIDs, const int* GIDs, const double* values,
194  int vectorIndex=0);
195 #endif
196 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
197  int ReplaceGlobalValues(int numIDs, const long long* GIDs, const double* values,
198  int vectorIndex=0);
199 #endif
200 
210  int ReplaceGlobalValues(const Epetra_IntSerialDenseVector& GIDs,
211  const Epetra_SerialDenseVector& values,
212  int vectorIndex=0);
213 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
214  int ReplaceGlobalValues(const Epetra_LongLongSerialDenseVector& GIDs,
215  const Epetra_SerialDenseVector& values,
216  int vectorIndex=0);
217 #endif
218 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
219  int SumIntoGlobalValues(int numIDs,
220  const int* GIDs,
221  const int* numValuesPerID,
222  const double* values,
223  int vectorIndex=0);
224 #endif
225 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
226  int SumIntoGlobalValues(int numIDs,
227  const long long* GIDs,
228  const int* numValuesPerID,
229  const double* values,
230  int vectorIndex=0);
231 #endif
232 
233 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
234  int ReplaceGlobalValues(int numIDs, const int* GIDs,
235  const int* numValuesPerID,
236  const double* values,
237  int vectorIndex=0);
238 #endif
239 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
240  int ReplaceGlobalValues(int numIDs, const long long* GIDs,
241  const int* numValuesPerID,
242  const double* values,
243  int vectorIndex=0);
244 #endif
245 
263  int GlobalAssemble(Epetra_CombineMode mode = Add,
264  bool reuse_map_and_exporter = false);
265 
268  void setIgnoreNonLocalEntries(bool flag) {
269  ignoreNonLocalEntries_ = flag;
270  }
271 
272  Epetra_FEVector& operator=(const Epetra_FEVector& source);
273 
274  protected:
275  template<typename int_type>
276  int inputValues(int numIDs,
277  const int_type* GIDs, const double* values,
278  bool suminto,
279  int vectorIndex);
280 
281  template<typename int_type>
282  int inputValues(int numIDs,
283  const int_type* GIDs, const int* numValuesPerID,
284  const double* values,
285  bool suminto,
286  int vectorIndex);
287 
288  template<typename int_type>
289  int inputNonlocalValue(int_type GID, double value, bool suminto,
290  int vectorIndex);
291 
292  template<typename int_type>
293  int inputNonlocalValues(int_type GID, int numValues, const double* values,
294  bool suminto, int vectorIndex);
295 
297  template<typename int_type>
298  void createNonlocalMapAndExporter();
299 
301  void destroyNonlocalMapAndExporter();
302 
304  template<typename int_type>
305  void zeroNonlocalData();
306 
311  void destroyNonlocalData();
312 
313  long long myFirstID_;
315 
316 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
317  std::vector<int> nonlocalIDs_int_;
318 #endif
319 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
320  std::vector<long long> nonlocalIDs_LL_;
321 #endif
322 
323  template<typename int_type> std::vector<int_type>& nonlocalIDs();
324 
325  std::vector<int> nonlocalElementSize_;
326 
338  std::vector<std::vector<double> > nonlocalCoefs_;
339 
342 
345 
348 
350 
351 private:
352  template<typename int_type>
353  int GlobalAssemble(Epetra_CombineMode mode, bool reuse_map_and_exporter);
354 };
355 
356 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
357 template<> inline std::vector<int>& Epetra_FEVector::nonlocalIDs<int>()
358 {
359  return nonlocalIDs_int_;
360 }
361 #endif
362 
363 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
364 template<> inline std::vector<long long>& Epetra_FEVector::nonlocalIDs<long long>()
365 {
366  return nonlocalIDs_LL_;
367 }
368 #endif
369 
370 #endif
Epetra_MultiVector: A class for constructing and using dense multi-vectors, vectors and matrices in p...
std::vector< int > nonlocalIDs_int_
Epetra_IntSerialDenseVector: A class for constructing and using dense vectors.
std::vector< long long > nonlocalIDs_LL_
std::vector< std::vector< double > > nonlocalCoefs_
Array of arrays (one per column) of nonlocal coefficients.
Epetra_BlockMap * nonlocalMap_
Map describing distribution of nonlocal data.
Epetra_Export: This class builds an export object for efficient exporting of off-processor elements...
Definition: Epetra_Export.h:70
Epetra_Combine Mode enumerable type.
Epetra_SerialDenseVector: A class for constructing and using dense vectors.
Epetra_MultiVector & operator=(const Epetra_MultiVector &Source)
= Operator.
std::vector< int > nonlocalElementSize_
Epetra_BlockMap: A class for partitioning block element vectors and matrices.
Epetra_LongLongSerialDenseVector: A class for constructing and using dense vectors.
Epetra_MultiVector * nonlocalVector_
Multivector that holds nonlocal data; source for the Export operation.
void setIgnoreNonLocalEntries(bool flag)
Set whether or not non-local data values should be ignored.
Epetra Finite-Element Vector.
long long myFirstID_
Epetra_CombineMode
Epetra_DataAccess
Epetra_Export * exporter_
Export object that sums nonlocal data into a nonoverlapping distribution.