60 bool ignoreNonLocalEntries)
64#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
67#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
70 nonlocalElementSize_(),
75 ignoreNonLocalEntries_(ignoreNonLocalEntries)
84 double *A,
int MyLDA,
int theNumVectors,
85 bool ignoreNonLocalEntries)
89#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
92#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
95 nonlocalElementSize_(),
100 ignoreNonLocalEntries_(ignoreNonLocalEntries)
109 double **ArrayOfPointers,
int theNumVectors,
110 bool ignoreNonLocalEntries)
114#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
117#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
120 nonlocalElementSize_(),
125 ignoreNonLocalEntries_(ignoreNonLocalEntries)
137#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
140#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
143 nonlocalElementSize_(),
148 ignoreNonLocalEntries_(source.ignoreNonLocalEntries_)
163#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
165 const double* values,
168 return(
inputValues( numIDs, GIDs, values,
true, vectorIndex) );
171#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
173 const double* values,
176 return(
inputValues( numIDs, GIDs, values,
true, vectorIndex) );
180#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
193#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
207#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
209 const int* numValuesPerID,
210 const double* values,
213 return(
inputValues( numIDs, GIDs, numValuesPerID, values,
true,
217#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
219 const int* numValuesPerID,
220 const double* values,
223 return(
inputValues( numIDs, GIDs, numValuesPerID, values,
true,
228#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
230 const double* values,
237#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
239 const double* values,
247#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
260#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
274template<
typename int_type>
276 const int_type* GIDs,
277 const double* values,
285 for(
int i=0; i<numIDs; ++i) {
286 if (
Map().MyGID(GIDs[i])) {
306#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
308 const int* numValuesPerID,
309 const double* values,
312 return(
inputValues( numIDs, GIDs, numValuesPerID, values,
false,
316#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
318 const int* numValuesPerID,
319 const double* values,
322 return(
inputValues( numIDs, GIDs, numValuesPerID, values,
false,
327template<
typename int_type>
329 const int_type* GIDs,
330 const int* numValuesPerID,
331 const double* values,
335 if(!
Map().
template GlobalIndicesIsType<int_type>())
336 throw ReportError(
"Epetra_FEVector::inputValues mismatch between argument types (int/long long) and map type.", -1);
339 for(
int i=0; i<numIDs; ++i) {
340 int numValues = numValuesPerID[i];
341 if (
Map().MyGID(GIDs[i])) {
343 for(
int j=0; j<numValues; ++j) {
348 for(
int j=0; j<numValues; ++j) {
356 &(values[offset]), suminto,
367template<
typename int_type>
375template<
typename int_type>
377 const double* values,
bool suminto,
380 if(!
Map().
template GlobalIndicesIsType<int_type>())
381 throw ReportError(
"Epetra_FEVector::inputValues mismatch between argument types (int/long long) and map type.", -1);
386 std::vector<int_type>& nonlocalIDs_var = nonlocalIDs<int_type>();
388 typename std::vector<int_type>::iterator it = std::lower_bound(nonlocalIDs_var.begin(), nonlocalIDs_var.end(), GID);
389 int offset = (int) (it - nonlocalIDs_var.begin());
390 int insertPoint = offset;
391 if (it == nonlocalIDs_var.end() || *it != GID) {
401 std::cerr <<
"Epetra_FEVector ERROR: block-size for GID " << GID <<
" is "
402 << numValues<<
" which doesn't match previously set block-size of "
407 offset = offset*elemSize;
410 for(
int j=0; j<numValues; ++j) {
415 for(
int j=0; j<numValues; ++j) {
426 nonlocalIDs_var.insert(it, GID);
433 for(
int ii=0; ii<elemSize; ++ii) {
438 for(
int j=0; j<numValues; ++j) {
447template<
typename int_type>
449 bool reuse_map_and_exporter)
462 createNonlocalMapAndExporter<int_type>();
470 for(
size_t i=0; i<nonlocalIDs<int_type>().size(); ++i) {
480 if (reuse_map_and_exporter) {
481 zeroNonlocalData<int_type>();
491 bool reuse_map_and_exporter)
493 if(
Map().GlobalIndicesInt())
494#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
495 return GlobalAssemble<int>(mode, reuse_map_and_exporter);
497 throw ReportError(
"Epetra_FEVector::GlobalAssemble: ERROR, GlobalIndicesInt but no API for it.",-1);
500 if(
Map().GlobalIndicesLongLong())
501#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
502 return GlobalAssemble<long long>(mode, reuse_map_and_exporter);
504 throw ReportError(
"Epetra_FEVector::GlobalAssemble: ERROR, GlobalIndicesLongLong but no API for it.",-1);
507 throw ReportError(
"Epetra_FEVector::GlobalAssemble: Internal error, unable to determine global index type of maps", -1);
510template<
typename int_type>
513 std::vector<int_type>& nonlocalIDs_var = nonlocalIDs<int_type>();
518 nlElSzptr, (int_type)
Map().IndexBase64(),
Map().
Comm());
537 if (
this == &source) {
547#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
550#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
560template<
typename int_type>
563 if (nonlocalIDs<int_type>().size() > 0) {
566 for(
size_t i=0; i<nonlocalIDs<int_type>().size(); ++i) {
568 for(
int j=0; j<elemSize; ++j) {
579#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
582#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
#define EPETRA_CHK_ERR(a)
T * Epetra_Util_data_ptr(std::vector< T > &vec)
Function that returns either a pointer to the first entry in the vector or, if the vector is empty,...
Epetra_BlockMap: A class for partitioning block element vectors and matrices.
int MaxElementSize() const
Maximum element size across all processors.
long long MinMyGID64() const
int NumMyElements() const
Number of elements on the calling processor.
const Epetra_BlockMap & Map() const
Returns the address of the Epetra_BlockMap for this multi-vector.
int Export(const Epetra_SrcDistObject &A, const Epetra_Import &Importer, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex *Indexor=0)
Exports an Epetra_DistObject using the Epetra_Import object.
const Epetra_Comm & Comm() const
Returns the address of the Epetra_Comm for this multi-vector.
Epetra_Export: This class builds an export object for efficient exporting of off-processor elements.
Epetra Finite-Element Vector.
int SumIntoGlobalValues(int numIDs, const int *GIDs, const double *values, int vectorIndex=0)
Accumulate values into the vector, adding them to any values that already exist for the specified ind...
Epetra_BlockMap * nonlocalMap_
Map describing distribution of nonlocal data.
void destroyNonlocalData()
Deallocate storage for nonlocal data.
int inputNonlocalValues(int_type GID, int numValues, const double *values, bool suminto, int vectorIndex)
std::vector< int > nonlocalElementSize_
Epetra_MultiVector * nonlocalVector_
Multivector that holds nonlocal data; source for the Export operation.
Epetra_FEVector(const Epetra_BlockMap &Map, int numVectors=1, bool ignoreNonLocalEntries=false)
Constructor that requires a map specifying a non-overlapping data layout.
void destroyNonlocalMapAndExporter()
Deallocate the Map, Export object, and MultiVector for nonlocal data.
std::vector< std::vector< double > > nonlocalCoefs_
Array of arrays (one per column) of nonlocal coefficients.
Epetra_Export * exporter_
Export object that sums nonlocal data into a nonoverlapping distribution.
virtual ~Epetra_FEVector()
Destructor.
Epetra_FEVector & operator=(const Epetra_FEVector &source)
std::vector< long long > nonlocalIDs_LL_
int GlobalAssemble(Epetra_CombineMode mode=Add, bool reuse_map_and_exporter=false)
Gather any overlapping/shared data into the non-overlapping partitioning defined by the Map that was ...
int inputNonlocalValue(int_type GID, double value, bool suminto, int vectorIndex)
bool ignoreNonLocalEntries_
void createNonlocalMapAndExporter()
Allocate the Map, Export object, and MultiVector for nonlocal data.
int ReplaceGlobalValues(int numIDs, const int *GIDs, const double *values, int vectorIndex=0)
Copy values into the vector overwriting any values that already exist for the specified indices.
std::vector< int > nonlocalIDs_int_
void zeroNonlocalData()
Make all the nonlocal multivector entries zero.
int inputValues(int numIDs, const int_type *GIDs, const double *values, bool suminto, int vectorIndex)
Epetra_IntSerialDenseVector: A class for constructing and using dense vectors.
int Length() const
Returns length of vector.
int * Values()
Returns pointer to the values in vector.
Epetra_LongLongSerialDenseVector: A class for constructing and using dense vectors.
int Length() const
Returns length of vector.
long long * Values()
Returns pointer to the values in vector.
Epetra_MultiVector: A class for constructing and using dense multi-vectors, vectors and matrices in p...
int NumVectors() const
Returns the number of vectors in the multi-vector.
int SumIntoGlobalValue(int GlobalRow, int VectorIndex, double ScalarValue)
Adds ScalarValue to existing value at the specified (GlobalRow, VectorIndex) location.
int ReplaceGlobalValue(int GlobalRow, int VectorIndex, double ScalarValue)
Replace current value at the specified (GlobalRow, VectorIndex) location with ScalarValue.
void Assign(const Epetra_MultiVector &rhs)
int PutScalar(double ScalarConstant)
Initialize all values in a multi-vector with constant value.
virtual int ReportError(const std::string Message, int ErrorCode) const
Error reporting method.
Epetra_SerialDenseVector: A class for constructing and using dense vectors.
double * Values() const
Returns pointer to the values in vector.
int Length() const
Returns length of vector.