Epetra Package Browser (Single Doxygen Collection) Development
Loading...
Searching...
No Matches
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#include <Epetra_ConfigDefs.h>
48#include <Epetra_CombineMode.h>
49#include <Epetra_Map.h>
50#include <Epetra_MultiVector.h>
51
52#include <vector>
53
55
56#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
58#endif
59
61
62
78class EPETRA_LIB_DLL_EXPORT Epetra_FEVector : public Epetra_MultiVector {
79 public:
96 int numVectors=1,
97 bool ignoreNonLocalEntries=false);
98
100
120 double *A, int MyLDA, int NumVectors,
121 bool ignoreNonLocalEntries=false);
122
124
140 double **ArrayOfPointers, int NumVectors,
141 bool ignoreNonLocalEntries=false);
142
144 Epetra_FEVector(const Epetra_FEVector& source);
145
147 virtual ~Epetra_FEVector();
148
152#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
153 int SumIntoGlobalValues(int numIDs,
154 const int* GIDs, const double* values,
155 int vectorIndex=0);
156#endif
157#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
158 int SumIntoGlobalValues(int numIDs,
159 const long long* GIDs, const double* values,
160 int vectorIndex=0);
161#endif
162
172 int SumIntoGlobalValues(const Epetra_IntSerialDenseVector& GIDs,
173 const Epetra_SerialDenseVector& values,
174 int vectorIndex=0);
175#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
176 int SumIntoGlobalValues(const Epetra_LongLongSerialDenseVector& GIDs,
177 const Epetra_SerialDenseVector& values,
178 int vectorIndex=0);
179#endif
180
184#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
185 int ReplaceGlobalValues(int numIDs, const int* GIDs, const double* values,
186 int vectorIndex=0);
187#endif
188#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
189 int ReplaceGlobalValues(int numIDs, const long long* GIDs, const double* values,
190 int vectorIndex=0);
191#endif
192
202 int ReplaceGlobalValues(const Epetra_IntSerialDenseVector& GIDs,
203 const Epetra_SerialDenseVector& values,
204 int vectorIndex=0);
205#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
206 int ReplaceGlobalValues(const Epetra_LongLongSerialDenseVector& GIDs,
207 const Epetra_SerialDenseVector& values,
208 int vectorIndex=0);
209#endif
210#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
211 int SumIntoGlobalValues(int numIDs,
212 const int* GIDs,
213 const int* numValuesPerID,
214 const double* values,
215 int vectorIndex=0);
216#endif
217#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
218 int SumIntoGlobalValues(int numIDs,
219 const long long* GIDs,
220 const int* numValuesPerID,
221 const double* values,
222 int vectorIndex=0);
223#endif
224
225#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
226 int ReplaceGlobalValues(int numIDs, const int* GIDs,
227 const int* numValuesPerID,
228 const double* values,
229 int vectorIndex=0);
230#endif
231#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
232 int ReplaceGlobalValues(int numIDs, const long long* GIDs,
233 const int* numValuesPerID,
234 const double* values,
235 int vectorIndex=0);
236#endif
237
255 int GlobalAssemble(Epetra_CombineMode mode = Add,
256 bool reuse_map_and_exporter = false);
257
260 void setIgnoreNonLocalEntries(bool flag) {
261 ignoreNonLocalEntries_ = flag;
262 }
263
265
266 protected:
267 template<typename int_type>
268 int inputValues(int numIDs,
269 const int_type* GIDs, const double* values,
270 bool suminto,
271 int vectorIndex);
272
273 template<typename int_type>
274 int inputValues(int numIDs,
275 const int_type* GIDs, const int* numValuesPerID,
276 const double* values,
277 bool suminto,
278 int vectorIndex);
279
280 template<typename int_type>
281 int inputNonlocalValue(int_type GID, double value, bool suminto,
282 int vectorIndex);
283
284 template<typename int_type>
285 int inputNonlocalValues(int_type GID, int numValues, const double* values,
286 bool suminto, int vectorIndex);
287
289 template<typename int_type>
290 void createNonlocalMapAndExporter();
291
293 void destroyNonlocalMapAndExporter();
294
296 template<typename int_type>
297 void zeroNonlocalData();
298
303 void destroyNonlocalData();
304
305 long long myFirstID_;
307
308#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
309 std::vector<int> nonlocalIDs_int_;
310#endif
311#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
312 std::vector<long long> nonlocalIDs_LL_;
313#endif
314
315 template<typename int_type> std::vector<int_type>& nonlocalIDs();
316
317 std::vector<int> nonlocalElementSize_;
318
330 std::vector<std::vector<double> > nonlocalCoefs_;
331
334
337
340
342
343private:
344 template<typename int_type>
345 int GlobalAssemble(Epetra_CombineMode mode, bool reuse_map_and_exporter);
346};
347
348#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
349template<> inline std::vector<int>& Epetra_FEVector::nonlocalIDs<int>()
350{
351 return nonlocalIDs_int_;
352}
353#endif
354
355#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
356template<> inline std::vector<long long>& Epetra_FEVector::nonlocalIDs<long long>()
357{
358 return nonlocalIDs_LL_;
359}
360#endif
361
362#endif
363
Epetra_Combine Mode enumerable type.
Epetra_CombineMode
Epetra_DataAccess
Epetra_BlockMap: A class for partitioning block element vectors and matrices.
Epetra_Export: This class builds an export object for efficient exporting of off-processor elements.
Definition: Epetra_Export.h:62
Epetra Finite-Element Vector.
Epetra_BlockMap * nonlocalMap_
Map describing distribution of nonlocal data.
std::vector< int > nonlocalElementSize_
Epetra_MultiVector * nonlocalVector_
Multivector that holds nonlocal data; source for the Export operation.
std::vector< int_type > & nonlocalIDs()
std::vector< std::vector< double > > nonlocalCoefs_
Array of arrays (one per column) of nonlocal coefficients.
long long myFirstID_
void setIgnoreNonLocalEntries(bool flag)
Set whether or not non-local data values should be ignored.
Epetra_Export * exporter_
Export object that sums nonlocal data into a nonoverlapping distribution.
std::vector< long long > nonlocalIDs_LL_
std::vector< int > nonlocalIDs_int_
Epetra_IntSerialDenseVector: A class for constructing and using dense vectors.
Epetra_LongLongSerialDenseVector: A class for constructing and using dense vectors.
Epetra_MultiVector: A class for constructing and using dense multi-vectors, vectors and matrices in p...
Epetra_MultiVector & operator=(const Epetra_MultiVector &Source)
= Operator.
Epetra_SerialDenseVector: A class for constructing and using dense vectors.